diff --git a/core/modules/aggregator/src/Tests/AddFeedTest.php b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php similarity index 98% rename from core/modules/aggregator/src/Tests/AddFeedTest.php rename to core/modules/aggregator/tests/src/Functional/AddFeedTest.php index 4dfeb95572..e4f63ea731 100644 --- a/core/modules/aggregator/src/Tests/AddFeedTest.php +++ b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php @@ -1,6 +1,6 @@ assertEqual(1, count($result), 'Created feed is found in the overview'); // Check if the fields in the table match with what's expected. - $this->assertEqual($feed->label(), (string) $result[0]->td[0]->a); + $link = $this->xpath('//table/tbody/tr//td[1]/a'); + $this->assertEquals($feed->label(), $link[0]->getText()); $count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed); - $this->assertEqual(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), (string) $result[0]->td[1]); + $td = $this->xpath('//table/tbody/tr//td[2]'); + $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText()); // Update the items of the first feed. $feed->refreshItems(); $this->drupalGet('admin/config/services/aggregator'); $result = $this->xpath('//table/tbody/tr'); // Check if the fields in the table match with what's expected. - $this->assertEqual($feed->label(), (string) $result[0]->td[0]->a); + $link = $this->xpath('//table/tbody/tr//td[1]/a'); + $this->assertEquals($feed->label(), $link[0]->getText()); $count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed); - $this->assertEqual(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), (string) $result[0]->td[1]); + $td = $this->xpath('//table/tbody/tr//td[2]'); + $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText()); } } diff --git a/core/modules/aggregator/src/Tests/AggregatorCronTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php similarity index 93% rename from core/modules/aggregator/src/Tests/AggregatorCronTest.php rename to core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php index 9ebb2d25c0..bb7c90ae32 100644 --- a/core/modules/aggregator/src/Tests/AggregatorCronTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php @@ -1,6 +1,8 @@ drupalGet('aggregator/opml'); - $outline = $this->xpath('//outline[1]'); - $this->assertEqual($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.'); - $this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for rss OPML.'); - $this->assertEqual($outline[0]['xmlurl'], $feed->getUrl(), 'The correct xmlUrl attribute is used for rss OPML.'); + $content = $this->getSession()->getPage()->getContent(); + // We can't use Mink xpath queries here because it only supports HTML pages, + // but we are dealing with XML here. + $xml = simplexml_load_string($content); + $attributes = $xml->xpath('//outline[1]')[0]->attributes(); + $this->assertEquals('rss', $attributes->type); + $this->assertEquals($feed->label(), $attributes->text); + $this->assertEquals($feed->getUrl(), $attributes->xmlUrl); // Check for the presence of a pager. $this->drupalGet('aggregator/sources/' . $feed->id()); diff --git a/core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php similarity index 98% rename from core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php rename to core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php index 46366b4957..e057be6e61 100644 --- a/core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php +++ b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php @@ -1,6 +1,6 @@