function LayoutTempstoreParamConverterTest::testConvertInvalidConverter

@covers ::convert

File

core/modules/layout_builder/tests/src/Unit/LayoutTempstoreParamConverterTest.php, line 70

Class

LayoutTempstoreParamConverterTest
@coversDefaultClass \Drupal\layout_builder\Routing\LayoutTempstoreParamConverter

Namespace

Drupal\Tests\layout_builder\Unit

Code

public function testConvertInvalidConverter() {
    $layout_tempstore_repository = $this->prophesize(LayoutTempstoreRepositoryInterface::class);
    $section_storage_manager = $this->prophesize(SectionStorageManagerInterface::class);
    $converter = new LayoutTempstoreParamConverter($layout_tempstore_repository->reveal(), $section_storage_manager->reveal());
    $value = 'some_value';
    $definition = [
        'layout_builder_tempstore' => TRUE,
    ];
    $name = 'the_parameter_name';
    $defaults = [
        'section_storage_type' => 'invalid',
    ];
    $section_storage_manager->hasDefinition('invalid')
        ->willReturn(FALSE);
    $section_storage_manager->loadFromRoute()
        ->shouldNotBeCalled();
    $section_storage_manager->load()
        ->shouldNotBeCalled();
    $layout_tempstore_repository->get()
        ->shouldNotBeCalled();
    $result = $converter->convert($value, $definition, $name, $defaults);
    $this->assertNull($result);
}

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