public function MetatagAdminTest::testListPager in Metatag 8
Test that metatag list page pager works as expected.
File
- tests/
src/ Functional/ MetatagAdminTest.php, line 463
Class
- MetatagAdminTest
- Tests the Metatag administration.
Namespace
Drupal\Tests\metatag\FunctionalCode
public function testListPager() {
$this
->loginUser1();
$session = $this
->assertSession();
$this
->drupalGet('admin/config/search/metatag');
$session
->statusCodeEquals(200);
$session
->linkByHrefExists('/admin/config/search/metatag/global');
$session
->linkByHrefExists('/admin/config/search/metatag/front');
$session
->linkByHrefExists('/admin/config/search/metatag/403');
$session
->linkByHrefExists('/admin/config/search/metatag/404');
$session
->linkByHrefExists('/admin/config/search/metatag/node');
$session
->linkByHrefExists('/admin/config/search/metatag/taxonomy_term');
$session
->linkByHrefExists('/admin/config/search/metatag/user');
// Create 50 vocabularies and generate metatag defaults for all of them.
for ($i = 0; $i < 50; $i++) {
$vocabulary = $this
->createVocabulary();
MetatagDefaults::create([
'id' => 'taxonomy_term__' . $vocabulary
->id(),
'label' => 'Taxonomy term: ' . $vocabulary
->label(),
])
->save();
}
// Reload the page.
$this
->drupalGet('admin/config/search/metatag');
$session
->linkByHrefExists('/admin/config/search/metatag/global');
$session
->linkByHrefExists('/admin/config/search/metatag/front');
$session
->linkByHrefExists('/admin/config/search/metatag/403');
$session
->linkByHrefExists('/admin/config/search/metatag/404');
$session
->linkByHrefExists('/admin/config/search/metatag/node');
$session
->linkByHrefExists('/admin/config/search/metatag/taxonomy_term');
// User entity not visible because it has been pushed to the next page.
$session
->linkByHrefNotExists('/admin/config/search/metatag/user');
$this
->clickLink('Next');
// Go to next page and confirm that parents are loaded and user us present.
$session
->linkByHrefExists('/admin/config/search/metatag/global');
$session
->linkByHrefExists('/admin/config/search/metatag/taxonomy_term');
// Main links not visible in the 2nd page.
$session
->linkByHrefNotExists('/admin/config/search/metatag/front');
$session
->linkByHrefNotExists('/admin/config/search/metatag/403');
$session
->linkByHrefNotExists('/admin/config/search/metatag/404');
$session
->linkByHrefNotExists('/admin/config/search/metatag/node');
// User is present because was pushed to page 2.
$session
->linkByHrefExists('/admin/config/search/metatag/user');
}