diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php index 13f5a76..b16373c 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php @@ -88,6 +88,22 @@ function testList() { ); $actual_items = $controller->buildRow($entity); $this->assertIdentical($expected_items, $actual_items, 'Return value from buildRow matches expected.'); + // Test sorting. + $entity = entity_create('config_test', array( + 'id' => 'alpha', + 'label' => 'Alpha', + 'weight' => 1, + )); + $entity->save(); + $entity = entity_create('config_test', array( + 'id' => 'omega', + 'label' => 'Omega', + 'weight' => 1, + )); + $entity->save(); + $list = $controller->load(); + $entity = end($list); + $this->assertEqual($entity->label, 'Omega'); } /** @@ -132,7 +148,11 @@ function testListUI() { $this->assertLink('Add test configuration'); $this->clickLink('Add test configuration'); $this->assertResponse(200); - $edit = array('label' => 'Antelope', 'id' => 'antelope'); + $edit = array( + 'label' => 'Antelope', + 'id' => 'antelope', + 'weight' => 1, + ); $this->drupalPost(NULL, $edit, t('Save')); // Confirm that the user is returned to the listing, and verify that the @@ -142,8 +162,8 @@ function testListUI() { $this->assertFieldByXpath('//td', 'antelope', "Machine name found for added 'Antelope' entity."); // Edit the entity using the operations link. - $this->assertLink('Edit'); - $this->clickLink('Edit'); + $this->assertLink('Edit', 1); + $this->clickLink('Edit', 1); $this->assertResponse(200); $this->assertTitle('Edit Antelope | Drupal'); $edit = array('label' => 'Albatross', 'id' => 'albatross'); @@ -156,8 +176,8 @@ function testListUI() { $this->assertFieldByXpath('//td', 'albatross', "Machine name found for updated 'Albatross' entity."); // Delete the added entity using the operations link. - $this->assertLink('Delete'); - $this->clickLink('Delete'); + $this->assertLink('Delete', 1); + $this->clickLink('Delete', 1); $this->assertResponse(200); $this->assertTitle('Are you sure you want to delete Albatross | Drupal'); $this->drupalPost(NULL, array(), t('Delete')); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php index 95089f7..92379c1 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php @@ -106,6 +106,7 @@ function testNew() { 'id' => 'new', 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'label' => 'New', + 'weight' => '0', 'style' => '', 'langcode' => 'und', ); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php index dd24224..90807b5 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php @@ -58,6 +58,7 @@ function testImport() { 'id' => 'new', 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'label' => 'New', + 'weight' => '0', 'style' => '', 'langcode' => 'und', ); diff --git a/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml b/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml index 3e50e3b..c22273b 100644 --- a/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml +++ b/core/modules/config/tests/config_test/config/config_test.dynamic.default.yml @@ -1,2 +1,3 @@ id: default label: Default +weight: 0 diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php index 7e54e1c..eafcd09 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php @@ -35,6 +35,11 @@ public function form(array $form, array &$form_state, EntityInterface $entity) { 'exists' => 'config_test_load', ), ); + $form['weight'] = array( + '#type' => 'weight', + '#title' => 'Weight', + '#default_value' => $entity->get('weight'), + ); $form['style'] = array( '#type' => 'select', '#title' => 'Image style', diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php index 8690b2a..8fec7fd 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php @@ -56,6 +56,13 @@ class ConfigTest extends ConfigEntityBase { public $label; /** + * The weight of the configuration entity in relation to others. + * + * @var integer + */ + public $weight = 0; + + /** * The image style to use. * * @var string