You are here

protected function AjaxAddCartViewsTestBase::getVariationRowPositionCartAjax in Commerce Ajax Add to Cart 8

Returns the row position of the variation in cart.

Parameters

\Drupal\commerce_product\Entity\ProductVariationInterface $variation: The variation whose row position is going to be returned.

Return value

int|bool The row position if found, otherwise FALSE.

3 calls to AjaxAddCartViewsTestBase::getVariationRowPositionCartAjax()
AjaxAddCartViewsEditQuantityTest::testAjaxUpdateCartButton in modules/dc_ajax_add_cart_views/tests/src/FunctionalJavascript/AjaxAddCartViewsEditQuantityTest.php
Tests whether the update cart button is indeed ajaxified.
AjaxAddCartViewsEditQuantityTest::testOrderTotal in modules/dc_ajax_add_cart_views/tests/src/FunctionalJavascript/AjaxAddCartViewsEditQuantityTest.php
Tests whether order total is correct on ajax quantity update.
AjaxAddCartViewsEditQuantityTest::testUpdateCartButton in modules/dc_ajax_add_cart_views/tests/src/FunctionalJavascript/AjaxAddCartViewsEditQuantityTest.php
Tests edit quantity views field.

File

modules/dc_ajax_add_cart_views/tests/src/Functional/AjaxAddCartViewsTestBase.php, line 177

Class

AjaxAddCartViewsTestBase
Base class for ajax add cart views tests.

Namespace

Drupal\Tests\dc_ajax_add_cart_views\Functional

Code

protected function getVariationRowPositionCartAjax(ProductVariationInterface $variation) {
  $row_elements = $this
    ->getSession()
    ->getPage()
    ->findAll('css', '.view-dc-ajax-add-cart-views-test-view table tbody tr');
  foreach ($row_elements as $position => $e) {
    if ($e
      ->hasClass("variation-{$variation->id()}")) {
      return $position;
    }
  }
  return FALSE;
}