You are here

public function XPathHTMLParserTest::_testGetRaw in Feeds XPath Parser 8

1 call to XPathHTMLParserTest::_testGetRaw()
XPathHTMLParserTest::test in lib/Drupal/feeds_xpathparser/Tests/XPathHTMLParserTest.php
Run tests.

File

lib/Drupal/feeds_xpathparser/Tests/XPathHTMLParserTest.php, line 200
Contains Drupal\feeds_xpathparser\Tests\XPathHTMLParserTest.

Class

XPathHTMLParserTest
Test single feeds.

Namespace

Drupal\feeds_xpathparser\Tests

Code

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

  // Change importer defaults.
  $edit = array(
    'context' => '/html',
    'sources[xpathparser:0]' => 'head/title',
    'sources[xpathparser:2]' => 'body',
    'raw_xml[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/';
  $fid = $this
    ->createFeed('xpath', $path . 'simple.html', 'Testing GetRaw');
  $this
    ->assertText(t('Created 1'));
  $nid = db_query('SELECT MAX(nid) FROM {node}')
    ->fetchField();
  $this
    ->drupalGet("node/{$nid}/edit");
  $this
    ->assertFieldByName('body[und][0][value]', '<body><div>bla bla</div></body>');
}