You are here

public function AgreementMultilingualTest::testMultilingualAgreement in Agreement 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/AgreementMultilingualTest.php \Drupal\Tests\agreement\Functional\AgreementMultilingualTest::testMultilingualAgreement()

Asserts the text is changed to Spanish.

File

tests/src/Functional/AgreementMultilingualTest.php, line 95

Class

AgreementMultilingualTest
Tests translating agreement.

Namespace

Drupal\Tests\agreement\Functional

Code

public function testMultilingualAgreement() {
  $this
    ->drupalLogin($this->spanishSpeaker);

  // Sent to agreement page.
  $this
    ->assertStringEndsWith($this->agreement
    ->get('path'), $this
    ->getUrl(), 'URL is agreement page.');

  // Found agreement text in Spanish.
  $this
    ->assertSession()
    ->titleEquals('Nuestro acuerdo | Drupal');
  $this
    ->assertSession()
    ->pageTextContains('Nuestro acuerdo');
  $this
    ->assertSession()
    ->checkboxNotChecked('Estoy de acuerdo.');
  $this
    ->assertSession()
    ->buttonExists('Enviar');
  $this
    ->assertSession()
    ->pageTextContainsOnce('Este es el texto del acuerdo.');
  $this
    ->assertNotAgreed($this->agreement);
  $this
    ->assertAgreed($this->agreement);
}