You are here

protected function DefaultPackerTest::setUp in Commerce Shipping 8.2

Overrides UnitTestCase::setUp

File

tests/src/Unit/Packer/DefaultPackerTest.php, line 40

Class

DefaultPackerTest
@coversDefaultClass \Drupal\commerce_shipping\Packer\DefaultPacker @group commerce_shipping

Namespace

Drupal\Tests\commerce_shipping\Unit\Packer

Code

protected function setUp() : void {
  parent::setUp();
  $order_type = $this
    ->prophesize(OrderTypeInterface::class);
  $order_type
    ->getThirdPartySetting('commerce_shipping', 'shipment_type')
    ->willReturn('default');
  $order_type_storage = $this
    ->prophesize(EntityStorageInterface::class);
  $order_type_storage
    ->load('default')
    ->willReturn($order_type
    ->reveal());
  $entity_type_manager = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->getStorage('commerce_order_type')
    ->willReturn($order_type_storage
    ->reveal());
  $string_translation = $this
    ->prophesize(TranslationInterface::class);
  $string_translation
    ->translateString(Argument::type(TranslatableMarkup::class))
    ->willReturn('Shipment #1');
  $this->packer = new DefaultPacker($entity_type_manager
    ->reveal(), $string_translation
    ->reveal());
}