LinkCheckerOverviewTest.php in Link checker 8
File
tests/src/FunctionalJavascript/LinkCheckerOverviewTest.php
View source
<?php
namespace Drupal\Tests\linkchecker\FunctionalJavascript;
use Drupal\Core\Url;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class LinkCheckerOverviewTest extends WebDriverTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'filter',
'content_translation',
'linkchecker',
'node',
'path',
'views',
];
public function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer linkchecker',
'bypass node access',
'access broken links report',
]);
$this
->drupalLogin($this->adminUser);
}
public function testOverviewWorks() {
$view_config = $this->container
->get('config.factory')
->getEditable('views.view.broken_links_report');
$route = 'view.broken_links_report.page_1';
$this
->drupalGet(Url::fromRoute($route)
->toString());
$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());
}
}