public function StoreTypeTest::testDuplicate in Commerce Core 8.2
Tests duplicating a store type.
File
- modules/
store/ tests/ src/ Functional/ StoreTypeTest.php, line 62
Class
- StoreTypeTest
- Tests the store type UI.
Namespace
Drupal\Tests\commerce_store\FunctionalCode
public function testDuplicate() {
$this
->drupalGet('admin/commerce/config/store-types/online/duplicate');
$this
->assertSession()
->fieldValueEquals('label', 'Online');
$edit = [
'label' => 'Online2',
'id' => 'online2',
];
$this
->submitForm($edit, t('Save'));
$this
->assertSession()
->pageTextContains('Saved the Online2 store type.');
// Confirm that the original store type is unchanged.
$store_type = StoreType::load('online');
$this
->assertNotEmpty($store_type);
$this
->assertEquals('Online', $store_type
->label());
// Confirm that the new store type has the expected data.
$store_type = StoreType::load('online2');
$this
->assertNotEmpty($store_type);
$this
->assertEquals('Online2', $store_type
->label());
}