public function FeedParserTest::testInvalidFeed in Drupal 9
Same name and namespace in other branches
- 8 core/modules/aggregator/tests/src/Functional/FeedParserTest.php \Drupal\Tests\aggregator\Functional\FeedParserTest::testInvalidFeed()
Tests error handling when an invalid feed is added.
File
- core/
modules/ aggregator/ tests/ src/ Functional/ FeedParserTest.php, line 113
Class
- FeedParserTest
- Tests the built-in feed parser with valid feed samples.
Namespace
Drupal\Tests\aggregator\FunctionalCode
public function testInvalidFeed() {
// Simulate a typo in the URL to force a curl exception.
$invalid_url = 'http:/www.drupal.org';
$feed = Feed::create([
'url' => $invalid_url,
'title' => $this
->randomMachineName(),
]);
$feed
->save();
// Update the feed. Use the UI to be able to check the message easily.
$this
->drupalGet('admin/config/services/aggregator');
$this
->clickLink('Update items');
$this
->assertSession()
->pageTextContains('The feed from ' . $feed
->label() . ' seems to be broken because of error');
}