You are here

public function CurrencyImportFormTest::testBuildFormWithImportableCurrencies in Currency 8.3

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

@covers ::buildForm

File

tests/src/Unit/Form/CurrencyImportFormTest.php, line 121

Class

CurrencyImportFormTest
@coversDefaultClass \Drupal\currency\Form\CurrencyImportForm

Namespace

Drupal\Tests\currency\Unit\Form

Code

public function testBuildFormWithImportableCurrencies() {
  $currency_a = $this
    ->createMock(CurrencyInterface::class);
  $currency_b = $this
    ->createMock(CurrencyInterface::class);
  $this->configImporter
    ->expects($this
    ->once())
    ->method('getImportableCurrencies')
    ->willReturn([
    $currency_a,
    $currency_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('currency_code', $form);
  $this
    ->assertArrayHasKey('actions', $form);
  $this
    ->assertArrayHasKey('import', $form['actions']);
  $this
    ->assertArrayHasKey('import_edit', $form['actions']);
}