summaryrefslogtreecommitdiffstats
path: root/core/modules/views/src/Tests/Entity/ViewNonTranslatableEntityTest.php
blob: ca7f9c0ce9c2b4e2a6d4db693d77d577d64fa948 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

/**
 * @file
 * Contains \Drupal\views\Tests\Entity\ViewNonTranslatableEntityTest.
 */

namespace Drupal\views\Tests\Entity;

use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language_test\Entity\NoLanguageEntityTest;
use Drupal\simpletest\WebTestBase;

/**
 * Tests the view creation of non-translatable entities.
 *
 * @group views
 */
class ViewNonTranslatableEntityTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array(
    'entity_test',
    'content_translation',
    'language_test',
    'views_ui',
  );

  /**
   * Tests displaying a view of non-translatable entities.
   */
  public function testViewNoTranslatableEntity() {
    // Add a new language.
    ConfigurableLanguage::createFromLangcode('sr')->save();

    // Create a non-translatable entity.
    $no_language_entity = NoLanguageEntityTest::create();
    $no_language_entity->save();

    // Visit the view page and assert it is displayed properly.
    $this->drupalGet('no-entity-translation-view');
    $this->assertResponse(200);
    $this->assertText('No Entity Translation View');
    $this->assertText($no_language_entity->uuid());
  }

}