You are here

protected function ConfigUpdateTest::assertReport in Configuration Update Manager 8

Asserts that the report page has the correct content.

Assumes you are already on the report page.

Parameters

string $title: Report title to check for.

string[] $missing: Array of items that should be listed as missing, name => label.

string[] $added: Array of items that should be listed as added, name => label.

string[] $changed: Array of items that should be listed as changed, name => label.

string[] $inactive: Array of items that should be listed as inactive, name => label.

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

1 call to ConfigUpdateTest::assertReport()
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 389

Class

ConfigUpdateTest
Verify the config revert report and its links.

Namespace

Drupal\Tests\config_update_ui\Functional

Code

protected function assertReport($title, array $missing, array $added, array $changed, array $inactive, array $skip = []) {
  $session = $this
    ->assertSession();
  $session
    ->pageTextContains('Configuration updates report for ' . $title);
  $session
    ->pageTextContains('Generate new report');
  if (!in_array('missing', $skip)) {
    $session
      ->pageTextContains('Missing configuration items');
    if (count($missing)) {
      foreach ($missing as $name => $label) {
        $session
          ->pageTextContains($name);
        $session
          ->pageTextContains($label);
      }
      $session
        ->pageTextNotContains('None: all provided configuration items are in your active configuration.');
    }
    else {
      $session
        ->pageTextContains('None: all provided configuration items are in your active configuration.');
    }
  }
  if (!in_array('inactive', $skip)) {
    $session
      ->pageTextContains('Inactive optional items');
    if (count($inactive)) {
      foreach ($inactive as $name => $label) {
        $session
          ->pageTextContains($name);
        $session
          ->pageTextContains($label);
      }
      $session
        ->pageTextNotContains('None: all optional configuration items are in your active configuration.');
    }
    else {
      $session
        ->pageTextContains('None: all optional configuration items are in your active configuration.');
    }
  }
  if (!in_array('added', $skip)) {
    $session
      ->pageTextContains('Added configuration items');
    if (count($added)) {
      foreach ($added as $name => $label) {
        $session
          ->pageTextContains($name);
        $session
          ->pageTextContains($label);
      }
      $session
        ->pageTextNotContains('None: all active configuration items of this type were provided by modules, themes, or install profile.');
    }
    else {
      $session
        ->pageTextContains('None: all active configuration items of this type were provided by modules, themes, or install profile.');
    }
  }
  if (!in_array('changed', $skip)) {
    $session
      ->pageTextContains('Changed configuration items');
    if (count($changed)) {
      foreach ($changed as $name => $label) {
        $session
          ->pageTextContains($name);
        $session
          ->pageTextContains($label);
      }
      $session
        ->pageTextNotContains('None: no active configuration items differ from their current provided versions.');
    }
    else {
      $session
        ->pageTextContains('None: no active configuration items differ from their current provided versions.');
    }
  }
}