diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php index 543ba6f..508db1c 100644 --- a/core/lib/Drupal/Core/Entity/EntityListController.php +++ b/core/lib/Drupal/Core/Entity/EntityListController.php @@ -144,18 +144,14 @@ class EntityListController implements EntityListControllerInterface { * * Builds the entity list as renderable array for theme_table(). * - * @todo Add a link to add a new item to the #empty text once - * http://drupal.org/node/1783964 is resolved. + * @todo Add a link to add a new item to the #empty text. */ public function render() { $build = array( '#theme' => 'table', '#header' => $this->buildHeader(), '#rows' => array(), - '#empty' => t( - 'There is no @label yet.', - array('@label' => $this->entityInfo['label']) - ), + '#empty' => t('There is no @label yet.', array('@label' => $this->entityInfo['label'])), ); foreach ($this->load() as $entity) { $build['#rows'][$entity->id()] = $this->buildRow($entity); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php index ac360ee..1c51ee6 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php @@ -128,49 +128,59 @@ class ConfigEntityListTest extends WebTestBase { $this->assertIdentical((string) $elements[1], 'default'); $this->assertTrue($elements[2]->children()->xpath('//ul'), 'Operations list found.'); - // Confirm that the 'Add' link is present and works as expected. + // Add a new entity using the operations link. $this->assertLink('Add test configuration'); $this->clickLink('Add test configuration'); $this->assertResponse(200); - - // Add a new entity and confirm that it is added to the list. $edit = array('label' => 'Antelope', 'id' => 'antelope'); $this->drupalPost(NULL, $edit, t('Save')); $this->assertText('Antelope configuration has been created.'); + + // Confirm that the user is returned to the listing, and verify that the + // text of the label and machine name appears in the list (versus elsewhere + // on the page). $this->assertFieldByXpath('//td', 'Antelope', "Label found for added 'Antelope' entity."); $this->assertFieldByXpath('//td', 'antelope', "Machine name found for added 'Antelope' entity."); - // Confirm that the 'Edit' link is present and works as expected. + // Edit the entity using the operations link. $this->assertLink('Edit'); $this->clickLink('Edit'); $this->assertResponse(200); $this->assertTitle('Edit test configuration | Drupal'); - - // Update the entity and confirm that it is changed on the list. $edit = array('label' => 'Albatross', 'id' => 'albatross'); $this->drupalPost(NULL, $edit, t('Save')); $this->assertText('Albatross configuration has been updated.'); + + // Confirm that the user is returned to the listing, and verify that the + // text of the label and machine name appears in the list (versus elsewhere + // on the page). $this->assertFieldByXpath('//td', 'Albatross', "Label found for updated 'Albatross' entity."); $this->assertFieldByXpath('//td', 'albatross', "Machine name found for updated 'Albatross' entity."); - // Confirm that the 'Delete' link is works as expected. + // Delete the added entity using the operations link. $this->assertLink('Delete'); $this->clickLink('Delete'); $this->assertResponse(200); $this->assertTitle('Are you sure you want to delete Albatross | Drupal'); - - // Delete the entity and confirm that it is removed from the list. $this->drupalPost(NULL, array(), t('Delete')); + + // Verify that the text of the label and machine name does not appear in + // the list (though it may appear elsewhere on the page). $this->assertNoFieldByXpath('//td', 'Albatross', "No label found for deleted 'Albatross' entity."); $this->assertNoFieldByXpath('//td', 'albatross', "No machine name found for deleted 'Albatross' entity."); - // Delete the original entity and confirm that the empty text is displayed. + // Delete the original entity using the operations link. $this->clickLink('Delete'); $this->assertResponse(200); $this->assertTitle('Are you sure you want to delete Default | Drupal'); $this->drupalPost(NULL, array(), t('Delete')); + + // Verify that the text of the label and machine name does not appear in + // the list (though it may appear elsewhere on the page). $this->assertNoFieldByXpath('//td', 'Default', "No label found for deleted 'Default' entity."); $this->assertNoFieldByXpath('//td', 'default', "No machine name found for deleted 'Default' entity."); + + // Confirm that the empty text is displayed. $this->assertText('There is no Test configuration yet.'); }