public function FeedParserTest::testInvalidFeed in Drupal 8
Same name and namespace in other branches
- 9 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 107
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(t('Update items'));
$this
->assertRaw(t('The feed from %title seems to be broken because of error', [
'%title' => $feed
->label(),
]));
}