You are here

public function CurrencyLocaleImportFormTest::testBuildFormWithImportableCurrencyLocales in Currency 8.3

Same name in this branch
  1. 8.3 tests/src/Unit/Controller/CurrencyLocaleImportFormTest.php \Drupal\Tests\currency\Unit\Controller\CurrencyLocaleImportFormTest::testBuildFormWithImportableCurrencyLocales()
  2. 8.3 tests/src/Unit/Form/CurrencyLocaleImportFormTest.php \Drupal\Tests\currency\Unit\Form\CurrencyLocaleImportFormTest::testBuildFormWithImportableCurrencyLocales()

@covers ::buildForm

File

tests/src/Unit/Controller/CurrencyLocaleImportFormTest.php, line 122

Class

CurrencyLocaleImportFormTest
@coversDefaultClass \Drupal\currency\Form\CurrencyLocaleImportForm

Namespace

Drupal\Tests\currency\Unit\Controller

Code

public function testBuildFormWithImportableCurrencyLocales() {
  $currency_locale_a = $this
    ->createMock(CurrencyInterface::class);
  $currency_locale_b = $this
    ->createMock(CurrencyInterface::class);
  $this->configImporter
    ->expects($this
    ->once())
    ->method('getImportableCurrencyLocales')
    ->willReturn([
    $currency_locale_a,
    $currency_locale_b,
  ]);
  $form_state = $this
    ->createMock(FormStateInterface::class);
  $form = $this->sut
    ->buildForm([], $form_state);

  // There should a currency selector and a group of actions.
  $this
    ->assertArrayHasKey('locale', $form);
  $this
    ->assertArrayHasKey('actions', $form);
  $this
    ->assertArrayHasKey('import', $form['actions']);
  $this
    ->assertArrayHasKey('import_edit', $form['actions']);
}