public function OrderItemTypeTest::testAdd in Commerce Core 8.2
Tests adding an order item type.
File
- modules/
order/ tests/ src/ Functional/ OrderItemTypeTest.php, line 28
Class
- OrderItemTypeTest
- Tests the order item type UI.
Namespace
Drupal\Tests\commerce_order\FunctionalCode
public function testAdd() {
$this
->drupalGet('admin/commerce/config/order-item-types/add');
$edit = [
'id' => 'foo',
'label' => 'Foo',
'purchasableEntityType' => 'commerce_product_variation',
'orderType' => 'default',
];
$this
->submitForm($edit, t('Save'));
$this
->assertSession()
->pageTextContains('Saved the Foo order item type.');
$order_item_type = OrderItemType::load($edit['id']);
$this
->assertNotEmpty($order_item_type);
$this
->assertEquals($edit['label'], $order_item_type
->label());
$this
->assertEquals($edit['purchasableEntityType'], $order_item_type
->getPurchasableEntityTypeId());
$this
->assertEquals($edit['orderType'], $order_item_type
->getOrderTypeId());
}