public function FeedsExHtmlTests::test in Feeds extensible parsers 7
Same name and namespace in other branches
- 7.2 src/Tests/FeedsExHtml.test \FeedsExHtmlTests::test()
Tests the full import process.
File
- src/
Tests/ FeedsExHtml.test, line 288
Class
- FeedsExHtmlTests
- Integration tests for FeedsExHtml.
Code
public function test() {
$this
->setContext('syndication', '//div[@class="post"]');
$this
->addMappings('syndication', array(
0 => array(
'source' => $this
->addExpression('syndication', 'h3'),
'target' => 'title',
),
1 => array(
'source' => $this
->addExpression('syndication', 'p'),
'target' => 'body',
),
));
$this
->importUrl('syndication', file_create_url(drupal_get_path('module', 'feeds_ex') . '/tests/resources/test.html'));
$this
->drupalGet('node/1/edit');
$this
->assertFieldByName('title', 'I am a title<thing>Stuff</thing>');
$this
->assertFieldByName('body[und][0][value]', 'I am a description0');
$this
->drupalGet('node/2/edit');
$this
->assertFieldByName('title', 'I am a title1');
$this
->assertFieldByName('body[und][0][value]', 'I am a description1');
$this
->drupalGet('node/3/edit');
$this
->assertFieldByName('title', 'I am a title2');
$this
->assertFieldByName('body[und][0][value]', 'I am a description2');
}