function ContextMapperTest::testGetContextValuesEntityContext

Same name and namespace in other branches
  1. 4.0.x tests/src/Unit/ContextMapperTest.php \Drupal\Tests\ctools\Unit\ContextMapperTest::testGetContextValuesEntityContext()

@covers ::getContextValues

File

tests/src/Unit/ContextMapperTest.php, line 93

Class

ContextMapperTest
@coversDefaultClass <a href="/api/ctools/src%21ContextMapper.php/class/ContextMapper/8.x-3.x" title="Maps context configurations to context objects." class="local">\Drupal\ctools\ContextMapper</a>

Namespace

Drupal\Tests\ctools\Unit

Code

public function testGetContextValuesEntityContext() {
    $input = [
        'foo' => [
            'label' => 'Foo',
            'description' => NULL,
            'type' => 'entity:node',
            'value' => 'the_node_uuid',
        ],
    ];
    $expected = new EntityLazyLoadContext(new EntityContextDefinition('entity:node', 'Foo'), $this->entityRepository
        ->reveal(), 'the_node_uuid');
    $actual = $this->staticContext
        ->getContextValues($input)['foo'];
    $this->assertEquals($expected, $actual);
}