function GlossaryViewTest::testGlossaryLanguagePrefix

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php \Drupal\Tests\views\FunctionalJavascript\GlossaryViewTest::testGlossaryLanguagePrefix()
  2. 10 core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php \Drupal\Tests\views\FunctionalJavascript\GlossaryViewTest::testGlossaryLanguagePrefix()
  3. 11.x core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php \Drupal\Tests\views\FunctionalJavascript\GlossaryViewTest::testGlossaryLanguagePrefix()

Tests that the glossary also works on a language prefixed URL.

File

core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php, line 105

Class

GlossaryViewTest
Tests the basic AJAX functionality of the Glossary View.

Namespace

Drupal\Tests\views\FunctionalJavascript

Code

public function testGlossaryLanguagePrefix() {
    ConfigurableLanguage::createFromLangcode('nl')->save();
    $config = $this->config('language.negotiation');
    $config->set('url.prefixes', [
        'en' => 'en',
        'nl' => 'nl',
    ])
        ->save();
    \Drupal::service('kernel')->rebuildContainer();
    $url = Url::fromRoute('view.test_glossary.page_1');
    $this->drupalGet($url);
    $session = $this->getSession();
    $web_assert = $this->assertSession();
    $page = $session->getPage();
    $rows = $page->findAll('css', '.view-test-glossary tr');
    // We expect 2 rows plus the header row.
    $this->assertCount(3, $rows);
    // Click on the P link, this should show 4 rows plus the header row.
    $page->clickLink('P');
    $web_assert->assertWaitOnAjaxRequest();
    $rows = $page->findAll('css', '.view-test-glossary tr');
    $this->assertCount(5, $rows);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.