You are here

public function ShipmentTest::testEmptyValidation in Commerce Shipping 8.2

@covers ::preSave

File

tests/src/Kernel/Entity/ShipmentTest.php, line 358

Class

ShipmentTest
Tests the Shipment entity.

Namespace

Drupal\Tests\commerce_shipping\Kernel\Entity

Code

public function testEmptyValidation() {
  $shipment = Shipment::create([
    'type' => 'default',
    'title' => 'Shipment',
  ]);
  $this
    ->expectException(EntityStorageException::class);
  $this
    ->expectExceptionMessage('Required shipment field "order_id" is empty.');
  $shipment
    ->save();
}