public function FeedParserTest::testInvalidFeed in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/src/Tests/FeedParserTest.php \Drupal\aggregator\Tests\FeedParserTest::testInvalidFeed()
Tests error handling when an invalid feed is added.
File
- core/
modules/ aggregator/ src/ Tests/ FeedParserTest.php, line 103 - Contains \Drupal\aggregator\Tests\FeedParserTest.
Class
- FeedParserTest
- Tests the built-in feed parser with valid feed samples.
Namespace
Drupal\aggregator\TestsCode
public function testInvalidFeed() {
// Simulate a typo in the URL to force a curl exception.
$invalid_url = 'http:/www.drupal.org';
$feed = entity_create('aggregator_feed', array(
'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', array(
'%title' => $feed
->label(),
)));
}