public function CheckoutPaneTest::testCheckoutCouponsRemoved in Commerce Checkout Order Fields 8
Verifies the coupons field widget is always removed.
File
- tests/
src/ Kernel/ CheckoutPaneTest.php, line 152
Class
- CheckoutPaneTest
- Tests the checkout pane.
Namespace
Drupal\Tests\commerce_checkout_order_fields\KernelCode
public function testCheckoutCouponsRemoved() {
$this
->installModule('commerce_promotion');
$checkout_flow = CheckoutFlow::load('default');
/** @var \Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesInterface $plugin */
$plugin = $checkout_flow
->getPlugin();
$pane = $plugin
->getPane('order_fields:checkout');
$order = Order::create([
'type' => 'default',
'store_id' => $this->store
->id(),
'state' => 'draft',
'mail' => 'text@example.com',
'ip_address' => '127.0.0.1',
]);
$pane
->setOrder($order);
$form_state = new FormState();
$complete_form = [];
$form = $pane
->buildPaneForm([], $form_state, $complete_form);
$this
->assertFalse(isset($form['coupons']));
}