MultipleSelectsPostUpdateAddElementTypeToWidgets.php in Multiple Selects 8
File
tests/src/Functional/Update/MultipleSelectsPostUpdateAddElementTypeToWidgets.php
View source
<?php
namespace Drupal\Tests\multiple_selects\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class MultipleSelectsPostUpdateAddElementTypeToWidgets extends UpdatePathTestBase {
protected static $modules = [
'multiple_selects',
];
protected $entityFormDisplayStorage;
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/multiple-selects.php',
];
}
public function setUp() : void {
parent::setUp();
$this->entityFormDisplayStorage = $this->container
->get('entity_type.manager')
->getStorage('entity_form_display');
}
public function testPostUpdateAddConfigurationFormOptionToWidget() {
$entity_form_display = $this->entityFormDisplayStorage
->loadUnchanged('node.page.default');
$this
->assertArrayNotHasKey('element_type', $entity_form_display
->getComponent('uid')['settings']);
$this
->runUpdates();
$entity_form_display = $this->entityFormDisplayStorage
->loadUnchanged('node.page.default');
$this
->assertEquals('select', $entity_form_display
->getComponent('uid')['settings']['element_type']);
}
}