function ViewNonTranslatableEntityTest::testViewNoTranslatableEntity
Tests displaying a view of non-translatable entities.
File
- 
              core/
modules/ views/ tests/ src/ Functional/ Entity/ ViewNonTranslatableEntityTest.php, line 36  
Class
- ViewNonTranslatableEntityTest
 - Tests the view creation of non-translatable entities.
 
Namespace
Drupal\Tests\views\Functional\EntityCode
public function testViewNoTranslatableEntity() : void {
  // 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->assertSession()
    ->statusCodeEquals(200);
  $this->assertSession()
    ->pageTextContains('No Entity Translation View');
  $this->assertSession()
    ->pageTextContains($no_language_entity->uuid());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.