class LayoutTempstoreRouteEnhancerTest in Drupal 10
@coversDefaultClass \Drupal\layout_builder\Routing\LayoutTempstoreRouteEnhancer
@group layout_builder
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, PhpUnitWarnings
- class \Drupal\Tests\layout_builder\Unit\LayoutTempstoreRouteEnhancerTest
Expanded class hierarchy of LayoutTempstoreRouteEnhancerTest
File
- core/
modules/ layout_builder/ tests/ src/ Unit/ LayoutTempstoreRouteEnhancerTest.php, line 18
Namespace
Drupal\Tests\layout_builder\UnitView source
class LayoutTempstoreRouteEnhancerTest extends UnitTestCase {
/**
* @covers ::enhance
*/
public function testEnhance() {
$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);
}
}