protected function AjaxAddCartViewsTestBase::setUp in Commerce Ajax Add to Cart 8
Overrides AjaxAddCartTestBase::setUp
File
- modules/
dc_ajax_add_cart_views/ tests/ src/ Functional/ AjaxAddCartViewsTestBase.php, line 40
Class
- AjaxAddCartViewsTestBase
- Base class for ajax add cart views tests.
Namespace
Drupal\Tests\dc_ajax_add_cart_views\FunctionalCode
protected function setUp() {
parent::setUp();
$this->account = $this
->drupalCreateUser([
'access cart',
]);
// Copied from CartTest::setUp().
$this->variations = [
$this->variation,
];
// Create an additional variation in order to test updating multiple
// quantities in cart.
$variation = $this
->createEntity('commerce_product_variation', [
'type' => 'default',
'sku' => $this
->randomMachineName(),
'price' => [
'number' => 350,
'currency_code' => 'USD',
],
]);
// We need a product too otherwise tests complain about the missing
// backreference.
$this
->createEntity('commerce_product', [
'type' => 'default',
'title' => $this
->randomMachineName(),
'stores' => [
$this->store,
],
'variations' => [
$variation,
],
]);
$this->variations[] = $variation;
}