public function ShipmentTypeTest::testListShipmentType in Commerce Shipping 8.2
Tests the shipment type listing.
File
- tests/
src/ Functional/ ShipmentTypeTest.php, line 45
Class
- ShipmentTypeTest
- Tests the shipment type UI.
Namespace
Drupal\Tests\commerce_shipping\FunctionalCode
public function testListShipmentType() {
$title = strtolower($this
->randomMachineName(8));
$table_selector = '//table/tbody/tr';
// The shipment shows one default shipment type.
$this
->drupalGet('admin/commerce/config/shipment-types');
$shipment_types = $this
->getSession()
->getDriver()
->find($table_selector);
$this
->assertEquals(1, count($shipment_types));
// Create a new commerce shipment type and see if the list has two shipment types.
$this
->createEntity('commerce_shipment_type', [
'id' => $title,
'label' => $title,
]);
$this
->drupalGet('admin/commerce/config/shipment-types');
$shipment_types = $this
->getSession()
->getDriver()
->find($table_selector);
$this
->assertEquals(2, count($shipment_types));
}