function LayoutTempstoreRouteEnhancerTest::testEnhance
Same name in other branches
- 9 core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRouteEnhancerTest.php \Drupal\Tests\layout_builder\Unit\LayoutTempstoreRouteEnhancerTest::testEnhance()
- 11.x core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRouteEnhancerTest.php \Drupal\Tests\layout_builder\Unit\LayoutTempstoreRouteEnhancerTest::testEnhance()
@covers ::enhance
File
-
core/
modules/ layout_builder/ tests/ src/ Unit/ LayoutTempstoreRouteEnhancerTest.php, line 25
Class
- LayoutTempstoreRouteEnhancerTest
- @coversDefaultClass \Drupal\layout_builder\Routing\LayoutTempstoreRouteEnhancer
Namespace
Drupal\Tests\layout_builder\UnitCode
public function testEnhance() : void {
$section_storage = $this->prophesize(SectionStorageInterface::class);
$layout_tempstore_repository = $this->prophesize(LayoutTempstoreRepositoryInterface::class);
$layout_tempstore_repository->get($section_storage->reveal())
->willReturn('the_return_value');
$options = [
'parameters' => [
'section_storage' => [
'layout_builder_tempstore' => TRUE,
],
],
];
$route = new Route('/test/{id}/{literal}/{null}', [], [], $options);
$defaults = [
'section_storage' => $section_storage->reveal(),
RouteObjectInterface::ROUTE_OBJECT => $route,
];
$expected = [
'section_storage' => 'the_return_value',
RouteObjectInterface::ROUTE_OBJECT => $route,
];
$enhancer = new LayoutTempstoreRouteEnhancer($layout_tempstore_repository->reveal());
$result = $enhancer->enhance($defaults, new Request());
$this->assertEquals($expected, $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.