MakeLayoutUntranslatableUpdatePathTestBase.php in Drupal 8
File
core/modules/layout_builder/tests/src/Functional/Update/Translatability/MakeLayoutUntranslatableUpdatePathTestBase.php
View source
<?php
namespace Drupal\Tests\layout_builder\Functional\Update\Translatability;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage;
abstract class MakeLayoutUntranslatableUpdatePathTestBase extends UpdatePathTestBase {
protected $layoutBuilderTestCases;
protected $expectedBundleUpdates;
protected $expectedFieldStorageUpdate;
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz',
__DIR__ . '/../../../../fixtures/update/layout-builder.php',
__DIR__ . '/../../../../fixtures/update/layout-builder-field-schema.php',
__DIR__ . '/../../../../fixtures/update/layout-builder-translation.php',
];
}
public function testDisableTranslationOnLayouts() {
$this
->runUpdates();
foreach ($this->expectedBundleUpdates as $bundle => $field_update_expected) {
$this
->assertEquals($field_update_expected, !FieldConfig::loadByName('node', $bundle, OverridesSectionStorage::FIELD_NAME)
->isTranslatable(), $field_update_expected ? "Field on {$bundle} set to be non-translatable." : "Field on {$bundle} not set to non-translatable.");
}
$this
->assertEquals($this->expectedFieldStorageUpdate, !FieldStorageConfig::loadByName('node', OverridesSectionStorage::FIELD_NAME)
->isTranslatable());
}
}