TourTipDeprecatedConfigModuleInstallTest.php in Drupal 9
File
core/modules/tour/tests/src/Functional/Update/TourTipDeprecatedConfigModuleInstallTest.php
View source
<?php
namespace Drupal\Tests\tour\Functional\Update;
use Drupal\Tests\BrowserTestBase;
class TourTipDeprecatedConfigModuleInstallTest extends BrowserTestBase {
protected static $modules = [
'tour',
];
protected $defaultTheme = 'stark';
public function testModuleInstall() {
$this
->expectDeprecation("The tour.tip 'attributes' config schema property is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Instead of 'data-class' and 'data-id' attributes, use 'selector' to specify the element a tip attaches to. See https://www.drupal.org/node/3204093");
$this
->expectDeprecation("The tour.tip 'location' config schema property is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Instead use 'position'. The value must be a valid placement accepted by PopperJS. See https://www.drupal.org/node/3204093");
$this->container
->get('module_installer')
->install([
'tour_test',
'tour_legacy_test',
]);
$updated_legacy_tour_config = $this->container
->get('config.factory')
->get('tour.tour.tour-test-legacy');
$updated_tips = $updated_legacy_tour_config
->get('tips');
$this
->assertSame('#tour-test-1', $updated_tips['tour-test-legacy-1']['selector']);
$this
->assertArrayNotHasKey('attributes', $updated_tips['tour-test-legacy-1']);
$this
->assertSame('.tour-test-5', $updated_tips['tour-test-legacy-6']['selector']);
$this
->assertArrayNotHasKey('attributes', $updated_tips['tour-test-legacy-6']);
$this
->assertSame('.tour-test-7', $updated_tips['tour-test-legacy-7']['selector']);
$this
->assertSame([
'foo' => 'bar',
], $updated_tips['tour-test-legacy-7']['attributes']);
$updated_legacy_location_tour_config = $this->container
->get('config.factory')
->get('tour.tour.tour-test-legacy-location');
$updated_location_tips = $updated_legacy_location_tour_config
->get('tips');
$this
->assertSame('top-start', $updated_location_tips['location-test-top']['position']);
$this
->assertArrayNotHasKey('location', $updated_location_tips['location-test-top']);
$this
->assertEquals('bottom-start', $updated_location_tips['location-test-bottom']['position']);
$this
->assertArrayNotHasKey('location', $updated_location_tips['location-test-bottom']);
$this
->assertEquals('right-start', $updated_location_tips['location-test-right']['position']);
$this
->assertArrayNotHasKey('location', $updated_location_tips['location-test-right']);
$this
->assertEquals('left-start', $updated_location_tips['location-test-left']['position']);
$this
->assertArrayNotHasKey('location', $updated_location_tips['location-test-left']);
}
}