function DrupalTest::testKeyValue
Tests the keyValue() method.
@covers ::keyValue
      
    
File
- 
              core/tests/ Drupal/ Tests/ Core/ DrupalTest.php, line 213 
Class
- DrupalTest
- Tests the Drupal class.
Namespace
Drupal\Tests\CoreCode
public function testKeyValue() : void {
  $keyvalue = $this->getMockBuilder('Drupal\\Core\\KeyValueStore\\KeyValueFactory')
    ->disableOriginalConstructor()
    ->getMock();
  $keyvalue->expects($this->once())
    ->method('get')
    ->with('test_collection')
    ->willReturn(TRUE);
  $this->setMockContainerService('keyvalue', $keyvalue);
  $this->assertNotNull(\Drupal::keyValue('test_collection'));
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
