You are here

public function ShipmentAdminTest::testShipmentAddPage in Commerce Shipping 8.2

Tests the Shipment add page.

File

tests/src/FunctionalJavascript/ShipmentAdminTest.php, line 283

Class

ShipmentAdminTest
Tests the shipment admin UI.

Namespace

Drupal\Tests\commerce_shipping\FunctionalJavascript

Code

public function testShipmentAddPage() {
  $this
    ->drupalGet($this->shipmentUri);
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->clickLink('Add shipment');
  $this
    ->assertSession()
    ->addressEquals($this->shipmentUri . '/add/default');
  $shipment_type = $this
    ->createEntity('commerce_shipment_type', [
    'id' => 'foo',
    'label' => 'FOO',
  ]);
  $shipment_type
    ->save();
  $order_type = OrderType::load('default');
  $order_type
    ->setThirdPartySetting('commerce_shipping', 'shipment_type', 'foo');
  $order_type
    ->save();
  $this
    ->drupalGet($this->shipmentUri);
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->clickLink('Add shipment');
  $this
    ->assertSession()
    ->addressEquals($this->shipmentUri . '/add/foo');
}