public function CurrencyLocaleImportFormTest::testSubmitFormImport in Currency 8.3
Same name in this branch
- 8.3 tests/src/Unit/Controller/CurrencyLocaleImportFormTest.php \Drupal\Tests\currency\Unit\Controller\CurrencyLocaleImportFormTest::testSubmitFormImport()
- 8.3 tests/src/Unit/Form/CurrencyLocaleImportFormTest.php \Drupal\Tests\currency\Unit\Form\CurrencyLocaleImportFormTest::testSubmitFormImport()
@covers ::submitForm
File
- tests/
src/ Unit/ Form/ CurrencyLocaleImportFormTest.php, line 144
Class
- CurrencyLocaleImportFormTest
- @coversDefaultClass \Drupal\currency\Form\CurrencyLocaleImportForm
Namespace
Drupal\Tests\currency\Unit\FormCode
public function testSubmitFormImport() {
$locale = $this
->randomMachineName();
$currency_locale = $this
->createMock(CurrencyLocaleInterface::class);
$this->configImporter
->expects($this
->once())
->method('importCurrencyLocale')
->with($locale)
->willReturn($currency_locale);
$form = [
'actions' => [
'import' => [
'#name' => 'import',
],
'import_edit' => [
'#name' => 'import_edit',
],
],
];
$form_state = $this
->createMock(FormStateInterface::class);
$form_state
->expects($this
->atLeastOnce())
->method('getValues')
->willReturn([
'locale' => $locale,
]);
$form_state
->expects($this
->atLeastOnce())
->method('getTriggeringElement')
->willReturn($form['actions']['import']);
$form_state
->expects($this
->atLeastOnce())
->method('setRedirectUrl');
$this->sut
->submitForm($form, $form_state);
}