diff --git a/config/schema/linkchecker.schema.yml b/config/schema/linkchecker.schema.yml index 84b57a1..7b3ad78 100644 --- a/config/schema/linkchecker.schema.yml +++ b/config/schema/linkchecker.schema.yml @@ -103,3 +103,10 @@ field.field.*.*.*.third_party.linkchecker: extractor: type: string label: 'Extractor plugin machine name' + +views.field.linkcheckerlink_page_entity_label: + type: views.field.field + mapping: + link_to_entity: + type: integer + label: 'Link to entity.' diff --git a/tests/src/Functional/LinkCheckerOverviewTest.php b/tests/src/Functional/LinkCheckerOverviewTest.php new file mode 100644 index 0000000..cf3294c --- /dev/null +++ b/tests/src/Functional/LinkCheckerOverviewTest.php @@ -0,0 +1,69 @@ +adminUser = $this->drupalCreateUser([ + 'administer linkchecker', + 'bypass node access', + 'access broken links report', + ]); + $this->drupalLogin($this->adminUser); + } + + /** + * 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. + */ + 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()); + } + +} diff --git a/tests/src/FunctionalJavascript/LinkCheckerOverviewTest.php b/tests/src/FunctionalJavascript/LinkCheckerOverviewTest.php new file mode 100644 index 0000000..19c286d --- /dev/null +++ b/tests/src/FunctionalJavascript/LinkCheckerOverviewTest.php @@ -0,0 +1,79 @@ +adminUser = $this->drupalCreateUser([ + 'administer linkchecker', + 'bypass node access', + 'access broken links report', + ]); + $this->drupalLogin($this->adminUser); + } + + /** + * 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. + */ + 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()); + // Check that the states part does what it is supposed to do. + // Unset a couple of things that used to end up triggering an undefined + // index. + $page = $this->getSession()->getPage(); + $page->fillField('result', '2'); + self::assertTrue($page->find('css', '[data-drupal-selector="edit-code"]')->hasAttribute('disabled')); + $page->fillField('result', 'All'); + self::assertFalse($page->find('css', '[data-drupal-selector="edit-code"]')->hasAttribute('disabled')); + $page->fillField('code', '200'); + self::assertTrue($page->find('css', '[data-drupal-selector="edit-result"]')->hasAttribute('disabled')); + $page->fillField('code', ''); + self::assertFalse($page->find('css', '[data-drupal-selector="edit-result"]')->hasAttribute('disabled')); + $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()); + } + +}