PostUpdateTest.php in Entity Legal 4.0.x
File
tests/src/Functional/PostUpdateTest.php
View source
<?php
namespace Drupal\Tests\entity_legal\Functional;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class PostUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.6.0.bare.testing.php.gz',
__DIR__ . '/../../fixtures/update/install_entity_legal.php',
__DIR__ . '/../../fixtures/update/legal_documents.php',
];
}
public function testPostUpdateTitlePattern() {
$factory = \Drupal::configFactory();
foreach ($factory
->listAll('entity_legal.document.') as $name) {
$settings = $factory
->get($name)
->get('settings');
$this
->assertArrayNotHasKey('title_pattern', $settings);
}
$this
->runUpdates();
foreach ($factory
->listAll('entity_legal.document.') as $name) {
$settings = $factory
->get($name)
->get('settings');
$this
->assertArrayHasKey('title_pattern', $settings);
$this
->assertSame('[entity_legal_document:published-version:label]', $settings['title_pattern']);
}
}
}