You are here

public function FillPdfEntityTestCase::testEntityLink in FillPDF 7

Test fillpdf_context_to_link() and fillpdf_pdf_link() with entities.

File

tests/FillPdfEntityTestCase.test, line 72

Class

FillPdfEntityTestCase
Tests parsing links for entities.

Code

public function testEntityLink() {
  $base_context = array(
    'nodes' => array(),
    'webforms' => array(),
    'uc_orders' => array(),
    'uc_order_products' => array(),
    'entities' => array(),
  );
  $message = "Test case %name:\n<br />%output (actual result) equals\n<br />%expected (expected).";
  foreach ($this
    ->dataProvider() as $test_case) {
    list($name, $entities, $expected) = $test_case;

    // Ensure links were correctly created from context.
    $context = array(
      'entities' => $entities,
    ) + $base_context;
    $output = rawurldecode(fillpdf_context_to_link(1, $context));
    $this
      ->assertEqual($expected, $output, t($message, array(
      '%name' => $name,
      '%output' => $output,
      '%expected' => $expected,
    )));
  }
}