You are here

public function ViewModesUtf8EncodedTest::testUTF8EncodedViewModes in Acquia Content Hub 8

Configure content hub node form.

File

tests/src/Functional/ViewModesUtf8EncodedTest.php, line 66

Class

ViewModesUtf8EncodedTest
Test Acquia Content Hub node reference.

Namespace

Drupal\Tests\acquia_contenthub\Functional

Code

public function testUTF8EncodedViewModes() {

  // @codingStandardsIgnoreLine
  // Adding portuguese language.
  $this
    ->drupalGet('admin/config/regional/language/add');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $edit = [
    'predefined_langcode' => 'pt-pt',
  ];
  $this
    ->submitForm($edit, $this
    ->t('Add language'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->drupalGet('admin/config/regional/language');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->drupalGet('admin/structure/types/manage/article');
  $edit = [
    'language_configuration[langcode]' => 'pt-pt',
    'language_configuration[language_alterable]' => 1,
    'language_configuration[content_translation]' => 1,
  ];
  $this
    ->submitForm($edit, $this
    ->t('Save content type'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->drupalGet('node/add/article');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $title = 'Salas de isolamento e contactos de urgência. Escolas com orientações para planos de contingência';
  $body = 'A Direção-Geral dos Estabelecimentos de Ensino enviou recomendações a todas as escolas, que devem desenvolver os seus próprios planos de contingência nos próximos dias para o covid-19. Duas das nove pessoas infetadas em Portugal são professores.';
  $edit = [
    'title[0][value]' => $title,
    'body[0][value]' => $body,
  ];
  $this
    ->submitForm($edit, $this
    ->t('Save'));
  $this
    ->drupalGet("acquia-contenthub/display/node/1/teaser");
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains($title);
  $this
    ->assertSession()
    ->pageTextContains($body);
}