public function DrupalTest::testKeyValue in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/DrupalTest.php \Drupal\Tests\Core\DrupalTest::testKeyValue()
- 9 core/tests/Drupal/Tests/Core/DrupalTest.php \Drupal\Tests\Core\DrupalTest::testKeyValue()
Tests the keyValue() method.
@covers ::keyValue
File
- core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php, line 211
Class
- DrupalTest
- Tests the Drupal class.
Namespace
Drupal\Tests\CoreCode
public function testKeyValue() {
$keyvalue = $this
->getMockBuilder('Drupal\\Core\\KeyValueStore\\KeyValueFactory')
->disableOriginalConstructor()
->getMock();
$keyvalue
->expects($this
->once())
->method('get')
->with('test_collection')
->will($this
->returnValue(TRUE));
$this
->setMockContainerService('keyvalue', $keyvalue);
$this
->assertNotNull(\Drupal::keyValue('test_collection'));
}