public function EntityTraitTest::testDuplicateTraits in Commerce Core 8.2
Tests the trait functionality on the duplicate form.
File
- tests/
src/ Functional/ EntityTraitTest.php, line 87
Class
- EntityTraitTest
- Tests the entity trait functionality.
Namespace
Drupal\Tests\commerce\FunctionalCode
public function testDuplicateTraits() {
$this
->drupalGet('admin/commerce/config/store-types/online/edit');
$edit = [
'traits[first]' => 'first',
'traits[second]' => FALSE,
];
$this
->submitForm($edit, 'Save');
$this
->drupalGet('admin/commerce/config/store-types/online/duplicate');
$this
->assertSession()
->checkboxChecked('traits[first]');
$this
->assertSession()
->checkboxNotChecked('traits[second]');
$edit = [
'label' => 'Online2',
'id' => 'online2',
'traits[first]' => FALSE,
'traits[second]' => FALSE,
];
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains('Saved the Online2 store type.');
$store_type = StoreType::load('online2');
$this
->assertEquals([], $store_type
->getTraits());
// The field was removed.
$this
->drupalGet('admin/commerce/config/store-types/online2/edit/fields');
$this
->assertSession()
->pageTextNotContains('phone');
}