You are here

public function ContentFullViewFiltersFieldsTest::testFilters in Translation Views 8

Tests the filtering.

File

tests/src/Functional/ContentFullViewFiltersFieldsTest.php, line 106

Class

ContentFullViewFiltersFieldsTest
Tests for fields, filters and sorting for content entity.

Namespace

Drupal\Tests\translation_views\Functional

Code

public function testFilters() {
  $this
    ->drupalGet('translation-views-all-filters-and-fields');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('Translation views all filters and fields');
  $this
    ->assertSession()
    ->pageTextNotContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextContains('005_fr_title_node2');
  $this
    ->drupalGet('translation-views-all-filters-and-fields', [
    'query' => [
      'content_translation_source' => '***LANGUAGE_site_default***',
      'translation_target_language' => '***LANGUAGE_site_default***',
      'translation_default' => 'All',
      'translation_status' => 'All',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextNotContains('005_fr_title_node2');
  $this
    ->drupalGet('translation-views-all-filters-and-fields', [
    'query' => [
      'content_translation_source' => 'de',
      'translation_target_language' => '***LANGUAGE_site_default***',
      'translation_default' => 'All',
      'translation_status' => 'All',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextContains('005_fr_title_node2');
  $this
    ->drupalGet('translation-views-all-filters-and-fields', [
    'query' => [
      'content_translation_source' => 'fr',
      'translation_target_language' => '***LANGUAGE_site_default***',
      'translation_default' => 'All',
      'translation_status' => 'All',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextNotContains('005_fr_title_node2');
  $this
    ->drupalGet('translation-views-all-filters-and-fields', [
    'query' => [
      'content_translation_source' => 'All',
      'translation_target_language' => 'de',
      'translation_default' => 'All',
      'translation_status' => 'All',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextContains('005_fr_title_node2');
  $this
    ->drupalGet('translation-views-all-filters-and-fields', [
    'query' => [
      'content_translation_source' => 'All',
      'translation_target_language' => 'fr',
      'translation_default' => 'All',
      'translation_status' => 'All',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextNotContains('005_fr_title_node2');
  $this
    ->drupalGet('translation-views-all-filters-and-fields', [
    'query' => [
      'content_translation_source' => 'All',
      'translation_target_language' => '***LANGUAGE_site_default***',
      'translation_default' => 'All',
      'translation_status' => '1',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextNotContains('005_fr_title_node2');
  $this
    ->drupalGet('translation-views-all-filters-and-fields', [
    'query' => [
      'content_translation_source' => 'All',
      'translation_target_language' => '***LANGUAGE_site_default***',
      'translation_default' => 'All',
      'translation_status' => '0',
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('001_en_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('002_fr_title_node1');
  $this
    ->assertSession()
    ->pageTextNotContains('003_de_title_node1');
  $this
    ->assertSession()
    ->pageTextContains('004_de_title_node2');
  $this
    ->assertSession()
    ->pageTextContains('005_fr_title_node2');
}