9 use Magento\Mtf\TestCase\Injectable;
10 use Magento\Mtf\Fixture\FixtureFactory;
11 use Magento\Checkout\Test\Page\CheckoutCart;
42 private $checkoutCart;
49 private $fixtureFactory;
68 FixtureFactory $fixtureFactory,
71 $this->checkoutCart = $checkoutCart;
72 $this->fixtureFactory = $fixtureFactory;
90 $this->cache->flush();
92 \
Magento\Catalog\Test\TestStep\CreateProductsStep::class,
98 for (
$i = 0;
$i < count($checkoutData);
$i++) {
99 $customers[
$i] = $this->fixtureFactory->createByCode(
'customer', [
'dataset' => $customerDataset]);
102 if (isset($checkoutData[
$i])) {
109 $this->objectManager->create(
110 \
Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
113 $this->checkoutCart->open();
114 $this->checkoutCart->open();
119 'cartFixtures' => $cartFixtures,
131 private function prepareShoppingCart(Customer
$customer, array $checkoutData, array
$products)
133 $productsInCart = [];
134 if (isset($checkoutData[
'items'])) {
135 foreach ($checkoutData[
'items'] as
$index => $dataset) {
137 $productFixture = $this->fixtureFactory->create(
140 'data' => array_merge(
142 [
'checkout_data' => [
'dataset' => $dataset]]
146 $productsInCart[] = $productFixture;
151 if (!empty($productsInCart)) {
152 $this->objectManager->create(
153 \
Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
157 $this->objectManager->create(
158 \
Magento\Checkout\Test\TestStep\AddProductsToTheCartStep::class,
159 [
'products' => $productsInCart]
162 $cart[
'data'] = isset($checkoutData[
'totals']) ? $checkoutData[
'totals'] : [];
163 $cart[
'data'][
'items'] = [
'products' => $productsInCart];
164 return $this->fixtureFactory->createByCode(
'cart',
$cart);