You are here

public function ContextTest::testDefaultValue in Drupal 9

Same name in this branch
  1. 9 core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php \Drupal\Tests\Core\Plugin\Context\ContextTest::testDefaultValue()
  2. 9 core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php \Drupal\Tests\Component\Plugin\Context\ContextTest::testDefaultValue()
Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php \Drupal\Tests\Component\Plugin\Context\ContextTest::testDefaultValue()
  2. 10 core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php \Drupal\Tests\Component\Plugin\Context\ContextTest::testDefaultValue()

@covers ::getContextValue

File

core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php, line 86

Class

ContextTest
@coversDefaultClass \Drupal\Component\Plugin\Context\Context @group Plugin

Namespace

Drupal\Tests\Component\Plugin\Context

Code

public function testDefaultValue() {
  $mock_definition = $this
    ->getMockBuilder('Drupal\\Component\\Plugin\\Context\\ContextDefinitionInterface')
    ->setMethods([
    'getDefaultValue',
  ])
    ->getMockForAbstractClass();
  $mock_definition
    ->expects($this
    ->once())
    ->method('getDefaultValue')
    ->willReturn('test');
  $context = new Context($mock_definition);
  $this
    ->assertEquals('test', $context
    ->getContextValue());
}