You are here

public function AmountFormattingFormTest::testProcessPluginOptions in Currency 8.3

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

@covers ::processPluginOptions

File

tests/src/Unit/Controller/AmountFormattingFormTest.php, line 152

Class

AmountFormattingFormTest
@coversDefaultClass \Drupal\currency\Form\AmountFormattingForm

Namespace

Drupal\Tests\currency\Unit\Controller

Code

public function testProcessPluginOptions() {
  $element = array();
  $definitions = array(
    'foo' => array(
      'description' => $this
        ->randomMachineName(),
    ),
    'bar' => array(
      'description' => $this
        ->randomMachineName(),
    ),
    // This must work without a description.
    'baz' => array(),
  );
  $this->currencyAmountFormatterManager
    ->expects($this
    ->once())
    ->method('getDefinitions')
    ->willReturn($definitions);
  $expected = array(
    'foo' => array(
      '#description' => $definitions['foo']['description'],
    ),
    'bar' => array(
      '#description' => $definitions['bar']['description'],
    ),
  );
  $this
    ->assertSame($expected, $this->controller
    ->processPluginOptions($element));
}