public function OrderItemTypeTest::testDuplicate in Commerce Core 8.2
Tests duplicating an order item type.
File
- modules/
order/ tests/ src/ Functional/ OrderItemTypeTest.php, line 64
Class
- OrderItemTypeTest
- Tests the order item type UI.
Namespace
Drupal\Tests\commerce_order\FunctionalCode
public function testDuplicate() {
$this
->drupalGet('admin/commerce/config/order-item-types/default/duplicate');
$this
->assertSession()
->fieldValueEquals('label', 'Default');
$edit = [
'label' => 'Default2',
'id' => 'default2',
];
$this
->submitForm($edit, t('Save'));
$this
->assertSession()
->pageTextContains('Saved the Default2 order item type.');
// Confirm that the original order item type is unchanged.
$order_item_type = OrderItemType::load('default');
$this
->assertNotEmpty($order_item_type);
$this
->assertEquals('Default', $order_item_type
->label());
// Confirm that the new order item type has the expected data.
$order_item_type = OrderItemType::load('default2');
$this
->assertNotEmpty($order_item_type);
$this
->assertEquals('Default2', $order_item_type
->label());
}