LingotekAccountDisconnectFormTest.php in Lingotek Translation 3.2.x
Same filename and directory in other branches
- 8.2 tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 4.0.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.0.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.1.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.3.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.4.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.5.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.6.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.7.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
- 3.8.x tests/src/Functional/Form/LingotekAccountDisconnectFormTest.php
Namespace
Drupal\Tests\lingotek\Functional\FormFile
tests/src/Functional/Form/LingotekAccountDisconnectFormTest.phpView source
<?php
namespace Drupal\Tests\lingotek\Functional\Form;
use Drupal\Tests\lingotek\Functional\LingotekTestBase;
/**
* Tests the Lingotek account disconnection form.
*
* @group lingotek
*/
class LingotekAccountDisconnectFormTest extends LingotekTestBase {
/**
* Test that we can disconnect.
*/
public function testAccountDisconnect() {
// We try to disconnect from an already connected account.
$this
->drupalGet('admin/lingotek/settings');
$this
->drupalPostForm(NULL, [], t('Disconnect'), [], 'lingoteksettings-tab-account-form');
// We need to confirm disconnection.
$this
->drupalPostForm(NULL, [], t('Disconnect'));
// We have been redirected to the account connection form.
$this
->assertUrl('/admin/lingotek/setup/account');
// We don't have an account anymore.
$lingotek_config = \Drupal::config('lingotek.settings');
$this
->assertNull($lingotek_config
->get('account.access_token'));
$this
->assertNull($lingotek_config
->get('account.login_id'));
$this
->assertNull($lingotek_config
->get('account.callback_url'));
// We connect to Lingotek again and it should work. We should not need to
// set the defaults, as they are already set.
$this
->connectToLingotek();
// We have an account again.
$lingotek_config = \Drupal::config('lingotek.settings');
$this
->assertNotNull($lingotek_config
->get('account.access_token'));
$this
->assertNotNull($lingotek_config
->get('account.login_id'));
$this
->assertNotNull($lingotek_config
->get('account.callback_url'));
}
}
Classes
Name | Description |
---|---|
LingotekAccountDisconnectFormTest | Tests the Lingotek account disconnection form. |