diff --git a/tests/src/Functional/VadoDiscountsTest.php b/tests/src/Functional/VadoDiscountsTest.php index 76e1552..1fcd4d7 100644 --- a/tests/src/Functional/VadoDiscountsTest.php +++ b/tests/src/Functional/VadoDiscountsTest.php @@ -144,39 +144,31 @@ class VadoDiscountsTest extends CartBrowserTestBase { $this->child_variation = $this->child_product->getDefaultVariation(); /** @var \Drupal\commerce_vado\Entity\VadoGroup $group */ - $this->group_1 = $this->createEntity('commerce_vado_group', [ + $this->group_1 = $this->createVadoGroupWithGroupItems(4, [ 'group_id' => 1, 'title' => 'Group 1', 'group_discount' => 20, - 'group_widget' => [ - 'target_plugin_id' => 'static_list', - ], 'group_items' => [ - /** @var \Drupal\commerce_vado\Entity\VadoGroupItem $group_item */ - $this->group_item_1 = $this->createEntity('commerce_vado_group_item', [ - 'group_id' => 1, + [ 'title' => 'Group Item 1', 'variation' => $this->child_product_1->getDefaultVariation(), 'group_item_discount' => 10, - ]), - $this->group_item_2 = $this->createEntity('commerce_vado_group_item', [ - 'group_id' => 1, + ], + [ 'title' => $this->child_product_2->getDefaultVariation()->getTitle(), 'variation' => $this->child_product_2->getDefaultVariation(), 'group_item_discount' => 0, - ]), - $this->group_item_3 = $this->createEntity('commerce_vado_group_item', [ - 'group_id' => 1, + ], + [ 'title' => $this->child_product_3->getDefaultVariation()->getTitle(), 'variation' => $this->child_product_3->getDefaultVariation(), 'group_item_discount' => -10, - ]), - $this->group_item_4 = $this->createEntity('commerce_vado_group_item', [ - 'group_id' => 1, + ], + [ 'title' => $this->child_product_4->getDefaultVariation()->getTitle(), 'variation' => $this->child_product_4->getDefaultVariation(), 'group_item_discount' => '', - ]), + ], ], ]); $this->orderStorage = $this->container->get('entity_type.manager')->getStorage('commerce_order'); @@ -231,7 +223,7 @@ class VadoDiscountsTest extends CartBrowserTestBase { $this->parent_variation->set('bundle_discount', NULL); $this->parent_variation->set('include_parent', FALSE); $this->parent_variation->save(); - // Test that the price resolver is combining the price of parent and child. + // Test that the order processor is combining the price of parent and child. $this->drupalGet($this->parent_product->toUrl()); $this->assertSession()->pageTextContains('Price'); $this->assertSession()->pageTextContains('$175.99'); @@ -254,7 +246,7 @@ class VadoDiscountsTest extends CartBrowserTestBase { $this->parent_variation->set('bundle_discount', 5); $this->parent_variation->set('include_parent', TRUE); $this->parent_variation->save(); - // Test that the price resolver is combining the price of parent and child. + // Test that the order processor is combining the price of parent and child. $this->drupalGet($this->parent_product->toUrl()); $this->assertSession()->pageTextContains('Price'); $this->assertSession()->pageTextContains('$167.19'); @@ -323,7 +315,7 @@ class VadoDiscountsTest extends CartBrowserTestBase { // Attach the group to the parent. $this->parent_variation->set('variation_groups', $this->group_1->id()); $this->parent_variation->save(); - // Test that the price resolver is calculating the price. + // Test that the order processor is calculating the price. $this->drupalGet($this->parent_product->toUrl()); $this->assertSession()->pageTextContains('$1,153.99'); // Test that the event subscriber is calculating the prices. @@ -359,7 +351,7 @@ class VadoDiscountsTest extends CartBrowserTestBase { $this->parent_variation->set('bundle_discount', 5); $this->parent_variation->set('include_parent', TRUE); $this->parent_variation->save(); - // Test that the price resolver is calculating the price. + // Test that the order processor is calculating the price. $this->drupalGet($this->parent_product->toUrl()); $this->assertSession()->pageTextContains('$1,206.69'); // Test that the event subscriber is calculating the prices.