You are here

public function BookManagerTest::providerTestGetBookParents in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/book/tests/src/Unit/BookManagerTest.php \Drupal\Tests\book\Unit\BookManagerTest::providerTestGetBookParents()

Provides test data for testGetBookParents.

Return value

array The test data.

File

core/modules/book/tests/src/Unit/BookManagerTest.php, line 88
Contains \Drupal\Tests\book\Unit\BookManagerTest.

Class

BookManagerTest
@coversDefaultClass \Drupal\book\BookManager @group book

Namespace

Drupal\Tests\book\Unit

Code

public function providerTestGetBookParents() {
  $empty = array(
    'p1' => 0,
    'p2' => 0,
    'p3' => 0,
    'p4' => 0,
    'p5' => 0,
    'p6' => 0,
    'p7' => 0,
    'p8' => 0,
    'p9' => 0,
  );
  return array(
    // Provides a book without an existing parent.
    array(
      array(
        'pid' => 0,
        'nid' => 12,
      ),
      array(),
      array(
        'depth' => 1,
        'p1' => 12,
      ) + $empty,
    ),
    // Provides a book with an existing parent.
    array(
      array(
        'pid' => 11,
        'nid' => 12,
      ),
      array(
        'nid' => 11,
        'depth' => 1,
        'p1' => 11,
      ),
      array(
        'depth' => 2,
        'p1' => 11,
        'p2' => 12,
      ) + $empty,
    ),
    // Provides a book with two existing parents.
    array(
      array(
        'pid' => 11,
        'nid' => 12,
      ),
      array(
        'nid' => 11,
        'depth' => 2,
        'p1' => 10,
        'p2' => 11,
      ),
      array(
        'depth' => 3,
        'p1' => 10,
        'p2' => 11,
        'p3' => 12,
      ) + $empty,
    ),
  );
}