function ForumListingBreadcrumbBuilderTest::providerTestApplies

Same name in other branches
  1. 8.9.x core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumListingBreadcrumbBuilderTest::providerTestApplies()
  2. 10 core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumListingBreadcrumbBuilderTest::providerTestApplies()
  3. 11.x core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumListingBreadcrumbBuilderTest::providerTestApplies()

Provides test data for testApplies().

Return value

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

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

File

core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php, line 76

Class

ForumListingBreadcrumbBuilderTest
@coversDefaultClass \Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder @group forum

Namespace

Drupal\Tests\forum\Unit\Breadcrumb

Code

public function providerTestApplies() {
    // Send a Node mock, because NodeInterface cannot be mocked.
    $mock_term = $this->getMockBuilder('Drupal\\taxonomy\\Entity\\Term')
        ->disableOriginalConstructor()
        ->getMock();
    return [
        [
            FALSE,
        ],
        [
            FALSE,
            'NOT.forum.page',
        ],
        [
            FALSE,
            'forum.page',
        ],
        [
            TRUE,
            'forum.page',
            [
                [
                    'taxonomy_term',
                    'anything',
                ],
            ],
        ],
        [
            TRUE,
            'forum.page',
            [
                [
                    'taxonomy_term',
                    $mock_term,
                ],
            ],
        ],
    ];
}

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