function ContextMapperTest::testGetContextValuesEntityContext

Same name 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 \Drupal\ctools\ContextMapper

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