You are here

public function MicrodataFieldTestCase::parseMicrodata in Microdata 7

Helper function; Parse the HTML output of the current page.

Return value

Object Return the parsed object.

5 calls to MicrodataFieldTestCase::parseMicrodata()
DateTestCase::testMarkup in modules/date/date.test
Tests whether microdata is correctly outputted, depending on the field formatter type.
EmailTestCase::testMarkup in modules/email/email.test
Tests whether microdata is correctly outputted, depending on the field formatter type.
MicrodataCompoundFieldsMarkupTestCase::testAttributesInMarkup in ./microdata.test
Tests the placement of attributes in field markup.
MicrodataCoreFieldsMarkupTestCase::testAttributesInMarkup in ./microdata.test
Tests the placement of attributes in field markup.
MicrodataReferenceFieldsTestCase::testAttributesInMarkup in ./microdata.test
Tests the placement of attributes in field markup.

File

./microdata.test, line 84
Tests for microdata.module.

Class

MicrodataFieldTestCase
Abstract class for testing Markup

Code

public function parseMicrodata($test = NULL) {
  if ($test == NULL) {
    $test = $this;
  }

  // Only use this version of MicrodataPHP for tests. Any other use should
  // use a copy managed by libraries module.
  $path = drupal_get_path('module', 'microdata') . '/tests/MicrodataPHP/MicrodataPhp.php';
  require_once $path;

  // MicrodataPhp requires a url be passed in, as opposed to an HTML string.
  // To get a URL for the content string, we reuse simpletest_verbose().
  if ($id = simpletest_verbose($test
    ->drupalGetContent())) {
    $url = file_create_url($test->originalFileDirectory . '/simpletest/verbose/' . get_class($test) . '-' . $id . '.html');
  }
  $md = new MicrodataPhp($url);
  return $md
    ->obj();
}