You are here

public function AmountFormatterManagerTest::setUp in Currency 8.3

Overrides UnitTestCase::setUp

File

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

Class

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

Namespace

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

Code

public function setUp() : void {
  $this->discovery = $this
    ->createMock(DiscoveryInterface::class);
  $this->factory = $this
    ->getMockBuilder(DefaultFactory::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->moduleHandler = $this
    ->createMock(ModuleHandlerInterface::class);
  $this->cache = $this
    ->createMock(CacheBackendInterface::class);
  $this->configFactory = $this
    ->createMock(ConfigFactoryInterface::class);
  $namespaces = new ArrayObject();
  $this->sut = new AmountFormatterManager($namespaces, $this->cache, $this->moduleHandler, $this->configFactory);
  $discovery_property = new \ReflectionProperty($this->sut, 'discovery');
  $discovery_property
    ->setAccessible(TRUE);
  $discovery_property
    ->setValue($this->sut, $this->discovery);
  $factory_property = new \ReflectionProperty($this->sut, 'factory');
  $factory_property
    ->setAccessible(TRUE);
  $factory_property
    ->setValue($this->sut, $this->factory);
}