You are here

public function LingotekAccountTest::testHandshakePage in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  2. 3.0.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  3. 3.1.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  4. 3.2.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  5. 3.3.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  6. 3.4.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  7. 3.5.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  8. 3.6.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  9. 3.7.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()
  10. 3.8.x tests/src/Functional/LingotekAccountTest.php \Drupal\Tests\lingotek\Functional\LingotekAccountTest::testHandshakePage()

File

tests/src/Functional/LingotekAccountTest.php, line 74

Class

LingotekAccountTest
Tests the Lingotek dashboard.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testHandshakePage() {
  \Drupal::state()
    ->set('must_remain_disconnected', TRUE);
  $assert_session = $this
    ->assertSession();

  // We avoid the redirect so we can see where the user will land for some
  // seconds.
  \Drupal::state()
    ->set('authorize_no_redirect', TRUE);

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);

  // Try to navigate to the Dashboard page, and assert we are redirected.
  $this
    ->drupalGet('admin/lingotek/setup/account');

  // Fake the connection to an account in Lingotek.
  $this
    ->clickLink('Connect Lingotek Account');

  // Our fake backend generates a token, returns to the site and waits for the
  // redirect.
  $assert_session
    ->addressEquals('admin/lingotek/setup/account/handshake#access_token=test_token');
}