You are here

public function LingotekSettingsTabAccountFormTest::testBuildForm in Lingotek Translation 3.7.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Unit/Form/LingotekSettingsTabAccountFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsTabAccountFormTest::testBuildForm()
  2. 3.3.x tests/src/Unit/Form/LingotekSettingsTabAccountFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsTabAccountFormTest::testBuildForm()
  3. 3.4.x tests/src/Unit/Form/LingotekSettingsTabAccountFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsTabAccountFormTest::testBuildForm()
  4. 3.5.x tests/src/Unit/Form/LingotekSettingsTabAccountFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsTabAccountFormTest::testBuildForm()
  5. 3.6.x tests/src/Unit/Form/LingotekSettingsTabAccountFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsTabAccountFormTest::testBuildForm()
  6. 3.8.x tests/src/Unit/Form/LingotekSettingsTabAccountFormTest.php \Drupal\Tests\lingotek\Unit\Form\LingotekSettingsTabAccountFormTest::testBuildForm()

@covers ::buildForm

File

tests/src/Unit/Form/LingotekSettingsTabAccountFormTest.php, line 98

Class

LingotekSettingsTabAccountFormTest
@coversDefaultClass \Drupal\lingotek\Form\LingotekSettingsTabAccountForm @group lingotek @preserveGlobalState disabled

Namespace

Drupal\Tests\lingotek\Unit\Form

Code

public function testBuildForm() {
  $config = $this
    ->createMock(Config::class);
  $config
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap([
    [
      'account.login_id',
      'test@example.com',
    ],
    [
      'account.access_token',
      'ef4b4d69-5be2-4513-b4f1-7e0f6f9511a0',
    ],
  ]);
  $this->configFactory
    ->expects($this
    ->once())
    ->method('get')
    ->with('lingotek.settings')
    ->willReturn($config);
  $this->lingotekFilterManager
    ->expects($this
    ->once())
    ->method('getLocallyAvailableFilters')
    ->willReturn([
    'filter 1' => 'filter-uuid-1',
  ]);
  $build = [];
  $form_state = $this
    ->createMock(FormStateInterface::class);
  $build = $this->form
    ->buildForm($build, $form_state);
  $this
    ->assertSame('ef4b4d69-5be2-4513-b4f1-7e0f6f9511a0', $build['account']['account_table']['token_row'][1]['#markup']);
}