You are here

protected function DrushTestBase::assertDrushMigrateStatusOutputHasAllLines in Media Migration 8

Asserts that the expected rows are present in the output of migrate:status.

Parameters

string[] $expected_lines: The expected lines of the migrate:status command's response.

2 calls to DrushTestBase::assertDrushMigrateStatusOutputHasAllLines()
DrushWithCoreMigrationsFromFileTest::testMigrationWithDrush in tests/src/Functional/DrushWithCoreMigrationsFromFileTest.php
Test migrations provided by core Migrate API with Drush and Migrate Tools.
DrushWithCoreMigrationsFromMediaTest::testMigrationWithDrush in tests/src/Functional/DrushWithCoreMigrationsFromMediaTest.php
Test media migrations with Drush and Migrate Tools.

File

tests/src/Functional/DrushTestBase.php, line 175

Class

DrushTestBase
Base class for testing media migrations executed with Drush.

Namespace

Drupal\Tests\media_migration\Functional

Code

protected function assertDrushMigrateStatusOutputHasAllLines(array $expected_lines) {
  $drush_output_array = explode("\n", $this
    ->getSimplifiedOutput());
  $filtered_output = array_reduce($drush_output_array, function (array $carry, $output_line) {
    if (!preg_match('/^[-\\s]+$/', $output_line)) {
      $carry[] = $output_line;
    }
    return $carry;
  }, []);
  $missing_from_output = array_diff($filtered_output, $expected_lines);
  $extra_output = array_diff($expected_lines, $filtered_output);
  $this
    ->assertEmpty($extra_output);
  $this
    ->assertEquals([
    'Group Migration ID',
  ], $missing_from_output);
}