diff --git a/core/modules/tour/tests/src/Functional/TourHelpPageTest.php b/core/modules/tour/tests/src/Functional/TourHelpPageTest.php index 78b35d0..e176005 100644 --- a/core/modules/tour/tests/src/Functional/TourHelpPageTest.php +++ b/core/modules/tour/tests/src/Functional/TourHelpPageTest.php @@ -76,7 +76,7 @@ protected function verifyHelp($tours_ok = TRUE) { $this->assertText('Tours guide you through workflows'); } else { - $this->assertSession()->pageTextNotContains('Tours guide you through workflows'); + $this->assertNoText('Tours guide you through workflows'); } $titles = $this->getTourList(); @@ -87,7 +87,7 @@ protected function verifyHelp($tours_ok = TRUE) { $this->assertLink($title); } else { - $this->assertSession()->linkNotExists($title); + $this->assertNoLink($title); // Just test the first item in the list of links that should not // be there, because the second matches the name of a module that is // in the Module overviews section, so the link will be there and @@ -101,10 +101,10 @@ protected function verifyHelp($tours_ok = TRUE) { foreach ($titles[1] as $title) { if ($tours_ok) { $this->assertText($title); - $this->assertSession()->linkNotExists($title); + $this->assertNoLink($title); } else { - $this->assertSession()->pageTextNotContains($title); + $this->assertNoText($title); // Just test the first item in the list of text that should not // be there, because the second matches part of the name of a module // that is in the Module overviews section, so the text will be there diff --git a/core/modules/tour/tests/src/Functional/TourTest.php b/core/modules/tour/tests/src/Functional/TourTest.php index 933055b..36a5c77 100644 --- a/core/modules/tour/tests/src/Functional/TourTest.php +++ b/core/modules/tour/tests/src/Functional/TourTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\tour\Functional; -use Drupal\Core\Url; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\tour\Entity\Tour; @@ -64,34 +63,34 @@ public function testTourFunctionality() { $this->assertTourTips($tips); $this->assertTourTips(); - $elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./p//a[@href=:href and contains(., :text)]]', [ + $elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./p//a[@href=:href and contains(., :text)]]', array( ':classes' => 'tip-module-tour-test tip-type-text tip-tour-test-1', ':data_id' => 'tour-test-1', - ':href' => Url::fromRoute('', array(), array('absolute' => TRUE))->toString(), + ':href' => \Drupal::url('', [], ['absolute' => TRUE]), ':text' => 'Drupal', - ]); - $this->assertEquals(count($elements), 1, 'Found Token replacement.'); + )); + $this->assertEqual(count($elements), 1, 'Found Token replacement.'); $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('The first tip')"); - $this->assertEquals(count($elements), 1, 'Found English variant of tip 1.'); + $this->assertEqual(count($elements), 1, 'Found English variant of tip 1.'); $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')"); - $this->assertNotEquals(count($elements), 1, 'Did not find English variant of tip 2.'); + $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 2.'); $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('La pioggia cade in spagna')"); - $this->assertNotEquals(count($elements), 1, 'Did not find Italian variant of tip 1.'); + $this->assertNotEqual(count($elements), 1, 'Did not find Italian variant of tip 1.'); // Ensure that plugins work. $elements = $this->xpath('//img[@src="http://local/image.png"]'); - $this->assertEquals(count($elements), 1, 'Image plugin tip found.'); + $this->assertEqual(count($elements), 1, 'Image plugin tip found.'); // Navigate to tour-test-2/subpath and verify the tour_test_2 tip is found. $this->drupalGet('tour-test-2/subpath'); $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')"); - $this->assertEquals(count($elements), 1, 'Found English variant of tip 2.'); + $this->assertEqual(count($elements), 1, 'Found English variant of tip 2.'); $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('The first tip')"); - $this->assertNotEquals(count($elements), 1, 'Did not find English variant of tip 1.'); + $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.'); // Enable Italian language and navigate to it/tour-test1 and verify italian // version of tip is found. @@ -99,10 +98,10 @@ public function testTourFunctionality() { $this->drupalGet('it/tour-test-1'); $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('La pioggia cade in spagna')"); - $this->assertEquals(count($elements), 1, 'Found Italian variant of tip 1.'); + $this->assertEqual(count($elements), 1, 'Found Italian variant of tip 1.'); $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')"); - $this->assertNotEquals(count($elements), 1, 'Did not find English variant of tip 1.'); + $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.'); // Programmatically create a tour for use through the remainder of the test. $tour = Tour::create(array( @@ -141,26 +140,26 @@ public function testTourFunctionality() { // Ensure that a tour entity has the expected dependencies based on plugin // providers and the module named in the configuration entity. $dependencies = $tour->calculateDependencies()->getDependencies(); - $this->assertEquals($dependencies['module'], array('system', 'tour_test')); + $this->assertEqual($dependencies['module'], array('system', 'tour_test')); $this->drupalGet('tour-test-1'); // Load it back from the database and verify storage worked. $entity_save_tip = Tour::load('tour-entity-create-test-en'); // Verify that hook_ENTITY_TYPE_load() integration worked. - $this->assertEquals($entity_save_tip->loaded, 'Load hooks work'); + $this->assertEqual($entity_save_tip->loaded, 'Load hooks work'); // Verify that hook_ENTITY_TYPE_presave() integration worked. - $this->assertEquals($entity_save_tip->label(), 'Tour test english alter'); + $this->assertEqual($entity_save_tip->label(), 'Tour test english alter'); // Navigate to tour-test-1 and verify the new tip is found. $this->drupalGet('tour-test-1'); $elements = $this->cssSelect("li[data-id=tour-code-test-1] h2:contains('The rain in spain')"); - $this->assertEquals(count($elements), 1, 'Found the required tip markup for tip 4'); + $this->assertEqual(count($elements), 1, 'Found the required tip markup for tip 4'); // Verify that the weight sorting works by ensuring the lower weight item // (tip 4) has the 'End tour' button. $elements = $this->cssSelect("li[data-id=tour-code-test-1][data-text='End tour']"); - $this->assertEquals(count($elements), 1, 'Found code tip was weighted last and had "End tour".'); + $this->assertEqual(count($elements), 1, 'Found code tip was weighted last and had "End tour".'); // Test hook_tour_alter(). $this->assertText('Altered by hook_tour_tips_alter'); @@ -168,22 +167,22 @@ public function testTourFunctionality() { // Navigate to tour-test-3 and verify the tour_test_1 tip is found with // appropriate classes. $this->drupalGet('tour-test-3/foo'); - $elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./h2[contains(., :text)]]', [ + $elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./h2[contains(., :text)]]', array( ':classes' => 'tip-module-tour-test tip-type-text tip-tour-test-1', ':data_id' => 'tour-test-1', ':text' => 'The first tip', - ]); - $this->assertEquals(count($elements), 1, 'Found English variant of tip 1.'); + )); + $this->assertEqual(count($elements), 1, 'Found English variant of tip 1.'); // Navigate to tour-test-3 and verify the tour_test_1 tip is not found with // appropriate classes. $this->drupalGet('tour-test-3/bar'); - $elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./h2[contains(., :text)]]', [ + $elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./h2[contains(., :text)]]', array( ':classes' => 'tip-module-tour-test tip-type-text tip-tour-test-1', ':data_id' => 'tour-test-1', ':text' => 'The first tip', - ]); - $this->assertEquals(count($elements), 0, 'Did not find English variant of tip 1.'); + )); + $this->assertEqual(count($elements), 0, 'Did not find English variant of tip 1.'); } } diff --git a/core/modules/tour/tests/src/Functional/TourTestBase.php b/core/modules/tour/tests/src/Functional/TourTestBase.php index 7011ae1..11fe2e0 100644 --- a/core/modules/tour/tests/src/Functional/TourTestBase.php +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php @@ -10,8 +10,8 @@ abstract class TourTestBase extends BrowserTestBase { /** - * Assert function to determine if tips rendered to the page have a - * corresponding page element. + * Assert function to determine if tips rendered to the page + * have a corresponding page element. * * @param array $tips * A list of tips which provide either a "data-id" or "data-class". diff --git a/core/modules/tour/tests/src/Kernel/TourPluginTest.php b/core/modules/tour/tests/src/Kernel/TourPluginTest.php index 27a7310..9278e2e 100644 --- a/core/modules/tour/tests/src/Kernel/TourPluginTest.php +++ b/core/modules/tour/tests/src/Kernel/TourPluginTest.php @@ -36,7 +36,7 @@ protected function setUp() { * Test tour plugins. */ public function testTourPlugins() { - $this->assertSame(count($this->pluginManager->getDefinitions()), 1, 'Only tour plugins for the enabled modules were returned.'); + $this->assertIdentical(count($this->pluginManager->getDefinitions()), 1, 'Only tour plugins for the enabled modules were returned.'); } }