Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ShareWishlistEntityTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Cms\Test\Page\CmsIndex;
12 use Magento\Wishlist\Test\Page\WishlistIndex;
13 use Magento\Wishlist\Test\Page\WishlistShare;
14 use Magento\Mtf\TestCase\Injectable;
15 
34 class ShareWishlistEntityTest extends Injectable
35 {
36  /* tags */
37  const MVP = 'no';
38  /* end tags */
39 
45  protected $cmsIndex;
46 
52  protected $wishlistIndex;
53 
59  protected $wishlistShare;
60 
68  public function __prepare(Customer $customer, CatalogProductSimple $product)
69  {
70  $customer->persist();
71  $product->persist();
72 
73  return [
74  'customer' => $customer,
75  'product' => $product
76  ];
77  }
78 
87  public function __inject(
88  CmsIndex $cmsIndex,
89  WishlistIndex $wishlistIndex,
90  WishlistShare $wishlistShare
91  ) {
92  $this->cmsIndex = $cmsIndex;
93  $this->wishlistIndex = $wishlistIndex;
94  $this->wishlistShare = $wishlistShare;
95  }
96 
105  public function test(
106  Customer $customer,
107  CatalogProductSimple $product,
108  array $sharingInfo
109  ) {
110  //Steps
111  $this->objectManager->create(
112  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
113  ['customer' => $customer]
114  )->run();
115  $this->objectManager->create(
116  \Magento\Wishlist\Test\TestStep\AddProductsToWishlistStep::class,
117  ['products' => [$product]]
118  )->run();
119  $this->wishlistIndex->getMessagesBlock()->waitSuccessMessage();
120  $this->wishlistIndex->getWishlistBlock()->clickShareWishList();
121  $this->cmsIndex->getCmsPageBlock()->waitPageInit();
122  $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo);
123  $this->wishlistShare->getSharingInfoForm()->shareWishlist();
124  }
125 }
$customer
Definition: customers.php:11
__prepare(Customer $customer, CatalogProductSimple $product)
__inject(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex, WishlistShare $wishlistShare)
test(Customer $customer, CatalogProductSimple $product, array $sharingInfo)