You are here

protected function ConfigUpdateTest::assertDrushReports in Configuration Update Manager 8

Asserts that the Drush reports have the correct content.

Parameters

string $type: Type of report to run (type, module, theme, etc.).

string $name: Name of that type to run (e.g., module machine name).

string[] $missing: Array of config items that should be listed as missing.

string[] $added: Array of config items that should be listed as added.

string[] $changed: Array of config items that should be listed as changed.

string[] $inactive: Array of config items that should be listed as inactive.

string[] $skip: Array of report sections to skip checking.

1 call to ConfigUpdateTest::assertDrushReports()
ConfigUpdateTest::testConfigReport in config_update_ui/tests/src/Functional/ConfigUpdateTest.php
Tests the config report and its linked pages.

File

config_update_ui/tests/src/Functional/ConfigUpdateTest.php, line 469

Class

ConfigUpdateTest
Verify the config revert report and its links.

Namespace

Drupal\Tests\config_update_ui\Functional

Code

protected function assertDrushReports($type, $name, array $missing, array $added, array $changed, array $inactive, array $skip = []) {
  if (!in_array('missing', $skip)) {
    $output = drush_config_update_ui_config_missing_report($type, $name);
    $this
      ->assertEquals(count($output), count($missing), 'Drush missing report has correct number of items');
    if (count($missing)) {
      foreach ($missing as $item) {
        $this
          ->assertTrue(in_array($item, $output), "Item {$item} is in the Drush missing report");
      }
    }
  }
  if (!in_array('added', $skip) && $type == 'type') {
    $output = drush_config_update_ui_config_added_report($name);
    $this
      ->assertEquals(count($output), count($added), 'Drush added report has correct number of items');
    if (count($added)) {
      foreach ($added as $item) {
        $this
          ->assertTrue(in_array($item, $output), "Item {$item} is in the Drush added report");
      }
    }
  }
  if (!in_array('changed', $skip)) {
    $output = drush_config_update_ui_config_different_report($type, $name);
    $this
      ->assertEquals(count($output), count($changed), 'Drush changed report has correct number of items');
    if (count($changed)) {
      foreach ($changed as $item) {
        $this
          ->assertTrue(in_array($item, $output), "Item {$item} is in the Drush changed report");
      }
    }
  }
  if (!in_array('inactive', $skip)) {
    $output = drush_config_update_ui_config_inactive_report($type, $name);
    $this
      ->assertEquals(count($output), count($inactive), 'Drush inactive report has correct number of items');
    if (count($inactive)) {
      foreach ($inactive as $item) {
        $this
          ->assertTrue(in_array($item, $output), "Item {$item} is in the Drush inactive report");
      }
    }
  }
}