class ContextDefinitionTest
Same name in this branch
- 8.9.x core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\Annotation\ContextDefinitionTest
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\ContextDefinitionTest
- 11.x core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\Annotation\ContextDefinitionTest
- 11.x core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionTest
- 10 core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\ContextDefinitionTest
- 10 core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\Annotation\ContextDefinitionTest
- 10 core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionTest
- 9 core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\ContextDefinitionTest
- 9 core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\Annotation\ContextDefinitionTest
- 9 core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionTest
@coversDefaultClass \Drupal\Core\Plugin\Context\ContextDefinition
@group Plugin
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\AssertHelperTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpunitCompatibilityTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Plugin\ContextDefinitionTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ContextDefinitionTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ ContextDefinitionTest.php, line 14
Namespace
Drupal\KernelTests\Core\PluginView source
class ContextDefinitionTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'entity_test',
'user',
];
/**
* @covers ::isSatisfiedBy
*/
public function testIsSatisfiedBy() {
$this->installEntitySchema('user');
$value = EntityTest::create([]);
// Assert that the entity has at least one violation.
$this->assertNotEmpty($value->validate());
// Assert that these violations do not prevent it from satisfying the
// requirements of another object.
$requirement = new ContextDefinition('any');
$context = EntityContext::fromEntity($value);
$this->assertTrue($requirement->isSatisfiedBy($context));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.