Skip to content
Snippets Groups Projects

Issue #2825712: The allowed values storage setting of list fields should be required

Issue #2825712: The allowed values storage setting of list fields should be required

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 <?php
2
3 namespace Drupal\Tests\options\FunctionalJavascript;
4
5 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
6
7 /**
8 * Tests the machine name transliteration functionality.
9 *
10 * @group javascript
  • 1 <?php
    2
    3 namespace Drupal\Tests\options\FunctionalJavascript;
    4
    5 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
    6
    7 /**
    8 * Tests the machine name transliteration functionality.
  • 37 'name' => 'Article',
    38 'type' => 'article',
    39 ]);
    40
    41 $admin_user = $this->drupalCreateUser([
    42 'administer node fields',
    43 ]);
    44 $this->drupalLogin($admin_user);
    45 $this->drupalPlaceBlock('local_actions_block');
    46
    47 }
    48
    49 /**
    50 * Test for machine name transliteration functionality.
    51 */
    52 public function testMachineNameTransliterations() {
  • 38 'type' => 'article',
    39 ]);
    40
    41 $admin_user = $this->drupalCreateUser([
    42 'administer node fields',
    43 ]);
    44 $this->drupalLogin($admin_user);
    45 $this->drupalPlaceBlock('local_actions_block');
    46
    47 }
    48
    49 /**
    50 * Test for machine name transliteration functionality.
    51 */
    52 public function testMachineNameTransliterations() {
    53
  • 48
    49 /**
    50 * Test for machine name transliteration functionality.
    51 */
    52 public function testMachineNameTransliterations() {
    53
    54 $page = $this->getSession()->getPage();
    55
    56 $node = $this->createNode([
    57 'type' => 'article',
    58 'title' => 'Test',
    59 ]);
    60 $node->save();
    61 $this->drupalGet('/admin/structure/types/manage/article/fields');
    62 $this->assertSession()->pageTextContains('Create a new field');
    63 $this->clickLink('Create a new field');
  • 50 * Test for machine name transliteration functionality.
    51 */
    52 public function testMachineNameTransliterations() {
    53
    54 $page = $this->getSession()->getPage();
    55
    56 $node = $this->createNode([
    57 'type' => 'article',
    58 'title' => 'Test',
    59 ]);
    60 $node->save();
    61 $this->drupalGet('/admin/structure/types/manage/article/fields');
    62 $this->assertSession()->pageTextContains('Create a new field');
    63 $this->clickLink('Create a new field');
    64 $page->find('css', '#edit-new-storage-type')->click();
    65 $page->find('css', '#edit-new-storage-type optgroup:nth-child(3) option:nth-child(2)')->click();
  • 1 <?php
    2
    3 namespace Drupal\Tests\options\FunctionalJavascript;
  • 54 $page = $this->getSession()->getPage();
    55
    56 $node = $this->createNode([
    57 'type' => 'article',
    58 'title' => 'Test',
    59 ]);
    60 $node->save();
    61 $this->drupalGet('/admin/structure/types/manage/article/fields');
    62 $this->assertSession()->pageTextContains('Create a new field');
    63 $this->clickLink('Create a new field');
    64 $page->find('css', '#edit-new-storage-type')->click();
    65 $page->find('css', '#edit-new-storage-type optgroup:nth-child(3) option:nth-child(2)')->click();
    66 $page->find('css', '[data-drupal-selector="edit-label"]')->setValue('list float');
    67 $this->assertSession()->waitForText('field_list_float');
    68 $page->findButton('Save and continue')->click();
    69
    • Everything up until here is pretty much unnecessary if you move this to OptionsFieldUITest and use the createOptionsField() method in that class. That method will directly add the field so you don't have to do it step-by-step via the UI. It's particularly helpful to do this since the actual add Field UI is changing, doing it with createOptionsField() means the test will still work even when that part of the UI changes.

    • utkarsh_33 changed this line in version 12 of the diff

      changed this line in version 12 of the diff

    • Please register or sign in to reply
  • 51 */
    52 public function testMachineNameTransliterations() {
    53
    54 $page = $this->getSession()->getPage();
    55
    56 $node = $this->createNode([
    57 'type' => 'article',
    58 'title' => 'Test',
    59 ]);
    60 $node->save();
    61 $this->drupalGet('/admin/structure/types/manage/article/fields');
    62 $this->assertSession()->pageTextContains('Create a new field');
    63 $this->clickLink('Create a new field');
    64 $page->find('css', '#edit-new-storage-type')->click();
    65 $page->find('css', '#edit-new-storage-type optgroup:nth-child(3) option:nth-child(2)')->click();
    66 $page->find('css', '[data-drupal-selector="edit-label"]')->setValue('list float');
  • 68 $page->findButton('Save and continue')->click();
    69
    70 // Try to save field settings without entering values.
    71 $this->assertSession()->waitForText('Allowed values list');
    72 $page->findButton('Save field settings')->click();
    73
    74 // Message that confirms that this field is required.
    75 $this->assertSession()->waitForText('Please fill in this field');
    76
    77 // Now try to submit the form after entering values.
    78 $page->find('css', '[data-drupal-selector="edit-settings-allowed-values"]')->setValue('1 | 1');
    79 $page->findButton('Save field settings')->click();
    80 $page->findButton('Save settings')->click();
    81
    82 // Confirms that the field is created.
    83 $this->assertSession()->waitForText('field_list_float');
  • utkarsh_33 added 1 commit

    added 1 commit

    Compare with previous version

  • utkarsh_33 added 1 commit

    added 1 commit

    Compare with previous version

  • Lauri Timmanee
  • Lauri Timmanee
  • utkarsh_33 added 1 commit

    added 1 commit

    • fbe3b055 - Expanded test coverage for other list types

    Compare with previous version

  • utkarsh_33 added 1 commit

    added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    • d3b44f42 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Please register or sign in to reply
    Loading