You are here

public function CurrencyImportFormTest::testBuildFormWithoutImportableCurrencies in Currency 8.3

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

@covers ::buildForm

File

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

Class

CurrencyImportFormTest
@coversDefaultClass \Drupal\currency\Form\CurrencyImportForm

Namespace

Drupal\Tests\currency\Unit\Form

Code

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

  // There should be one element and it must not be the currency selector or a
  // group of actions.
  $this
    ->assertCount(1, $form);
  $this
    ->assertArrayNotHasKey('actions', $form);
  $this
    ->assertArrayNotHasKey('currency_code', $form);
}