public function LingotekSettingsConnectFormTest::testBuildForm in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 3.3.x tests/src/Unit/Form/LingotekSettingsConnectFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsConnectFormTest::testBuildForm()
- 3.4.x tests/src/Unit/Form/LingotekSettingsConnectFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsConnectFormTest::testBuildForm()
- 3.5.x tests/src/Unit/Form/LingotekSettingsConnectFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsConnectFormTest::testBuildForm()
- 3.6.x tests/src/Unit/Form/LingotekSettingsConnectFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsConnectFormTest::testBuildForm()
- 3.7.x tests/src/Unit/Form/LingotekSettingsConnectFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsConnectFormTest::testBuildForm()
- 3.8.x tests/src/Unit/Form/LingotekSettingsConnectFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsConnectFormTest::testBuildForm()
@covers ::buildForm
File
- tests/
src/ Unit/ Form/ LingotekSettingsConnectFormTest.php, line 95
Class
- LingotekSettingsConnectFormTest
- @coversDefaultClass \Drupal\lingotek\Form\LingotekSettingsConnectForm @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\Unit\FormCode
public function testBuildForm() {
$config = $this
->createMock(Config::class);
$config
->expects($this
->any())
->method('get')
->willReturnMap([
[
'login_id',
'test@example.com',
],
[
'access_token',
'ef4b4d69-5be2-4513-b4f1-7e0f6f9511a0',
],
[
'default_client_id',
'my-client-id',
],
[
'host',
'http://example.com',
],
]);
$this->configFactory
->expects($this
->once())
->method('get')
->with('lingotek.account')
->willReturn($config);
$this->urlGenerator
->expects($this
->once())
->method('generateFromRoute')
->with('lingotek.setup_account_handshake')
->willReturn('http://example.com/setup-account-handshake');
$build = [];
$form_state = $this
->createMock(FormStateInterface::class);
$build = $this->form
->buildForm($build, $form_state);
$this
->assertSame('http://example.com/?client_id=my-client-id&response_type=token&redirect_uri=http%3A%2F%2Fexample.com%2Fsetup-account-handshake', $build['account_types']['existing_account']['cta']['#url']
->getUri());
}