public function ProfileFieldCopyTest::testCheckoutWithoutShipping in Commerce Shipping 8.2
Tests checkout with non-shippable products.
File
- tests/
src/ FunctionalJavascript/ ProfileFieldCopyTest.php, line 415
Class
- ProfileFieldCopyTest
- Tests the "Shipping information" checkout pane.
Namespace
Drupal\Tests\commerce_shipping\FunctionalJavascriptCode
public function testCheckoutWithoutShipping() {
// Switch the order item to the non-purchasable product.
$order_items = $this->order
->getItems();
$order_item = reset($order_items);
$order_item
->set('purchased_entity', $this->secondProduct
->getDefaultVariation());
$order_item
->save();
// Confirm that shipping information is not displayed.
$this
->drupalGet(Url::fromRoute('commerce_checkout.form', [
'commerce_order' => $this->order
->id(),
]));
$this
->assertSession()
->pageTextNotContains('Shipping information');
$this
->assertSession()
->pageTextContains('Payment information');
$billing_prefix = 'payment_information[billing_information]';
$this
->assertSession()
->fieldNotExists($billing_prefix . '[copy_fields][enable]');
$this
->assertSession()
->fieldExists($billing_prefix . '[address][0][address][address_line1]');
}