function EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedByGenerateBundledEntity

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedByGenerateBundledEntity()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedByGenerateBundledEntity()
  3. 11.x core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedByGenerateBundledEntity()

Provides test data for ::testIsSatisfiedByGenerateBundledEntity().

File

core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php, line 242

Class

EntityContextDefinitionIsSatisfiedTest
@coversDefaultClass \Drupal\Core\Plugin\Context\EntityContextDefinition @group Plugin

Namespace

Drupal\Tests\Core\Plugin\Context

Code

public function providerTestIsSatisfiedByGenerateBundledEntity() {
    $data = [];
    $data['no requirement'] = [
        TRUE,
        [],
        [
            'first_bundle',
        ],
    ];
    $data['single requirement'] = [
        TRUE,
        [
            'first_bundle',
        ],
        [
            'first_bundle',
        ],
    ];
    $data['single requirement, multiple candidates, satisfies last candidate'] = [
        TRUE,
        [
            'third_bundle',
        ],
        [
            'first_bundle',
            'second_bundle',
            'third_bundle',
        ],
    ];
    $data['single requirement, multiple candidates, satisfies first candidate'] = [
        TRUE,
        [
            'first_bundle',
        ],
        [
            'first_bundle',
            'second_bundle',
            'third_bundle',
        ],
        // Once the first match is found, subsequent candidates are not checked.
[
            'first_bundle',
        ],
    ];
    $data['unsatisfied requirement'] = [
        FALSE,
        [
            'second_bundle',
        ],
        [
            'first_bundle',
            'third_bundle',
        ],
    ];
    $data['multiple requirements'] = [
        TRUE,
        [
            'first_bundle',
            'second_bundle',
        ],
        [
            'first_bundle',
        ],
    ];
    return $data;
}

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