public function CheckoutFlowTest::testCheckoutPaneSettings in Commerce Core 8.2
Tests changing pane settings.
File
- modules/
checkout/ tests/ src/ Functional/ CheckoutFlowTest.php, line 98
Class
- CheckoutFlowTest
- Tests the checkout flow UI.
Namespace
Drupal\Tests\commerce_checkout\FunctionalCode
public function testCheckoutPaneSettings() {
$this
->createEntity('commerce_checkout_flow', [
'label' => 'Test checkout flow',
'id' => 'test_checkout_flow',
'plugin' => 'multistep_default',
]);
$this
->drupalGet('admin/commerce/config/checkout-flows/manage/test_checkout_flow');
$this
->assertSession()
->pageTextContains('Require double entry of email: No');
$this
->click('#edit-configuration-panes-contact-information-configuration-edit');
// Enable required double entry.
$edit = [
'configuration[panes][contact_information][configuration][double_entry]' => 1,
];
$this
->submitForm($edit, 'Update');
$this
->submitForm([], 'Save');
$this
->assertSession()
->pageTextContains(t('Saved the @name checkout flow.', [
'@name' => 'Test checkout flow',
]));
// Go back to the edit page, and check that the text has changed.
$this
->drupalGet('admin/commerce/config/checkout-flows/manage/test_checkout_flow');
$this
->assertSession()
->pageTextContains('Require double entry of email: Yes');
// Double check by using the api to see if the changes are saved.
$checkout_flow = CheckoutFlow::load('test_checkout_flow');
$this
->assertEquals(1, $checkout_flow
->get('configuration')['panes']['contact_information']['double_entry']);
}