function LayoutSectionStorageParamConverterTest::testConvertInvalidConverter

Same name in other branches
  1. 10 core/modules/layout_builder/tests/src/Unit/LayoutSectionStorageParamConverterTest.php \Drupal\Tests\layout_builder\Unit\LayoutSectionStorageParamConverterTest::testConvertInvalidConverter()
  2. 11.x core/modules/layout_builder/tests/src/Unit/LayoutSectionStorageParamConverterTest.php \Drupal\Tests\layout_builder\Unit\LayoutSectionStorageParamConverterTest::testConvertInvalidConverter()

@covers ::convert

File

core/modules/layout_builder/tests/src/Unit/LayoutSectionStorageParamConverterTest.php, line 62

Class

LayoutSectionStorageParamConverterTest
@coversDefaultClass \Drupal\layout_builder\Routing\LayoutSectionStorageParamConverter

Namespace

Drupal\Tests\layout_builder\Unit

Code

public function testConvertInvalidConverter() {
    $section_storage_manager = $this->prophesize(SectionStorageManagerInterface::class);
    $converter = new LayoutSectionStorageParamConverter($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->load()
        ->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.