Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
There are some common assertions like:
/*
* Confirm that the initial add to cart submit works.
*/
$this->cart = Order::load($this->cart->id());
$order_items = $this->cart->getItems();
$this->assertOrderItemInOrder($this->variation, $order_items[0]);
This assertion has been used in multiple places. This can be moved inside a base assertion method inside AjaxAddCartTestBase
.
Proposed resolution
Create a new assertion method that would check whether an item is added to cart. Made code changes in other tests if necessary.
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comments
Comment #2
subhojit777I think we are okay with what we have. There is no need to create a separate assetion method.