You are here

public function ContextDefinitionIsSatisfiedTest::testIsSatisfiedBy in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionIsSatisfiedTest::testIsSatisfiedBy()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionIsSatisfiedTest::testIsSatisfiedBy()

Tests that context requirements is satisfied as expected.

@covers ::isSatisfiedBy @covers ::dataTypeMatches @covers ::getSampleValues @covers ::getConstraintObjects

@dataProvider providerTestIsSatisfiedBy

Parameters

bool $expected: The expected outcome.

\Drupal\Core\Plugin\Context\ContextDefinition $requirement: The requirement to check against.

\Drupal\Core\Plugin\Context\ContextDefinition $definition: The context definition to check.

mixed $value: (optional) The value to set on the context, defaults to NULL.

File

core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php, line 75

Class

ContextDefinitionIsSatisfiedTest
@coversDefaultClass \Drupal\Core\Plugin\Context\ContextDefinition @group Plugin

Namespace

Drupal\Tests\Core\Plugin\Context

Code

public function testIsSatisfiedBy($expected, ContextDefinition $requirement, ContextDefinition $definition, $value = NULL) {
  $context = new Context($definition, $value);
  $this
    ->assertSame($expected, $requirement
    ->isSatisfiedBy($context));
}