You are here

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

Returns a random variation.

This variation is going to be added to cart.

Return value

\Drupal\commerce_product\Entity\ProductVariationInterface The product variation.

3 calls to AjaxAddCartViewsTestBase::getRandomVariation()
AjaxAddCartViewsRemoveButtonTest::testAjaxRemoveButton in modules/dc_ajax_add_cart_views/tests/src/FunctionalJavascript/AjaxAddCartViewsRemoveButtonTest.php
Tests whether the remove button views field is indeed ajaxified.
AjaxAddCartViewsRemoveButtonTest::testOrderTotal in modules/dc_ajax_add_cart_views/tests/src/FunctionalJavascript/AjaxAddCartViewsRemoveButtonTest.php
Tests whether order total is correct on ajax removing product from cart.
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 118

Class

AjaxAddCartViewsTestBase
Base class for ajax add cart views tests.

Namespace

Drupal\Tests\dc_ajax_add_cart_views\Functional

Code

protected function getRandomVariation() {
  return $this->variations[mt_rand(0, count($this->variations) - 1)];
}