function ForumNodeBreadcrumbBuilderTest::providerTestApplies

Same name in other branches
  1. 9 core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumNodeBreadcrumbBuilderTest::providerTestApplies()
  2. 10 core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumNodeBreadcrumbBuilderTest::providerTestApplies()
  3. 11.x 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:

File

core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php, line 92

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 [
        [
            FALSE,
        ],
        [
            FALSE,
            'NOT.entity.node.canonical',
        ],
        [
            FALSE,
            'entity.node.canonical',
        ],
        [
            FALSE,
            'entity.node.canonical',
            [
                [
                    'node',
                    NULL,
                ],
            ],
        ],
        [
            TRUE,
            'entity.node.canonical',
            [
                [
                    'node',
                    $mock_node,
                ],
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.