Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractWishlistTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Product\CatalogProductView;
10 use Magento\Cms\Test\Page\CmsIndex;
12 use Magento\Wishlist\Test\Page\WishlistIndex;
13 use Magento\Mtf\Fixture\FixtureFactory;
14 use Magento\Mtf\ObjectManager;
15 use Magento\Mtf\TestCase\Injectable;
16 
21 abstract class AbstractWishlistTest extends Injectable
22 {
28  protected $objectManager;
29 
35  protected $cmsIndex;
36 
43 
49  protected $fixtureFactory;
50 
56  protected $wishlistIndex;
57 
68  public function __inject(
69  CmsIndex $cmsIndex,
70  CatalogProductView $catalogProductView,
71  FixtureFactory $fixtureFactory,
72  WishlistIndex $wishlistIndex,
73  ObjectManager $objectManager
74  ) {
75  $this->cmsIndex = $cmsIndex;
76  $this->catalogProductView = $catalogProductView;
77  $this->fixtureFactory = $fixtureFactory;
78  $this->wishlistIndex = $wishlistIndex;
79  $this->objectManager = $objectManager;
80  }
81 
88  protected function loginCustomer(Customer $customer)
89  {
90  $loginCustomerOnFrontendStep = $this->objectManager->create(
91  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
92  ['customer' => $customer]
93  );
94  $loginCustomerOnFrontendStep->run();
95  }
96 
103  protected function createProducts($products)
104  {
105  $createProductsStep = $this->objectManager->create(
106  \Magento\Catalog\Test\TestStep\CreateProductsStep::class,
107  ['products' => $products]
108  );
109 
110  return $createProductsStep->run()['products'];
111  }
112 
120  protected function addToWishlist(array $products, $configure = false)
121  {
122  $this->objectManager->create(
123  \Magento\Wishlist\Test\TestStep\AddProductsToWishlistStep::class,
124  ['products' => $products, 'configure' => $configure]
125  )->run();
126  }
127 }
__inject(CmsIndex $cmsIndex, CatalogProductView $catalogProductView, FixtureFactory $fixtureFactory, WishlistIndex $wishlistIndex, ObjectManager $objectManager)
$customer
Definition: customers.php:11