function ContextDefinitionIsSatisfiedTest::testIsSatisfiedBy

Same name 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()
  3. 11.x 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));
}

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