Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbandonedCartsReportEntityTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\TestCase\Injectable;
10 use Magento\Mtf\Fixture\FixtureFactory;
11 use Magento\Mtf\Client\BrowserInterface;
13 use Magento\Catalog\Test\Page\Product\CatalogProductView;
14 
33 class AbandonedCartsReportEntityTest extends Injectable
34 {
35  /* tags */
36  const MVP = 'no';
37  const STABLE = 'yes';
38  /* end tags */
39 
46 
52  protected $browser;
53 
59  protected $fixtureFactory;
60 
69  public function __inject(
70  BrowserInterface $browser,
71  FixtureFactory $fixtureFactory,
72  CatalogProductView $catalogProductView
73  ) {
74  $this->browser = $browser;
75  $this->catalogProductView = $catalogProductView;
76  $this->fixtureFactory = $fixtureFactory;
77  }
78 
86  public function test($products, Customer $customer)
87  {
88  // Precondition
90  $customer->persist();
91  $this->objectManager->create(
92  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
93  ['customer' => $customer]
94  )->run();
96  $this->objectManager->create(
97  \Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep::class,
98  ['customer' => $customer]
99  )->run();
100 
101  return ['products' => $products];
102  }
103 
110  protected function createProducts($products)
111  {
112  $createProductsStep = $this->objectManager->create(
113  \Magento\Catalog\Test\TestStep\CreateProductsStep::class,
114  ['products' => $products]
115  );
116 
117  return $createProductsStep->run()['products'];
118  }
119 
126  protected function addProductsToCart(array $products)
127  {
128  $addProductsToCart = $this->objectManager->create(
129  \Magento\Checkout\Test\TestStep\AddProductsToTheCartStep::class,
130  ['products' => $products]
131  );
132  $addProductsToCart->run();
133  }
134 }
$customer
Definition: customers.php:11
__inject(BrowserInterface $browser, FixtureFactory $fixtureFactory, CatalogProductView $catalogProductView)