X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FMenu%2FLocalTasksTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Fsrc%2FTests%2FMenu%2FLocalTasksTest.php;h=12a157d5879a2e0355f4f4c18964bd92eca67a0e;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=7171d3e541c1165d655326b228271f0dbec0075d;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/system/src/Tests/Menu/LocalTasksTest.php b/web/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php similarity index 89% rename from web/core/modules/system/src/Tests/Menu/LocalTasksTest.php rename to web/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php index 7171d3e54..12a157d58 100644 --- a/web/core/modules/system/src/Tests/Menu/LocalTasksTest.php +++ b/web/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php @@ -1,17 +1,17 @@ $route_info) { list($route_name, $route_parameters) = $route_info; $expected = Url::fromRoute($route_name, $route_parameters)->toString(); - $method = ($elements[$index]['href'] == $expected ? 'pass' : 'fail'); + $method = ($elements[$index]->getAttribute('href') == $expected ? 'pass' : 'fail'); $this->{$method}(format_string('Task @number href @value equals @expected.', [ '@number' => $index + 1, - '@value' => (string) $elements[$index]['href'], + '@value' => $elements[$index]->getAttribute('href'), '@expected' => $expected, ])); } @@ -129,7 +129,7 @@ class LocalTasksTest extends WebTestBase { // Ensure the view tab is active. $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]/a'); $this->assertEqual(1, count($result), 'There is just a single active tab.'); - $this->assertEqual('View', (string) $result[0], 'The view tab is active.'); + $this->assertEqual('View(active tab)', $result[0]->getText(), 'The view tab is active.'); // Verify that local tasks in the second level appear. $sub_tasks = [ @@ -144,15 +144,15 @@ class LocalTasksTest extends WebTestBase { $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]/a'); $this->assertEqual(1, count($result), 'There is just a single active tab.'); - $this->assertEqual('Settings', (string) $result[0], 'The settings tab is active.'); + $this->assertEqual('Settings(active tab)', $result[0]->getText(), 'The settings tab is active.'); $this->drupalGet(Url::fromRoute('menu_test.local_task_test_tasks_settings_sub1')); $this->assertLocalTasks($sub_tasks, 1); $result = $this->xpath('//ul[contains(@class, "tabs")]//a[contains(@class, "active")]'); $this->assertEqual(2, count($result), 'There are tabs active on both levels.'); - $this->assertEqual('Settings', (string) $result[0], 'The settings tab is active.'); - $this->assertEqual('Dynamic title for TestTasksSettingsSub1', (string) $result[1], 'The sub1 tab is active.'); + $this->assertEqual('Settings(active tab)', $result[0]->getText(), 'The settings tab is active.'); + $this->assertEqual('Dynamic title for TestTasksSettingsSub1(active tab)', $result[1]->getText(), 'The sub1 tab is active.'); $this->assertCacheTag('kittens:ragdoll'); $this->assertCacheTag('kittens:dwarf-cat'); @@ -162,8 +162,8 @@ class LocalTasksTest extends WebTestBase { $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]'); $this->assertEqual(2, count($result), 'There are tabs active on both levels.'); - $this->assertEqual('Settings', (string) $result[0]->a, 'The settings tab is active.'); - $this->assertEqual('Derive 1', (string) $result[1]->a, 'The derive1 tab is active.'); + $this->assertEqual('Settings(active tab)', $result[0]->getText(), 'The settings tab is active.'); + $this->assertEqual('Derive 1(active tab)', $result[1]->getText(), 'The derive1 tab is active.'); // Ensures that the local tasks contains the proper 'provider key' $definitions = $this->container->get('plugin.manager.menu.local_task')->getDefinitions(); @@ -190,7 +190,7 @@ class LocalTasksTest extends WebTestBase { $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]'); $this->assertEqual(1, count($result), 'There is one active tab.'); - $this->assertEqual('upcasting sub1', (string) $result[0]->a, 'The "upcasting sub1" tab is active.'); + $this->assertEqual('upcasting sub1(active tab)', $result[0]->getText(), 'The "upcasting sub1" tab is active.'); $this->drupalGet(Url::fromRoute('menu_test.local_task_test_upcasting_sub2', ['entity_test' => '1'])); @@ -202,7 +202,7 @@ class LocalTasksTest extends WebTestBase { $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]'); $this->assertEqual(1, count($result), 'There is one active tab.'); - $this->assertEqual('upcasting sub2', (string) $result[0]->a, 'The "upcasting sub2" tab is active.'); + $this->assertEqual('upcasting sub2(active tab)', $result[0]->getText(), 'The "upcasting sub2" tab is active.'); } /**