You are here

public function FeedsXPathParseHTMLTestCase::_testGetRaw in Feeds XPath Parser 7

1 call to FeedsXPathParseHTMLTestCase::_testGetRaw()
FeedsXPathParseHTMLTestCase::test in tests/feeds_xpathparser_parser_html.test
Run tests.

File

tests/feeds_xpathparser_parser_html.test, line 197
Tests for FeedsXPathParser.inc.

Class

FeedsXPathParseHTMLTestCase
Test single feeds.

Code

public function _testGetRaw($importer_url) {
  $this
    ->addMappings('xpath', array(
    2 => array(
      'source' => 'xpathparser:2',
      'target' => 'body',
    ),
  ));

  // Change importer defaults.
  $edit = array(
    'xpath[context]' => '/html',
    'xpath[sources][xpathparser:0]' => 'head/title',
    'xpath[sources][xpathparser:2]' => 'body',
    'xpath[rawXML][xpathparser:2]' => TRUE,
  );
  $this
    ->postAndCheck($importer_url, $edit, t('Save'), t('Your changes have been saved.'));
  $path = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds_xpathparser') . '/tests/feeds_xpathparser/';
  $nid = $this
    ->createFeedNode('xpath', $path . 'simple.html', 'Testing GetRaw');
  $feed_node_edit_url = "node/{$nid}/edit";
  $this
    ->assertText(t('Created 1 node'));
  $url = 'node/' . ++$nid . '/edit';
  $this
    ->drupalGet($url);
  $this
    ->assertFieldByName('body[und][0][value]', '<body><div>bla bla</div></body>');
}