You are here

protected function RounderTest::setUp in Commerce Core 8.2

Overrides UnitTestCase::setUp

File

modules/price/tests/src/Unit/RounderTest.php, line 30

Class

RounderTest
Tests the Rounder class.

Namespace

Drupal\Tests\commerce_price\Unit

Code

protected function setUp() : void {
  parent::setUp();
  $usd_currency = $this
    ->prophesize(CurrencyInterface::class);
  $usd_currency
    ->id()
    ->willReturn('USD');
  $usd_currency
    ->getFractionDigits()
    ->willReturn('2');
  $storage = $this
    ->prophesize(EntityStorageInterface::class);
  $storage
    ->load('USD')
    ->willReturn($usd_currency
    ->reveal());
  $storage
    ->load('EUR')
    ->willReturn(NULL);
  $entity_type_manager = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->getStorage('commerce_currency')
    ->willReturn($storage
    ->reveal());
  $this->rounder = new Rounder($entity_type_manager
    ->reveal());
}