function LayoutBuilderIsActiveCacheContextTest::testGetContextNonFieldableEntity

Tests get context non fieldable entity.

@legacy-covers ::getContext @legacy-covers ::getDisplay

File

core/modules/layout_builder/tests/src/Unit/LayoutBuilderIsActiveCacheContextTest.php, line 48

Class

LayoutBuilderIsActiveCacheContextTest
Tests Drupal\layout_builder\Cache\LayoutBuilderIsActiveCacheContext.

Namespace

Drupal\Tests\layout_builder\Unit

Code

public function testGetContextNonFieldableEntity() : void {
  $route_match = $this->prophesize(RouteMatchInterface::class);
  $route_match->getParameter('not_a_fieldable_entity')
    ->willReturn('something that is not a fieldable entity');
  $cache_context = new LayoutBuilderIsActiveCacheContext($route_match->reveal());
  $expected = '0';
  $actual = $cache_context->getContext('not_a_fieldable_entity');
  $this->assertSame($expected, $actual);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.