You are here

public function DrupalTest::testKeyValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 199
Contains \Drupal\Tests\Core\DrupalTest.

Class

DrupalTest
Tests the Drupal class.

Namespace

Drupal\Tests\Core

Code

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'));
}