public function EarlyOrderProcessorTest::testProcessWithoutProfile in Commerce Shipping 8.2
Test the edge case when the shipping profile has been deleted.
@covers ::process
File
- tests/
src/ Kernel/ EarlyOrderProcessorTest.php, line 189
Class
- EarlyOrderProcessorTest
- Tests the early order processor.
Namespace
Drupal\Tests\commerce_shipping\KernelCode
public function testProcessWithoutProfile() {
$this
->assertCount(1, $this->order
->get('shipments')
->referencedEntities());
// Add an item to trigger shouldRepack.
$order_item = OrderItem::create([
'type' => 'default',
'quantity' => 2,
'title' => $this->variations[1]
->getOrderItemTitle(),
'purchased_entity' => $this->variations[1],
'unit_price' => new Price('10', 'USD'),
]);
$order_item
->save();
$this->order
->addItem($order_item);
$this->shippingProfile
->delete();
$this->processor
->process($this->order);
// Confirm that the shipment has been deleted.
$this
->assertEmpty($this->order
->get('shipments')
->referencedEntities());
}