MigrationTestBase.php in Lightning Workflow 8.3
File
modules/lightning_scheduler/tests/src/Functional/MigrationTestBase.php
View source
<?php
namespace Drupal\Tests\lightning_scheduler\Functional;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
abstract class MigrationTestBase extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [];
$fixture = $this
->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz';
if (file_exists($fixture)) {
$this->databaseDumpFiles[] = $fixture;
}
else {
$this->databaseDumpFiles[] = str_replace('8.8.0', '8.4.0', $fixture);
}
$this->databaseDumpFiles[] = __DIR__ . '/../../fixtures/BaseFieldMigrationTest.php.gz';
}
public function test() {
$this
->runUpdates();
$migrations = $this->container
->get('state')
->get('lightning_scheduler.migrations');
$this
->assertCount(2, $migrations);
$this
->assertContains('block_content', $migrations);
$this
->assertContains('node', $migrations);
$assert = $this
->assertSession();
$url = $assert
->elementExists('named', [
'link',
'migrate your existing content',
])
->getAttribute('href');
$this
->drupalLogin($this->rootUser);
$this
->drupalGet($url);
$assert
->statusCodeEquals(200);
$assert
->pageTextContains('Migrate scheduled transitions');
$assert
->elementExists('named', [
'link',
'switch to maintenance mode',
]);
}
protected function postMigration($entity_type_id) {
$this->container
->get('entity_field.manager')
->clearCachedFieldDefinitions();
$this
->assertTrue($this->container
->get('entity.definition_update_manager')
->needsUpdates());
return $this->container
->get('entity_type.manager')
->getStorage($entity_type_id);
}
}