You are here

public function ContentTranslationJobsViewTest::testNodesFiltering in Translation Views 8

Tests that filters works as expected.

File

tests/src/Functional/ContentTranslationJobsViewTest.php, line 93

Class

ContentTranslationJobsViewTest
Tests for fields, filters and sorting (Content translation jobs view).

Namespace

Drupal\Tests\translation_views\Functional

Code

public function testNodesFiltering() {
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'translation_target_language' => '***LANGUAGE_site_default***',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('node1 de');
  $this
    ->assertSession()
    ->pageTextContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextNotContains('node2 en');
  $this
    ->assertSession()
    ->pageTextContains('node3 fr');
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'translation_target_language' => 'de',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('node1 de');
  $this
    ->assertSession()
    ->pageTextNotContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextContains('node2 en');
  $this
    ->assertSession()
    ->pageTextContains('node3 fr');
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'translation_target_language' => 'fr',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('node1 de');
  $this
    ->assertSession()
    ->pageTextNotContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextContains('node2 en');
  $this
    ->assertSession()
    ->pageTextNotContains('node3 fr');
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'translation_target_language' => 'de',
      'langcode' => 'en',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('node1 de');
  $this
    ->assertSession()
    ->pageTextNotContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextContains('node2 en');
  $this
    ->assertSession()
    ->pageTextNotContains('node3 fr');
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'translation_target_language' => 'fr',
      'langcode' => 'en',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('node1 de');
  $this
    ->assertSession()
    ->pageTextNotContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextContains('node2 en');
  $this
    ->assertSession()
    ->pageTextNotContains('node3 fr');
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'langcode' => 'fr',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('node1 de');
  $this
    ->assertSession()
    ->pageTextContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextNotContains('node2 en');
  $this
    ->assertSession()
    ->pageTextContains('node3 fr');
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'langcode' => 'de',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('node1 de');
  $this
    ->assertSession()
    ->pageTextNotContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextNotContains('node2 en');
  $this
    ->assertSession()
    ->pageTextNotContains('node3 fr');
  $this
    ->drupalGet('translate/content', [
    'query' => [
      'langcode' => 'en',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('node1 de');
  $this
    ->assertSession()
    ->pageTextNotContains('node1 fr');
  $this
    ->assertSession()
    ->pageTextNotContains('node2 en');
  $this
    ->assertSession()
    ->pageTextNotContains('node3 fr');
}