You are here

public function AmountFormatterManagerTest::testSetDefaultPluginId in Currency 8.3

@covers ::setDefaultPluginId

File

tests/src/Unit/Plugin/Currency/AmountFormatter/AmountFormatterManagerTest.php, line 126

Class

AmountFormatterManagerTest
@coversDefaultClass \Drupal\currency\Plugin\Currency\AmountFormatter\AmountFormatterManager

Namespace

Drupal\Tests\currency\Unit\Plugin\Currency\AmountFormatter

Code

public function testSetDefaultPluginId() {
  $plugin_id = $this
    ->randomMachineName();
  $config = $this
    ->getMockBuilder(Config::class)
    ->disableOriginalConstructor()
    ->getMock();
  $config
    ->expects($this
    ->once())
    ->method('set')
    ->with('plugin_id', $plugin_id)
    ->will($this
    ->returnSelf());
  $config
    ->expects($this
    ->once())
    ->method('save');
  $this->configFactory
    ->expects($this
    ->once())
    ->method('get')
    ->with('currency.amount_formatting')
    ->willReturn($config);
  $this
    ->assertSame(spl_object_hash($this->sut), spl_object_hash($this->sut
    ->setDefaultPluginId($plugin_id)));
}