protected function AjaxAddCartViewsTestBase::assertNotVariationInOrder in Commerce Ajax Add to Cart 8
Asserts whether the variation is not present in order items.
Parameters
\Drupal\commerce_product\Entity\ProductVariationInterface $variation: The purchased product variation.
\Drupal\commerce_order\Entity\OrderItemInterface[] $order_items: The order items.
1 call to AjaxAddCartViewsTestBase::assertNotVariationInOrder()
- AjaxAddCartViewsRemoveButtonTest::testRemoveButton in modules/
dc_ajax_add_cart_views/ tests/ src/ FunctionalJavascript/ AjaxAddCartViewsRemoveButtonTest.php - Tests remove button views field.
File
- modules/
dc_ajax_add_cart_views/ tests/ src/ Functional/ AjaxAddCartViewsTestBase.php, line 153
Class
- AjaxAddCartViewsTestBase
- Base class for ajax add cart views tests.
Namespace
Drupal\Tests\dc_ajax_add_cart_views\FunctionalCode
protected function assertNotVariationInOrder(ProductVariationInterface $variation, array $order_items) {
$is_present = TRUE;
foreach ($order_items as $item) {
if ($item
->getPurchasedEntity()
->id() !== $variation
->id()) {
$is_present = FALSE;
}
else {
$is_present = TRUE;
}
}
$this
->assertFalse($is_present, 'Variation present in cart.');
}