public function FeedParserTest::testAtomSample in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/src/Tests/FeedParserTest.php \Drupal\aggregator\Tests\FeedParserTest::testAtomSample()
Tests a feed that uses the Atom format.
File
- core/
modules/ aggregator/ src/ Tests/ FeedParserTest.php, line 56 - Contains \Drupal\aggregator\Tests\FeedParserTest.
Class
- FeedParserTest
- Tests the built-in feed parser with valid feed samples.
Namespace
Drupal\aggregator\TestsCode
public function testAtomSample() {
$feed = $this
->createFeed($this
->getAtomSample());
$feed
->refreshItems();
$this
->drupalGet('aggregator/sources/' . $feed
->id());
$this
->assertResponse(200, format_string('Feed %name exists.', array(
'%name' => $feed
->label(),
)));
$this
->assertText('Atom-Powered Robots Run Amok');
$this
->assertLinkByHref('http://example.org/2003/12/13/atom03');
$this
->assertText('Some text.');
$this
->assertEqual('urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', db_query('SELECT guid FROM {aggregator_item} WHERE link = :link', array(
':link' => 'http://example.org/2003/12/13/atom03',
))
->fetchField(), 'Atom entry id element is parsed correctly.');
// Check for second feed entry.
$this
->assertText('We tried to stop them, but we failed.');
$this
->assertLinkByHref('http://example.org/2003/12/14/atom03');
$this
->assertText('Some other text.');
$db_guid = db_query('SELECT guid FROM {aggregator_item} WHERE link = :link', array(
':link' => 'http://example.org/2003/12/14/atom03',
))
->fetchField();
$this
->assertEqual('urn:uuid:1225c695-cfb8-4ebb-bbbb-80da344efa6a', $db_guid, 'Atom entry id element is parsed correctly.');
}