You are here

public function EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedByGenerateBundledEntity in Drupal 9

Same name and namespace in other branches
  1. 8 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;
}