You are here

public function MigrationStatusPageTest::test in Lightning Workflow 8.3

Same name and namespace in other branches
  1. 8.2 modules/lightning_scheduler/tests/src/Functional/MigrationStatusPageTest.php \Drupal\Tests\lightning_scheduler\Functional\MigrationStatusPageTest::test()

Runs a basic test of migrating old Lightning Scheduler data.

This doesn't really test that data integrity is preserved, so subclasses should override this method and call it before asserting other things.

Overrides MigrationTestBase::test

File

modules/lightning_scheduler/tests/src/Functional/MigrationStatusPageTest.php, line 11

Class

MigrationStatusPageTest
@group lightning_workflow @group lightning_scheduler

Namespace

Drupal\Tests\lightning_scheduler\Functional

Code

public function test() {
  parent::test();
  $assert = $this
    ->assertSession();
  $text = 'Some content has not yet been migrated into the new base fields installed by Lightning Scheduler.';

  // parent::test() navigates to the migration UI, so we'll want to be sure
  // that the status page is linking to that.
  $url = parse_url($this
    ->getSession()
    ->getCurrentUrl(), PHP_URL_PATH);
  $this
    ->assertNotEmpty($url);
  $this
    ->drupalGet('/admin/reports/status');
  $assert
    ->pageTextContains($text);
  $assert
    ->linkByHrefExists($url);
  $this->container
    ->get('lightning_scheduler.migrator')
    ->setMigrations([]);
  $this
    ->getSession()
    ->reload();
  $assert
    ->pageTextNotContains($text);
}