You are here

public function LinkCheckerOverviewTest::testOverviewWorks in Link checker 8

Same name in this branch
  1. 8 tests/src/Functional/LinkCheckerOverviewTest.php \Drupal\Tests\linkchecker\Functional\LinkCheckerOverviewTest::testOverviewWorks()
  2. 8 tests/src/FunctionalJavascript/LinkCheckerOverviewTest.php \Drupal\Tests\linkchecker\FunctionalJavascript\LinkCheckerOverviewTest::testOverviewWorks()

Test that we can go to the overview and see our URLs there.

Also tests that our states functionality works and does not trigger any PHP notices.

File

tests/src/Functional/LinkCheckerOverviewTest.php, line 51

Class

LinkCheckerOverviewTest
Test Link checker overview view.

Namespace

Drupal\Tests\linkchecker\Functional

Code

public function testOverviewWorks() {

  // Remove the result exposed filter.

  /** @var \Drupal\Core\Config\ImmutableConfig $view_config */
  $view_config = $this->container
    ->get('config.factory')
    ->getEditable('views.view.broken_links_report');

  // Now visit the view of broken links.
  $route = 'view.broken_links_report.page_1';
  $this
    ->drupalGet(Url::fromRoute($route)
    ->toString());
  self::assertEquals(200, $this
    ->getSession()
    ->getStatusCode());
  $data = $view_config
    ->getRawData();
  foreach ([
    'code',
    'code_1',
  ] as $field) {
    unset($data["display"]["default"]["display_options"]["filters"][$field]);
  }
  $view_config
    ->setData($data);
  $view_config
    ->save();
  $this
    ->drupalGet(Url::fromRoute($route)
    ->toString());
  self::assertEquals(200, $this
    ->getSession()
    ->getStatusCode());
}