You are here

public function ForumNodeBreadcrumbBuilderTest::providerTestApplies in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumNodeBreadcrumbBuilderTest::providerTestApplies()

Provides test data for testApplies().

Note that this test is incomplete, because we can't mock NodeInterface.

Return value

array Array of datasets for testApplies(). Structured as such:

  • ForumNodeBreadcrumbBuilder::applies() expected result.
  • ForumNodeBreadcrumbBuilder::applies() $attributes input array.

File

core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php, line 92
Contains \Drupal\Tests\forum\Unit\Breadcrumb\ForumNodeBreadcrumbBuilderTest.

Class

ForumNodeBreadcrumbBuilderTest
@coversDefaultClass \Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder @group forum

Namespace

Drupal\Tests\forum\Unit\Breadcrumb

Code

public function providerTestApplies() {

  // Send a Node mock, because NodeInterface cannot be mocked.
  $mock_node = $this
    ->getMockBuilder('Drupal\\node\\Entity\\Node')
    ->disableOriginalConstructor()
    ->getMock();
  return array(
    array(
      FALSE,
    ),
    array(
      FALSE,
      'NOT.entity.node.canonical',
    ),
    array(
      FALSE,
      'entity.node.canonical',
    ),
    array(
      FALSE,
      'entity.node.canonical',
      array(
        array(
          'node',
          NULL,
        ),
      ),
    ),
    array(
      TRUE,
      'entity.node.canonical',
      array(
        array(
          'node',
          $mock_node,
        ),
      ),
    ),
  );
}