class LayoutBuilderElementTest
Tests the deprecation notices of the layout builder element.
@coversDefaultClass \Drupal\layout_builder\Element\LayoutBuilder
@group layout_builder
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\layout_builder\Kernel\LayoutBuilderElementTest implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of LayoutBuilderElementTest
File
-
core/
modules/ layout_builder/ tests/ src/ Kernel/ LayoutBuilderElementTest.php, line 18
Namespace
Drupal\Tests\layout_builder\KernelView source
class LayoutBuilderElementTest extends KernelTestBase {
/**
* @group legacy
*/
public function testConstructorTempStoreDeprecation() {
$this->expectDeprecation('The event_dispatcher service should be passed to LayoutBuilder::__construct() instead of the layout_builder.tempstore_repository service since 9.1.0. This will be required in Drupal 10.0.0. See https://www.drupal.org/node/3152690');
$layout_temp_storage = $this->prophesize(LayoutTempstoreRepositoryInterface::class);
$element = new LayoutBuilder([], 'element_id', [], $layout_temp_storage->reveal());
$this->assertNotNull($element);
}
/**
* @group legacy
*/
public function testConstructorMessengerDeprecation() {
$this->expectDeprecation('Calling LayoutBuilder::__construct() with the $messenger argument is deprecated in drupal:9.1.0 and will be removed in drupal:10.0.0. See https://www.drupal.org/node/3152690');
$event_dispatcher = $this->prophesize(EventDispatcherInterface::class);
$messenger = $this->prophesize(MessengerInterface::class);
$element = new LayoutBuilder([], 'element_id', [], $event_dispatcher->reveal(), $messenger->reveal());
$this->assertNotNull($element);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.