You are here

public function FillPdfEntityTestCase::dataProvider in FillPDF 7

Data provider for testEntityLink().

Return value

array Array of test cases.

1 call to FillPdfEntityTestCase::dataProvider()
FillPdfEntityTestCase::testEntityLink in tests/FillPdfEntityTestCase.test
Test fillpdf_context_to_link() and fillpdf_pdf_link() with entities.

File

tests/FillPdfEntityTestCase.test, line 105

Class

FillPdfEntityTestCase
Tests parsing links for entities.

Code

public function dataProvider() {
  $base_url = url('fillpdf', array(
    'query' => array(
      'fid' => 1,
    ),
    'absolute' => TRUE,
  ));
  $test_cases = array();

  // Test case: single node.
  $test_cases[] = array(
    'Single node',
    array(
      'node' => array_slice($this->nodes, 0, 1),
    ),
    $base_url . '&entity_id=node:1',
  );

  // Test case: multiple nodes.
  $test_cases[] = [
    'Multiple nodes',
    array(
      'node' => $this->nodes,
    ),
    $base_url . '&entity_ids[0]=node:1&entity_ids[1]=node:2&entity_ids[2]=node:3',
  ];

  // Test case: multiple nodes in reverse order.
  $test_cases[] = [
    'Multiple nodes (in reverse order)',
    array(
      'node' => array_reverse($this->nodes),
    ),
    $base_url . '&entity_ids[0]=node:3&entity_ids[1]=node:2&entity_ids[2]=node:1',
  ];

  // Test case: single term.
  $test_cases[] = array(
    'Single term',
    array(
      'taxonomy_term' => array_slice($this->terms, 0, 1),
    ),
    $base_url . '&entity_id=taxonomy_term:11',
  );

  // Test case: multiple terms.
  $test_cases[] = [
    'Multiple terms',
    array(
      'taxonomy_term' => $this->terms,
    ),
    $base_url . '&entity_ids[0]=taxonomy_term:11&entity_ids[1]=taxonomy_term:12&entity_ids[2]=taxonomy_term:13',
  ];

  // Test case: single user.
  $test_cases[] = array(
    'Single user',
    array(
      'user' => array_slice($this->users, 0, 1),
    ),
    $base_url . '&entity_id=user:111',
  );

  // Test case: multiple users.
  $test_cases[] = [
    'Multiple users',
    array(
      'user' => $this->users,
    ),
    $base_url . '&entity_ids[0]=user:111&entity_ids[1]=user:112&entity_ids[2]=user:113',
  ];

  // Test case: node, term, user.
  $test_cases[] = array(
    'Node, term, user',
    array(
      'node' => array_slice($this->nodes, 0, 1),
      'taxonomy_term' => array_slice($this->terms, 0, 1),
      'user' => array_slice($this->users, 0, 1),
    ),
    $base_url . '&entity_ids[0]=node:1&entity_ids[1]=taxonomy_term:11&entity_ids[2]=user:111',
  );

  // Test case: user, term, multiple nodes.
  $test_cases[] = array(
    'user, term, multiple nodes',
    array(
      'user' => array_slice($this->users, 0, 1),
      'taxonomy_term' => array_slice($this->terms, 0, 1),
      'node' => $this->nodes,
    ),
    $base_url . '&entity_ids[0]=user:111&entity_ids[1]=taxonomy_term:11&entity_ids[2]=node:1&entity_ids[3]=node:2&entity_ids[4]=node:3',
  );

  // Test case: user, multiple nodes in reverse order, term.
  $test_cases[] = array(
    'user, multiple nodes (in reverse order), term',
    array(
      'user' => array_slice($this->users, 0, 1),
      'node' => array_reverse($this->nodes),
      'taxonomy_term' => array_slice($this->terms, 0, 1),
    ),
    $base_url . '&entity_ids[0]=user:111&entity_ids[1]=node:3&entity_ids[2]=node:2&entity_ids[3]=node:1&entity_ids[4]=taxonomy_term:11',
  );
  return $test_cases;
}