protected function ShippingMethodStorageTest::setUp in Commerce Shipping 8.2
Overrides ShippingKernelTestBase::setUp
File
- tests/
src/ Kernel/ ShippingMethodStorageTest.php, line 71
Class
- ShippingMethodStorageTest
- Tests the shipping method storage.
Namespace
Drupal\Tests\commerce_shipping\KernelCode
protected function setUp() : void {
parent::setUp();
$user = $this
->createUser([
'mail' => strtolower($this
->randomString()) . '@example.com',
]);
$this->user = $this
->reloadEntity($user);
$this->storage = $this->container
->get('entity_type.manager')
->getStorage('commerce_shipping_method');
$this->order = Order::create([
'type' => 'default',
'state' => 'draft',
'mail' => $this->user
->getEmail(),
'uid' => $this->user
->id(),
'store_id' => $this->store
->id(),
]);
$this->order
->save();
$this->shipment = Shipment::create([
'type' => 'default',
'title' => 'Shipment',
'items' => [
new ShipmentItem([
'order_item_id' => 10,
'title' => 'T-shirt (red, large)',
'quantity' => 1,
'weight' => new Weight('10', 'kg'),
'declared_value' => new Price('15.00', 'USD'),
]),
],
'order_id' => $this->order
->id(),
'amount' => new Price("57.88", "USD"),
]);
$this->shipment
->save();
}