7
7
namespace Magento \Wishlist \Test \TestCase ;
8
8
9
9
use Magento \Catalog \Test \Fixture \CatalogProductSimple ;
10
- use Magento \Catalog \Test \Page \Product \CatalogProductView ;
11
10
use Magento \Cms \Test \Page \CmsIndex ;
12
11
use Magento \Customer \Test \Fixture \Customer ;
13
- use Magento \Customer \Test \Page \CustomerAccountIndex ;
14
12
use Magento \Wishlist \Test \Page \WishlistIndex ;
15
13
use Magento \Wishlist \Test \Page \WishlistShare ;
16
14
use Magento \Mtf \Client \BrowserInterface ;
31
29
*
32
30
* @group Wishlist_(CS)
33
31
* @ZephyrId MAGETWO-23394
32
+ *
33
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
34
34
*/
35
35
class ShareWishlistEntityTest extends Injectable
36
36
{
@@ -46,20 +46,6 @@ class ShareWishlistEntityTest extends Injectable
46
46
*/
47
47
protected $ cmsIndex ;
48
48
49
- /**
50
- * Customer account index page.
51
- *
52
- * @var CustomerAccountIndex
53
- */
54
- protected $ customerAccountIndex ;
55
-
56
- /**
57
- * Product view page.
58
- *
59
- * @var CatalogProductView
60
- */
61
- protected $ catalogProductView ;
62
-
63
49
/**
64
50
* Wishlist index page.
65
51
*
@@ -81,10 +67,8 @@ class ShareWishlistEntityTest extends Injectable
81
67
* @param CatalogProductSimple $product
82
68
* @return array
83
69
*/
84
- public function __prepare (
85
- Customer $ customer ,
86
- CatalogProductSimple $ product
87
- ) {
70
+ public function __prepare (Customer $ customer , CatalogProductSimple $ product )
71
+ {
88
72
$ customer ->persist ();
89
73
$ product ->persist ();
90
74
@@ -98,22 +82,16 @@ public function __prepare(
98
82
* Inject pages.
99
83
*
100
84
* @param CmsIndex $cmsIndex
101
- * @param CustomerAccountIndex $customerAccountIndex
102
- * @param CatalogProductView $catalogProductView
103
85
* @param WishlistIndex $wishlistIndex
104
86
* @param WishlistShare $wishlistShare
105
87
* @return void
106
88
*/
107
89
public function __inject (
108
90
CmsIndex $ cmsIndex ,
109
- CustomerAccountIndex $ customerAccountIndex ,
110
- CatalogProductView $ catalogProductView ,
111
91
WishlistIndex $ wishlistIndex ,
112
92
WishlistShare $ wishlistShare
113
93
) {
114
94
$ this ->cmsIndex = $ cmsIndex ;
115
- $ this ->customerAccountIndex = $ customerAccountIndex ;
116
- $ this ->catalogProductView = $ catalogProductView ;
117
95
$ this ->wishlistIndex = $ wishlistIndex ;
118
96
$ this ->wishlistShare = $ wishlistShare ;
119
97
}
@@ -134,27 +112,18 @@ public function test(
134
112
array $ sharingInfo
135
113
) {
136
114
//Steps
137
- $ this ->loginCustomer ($ customer );
138
- $ browser ->open ($ _ENV ['app_frontend_url ' ] . $ product ->getUrlKey () . '.html ' );
139
- $ this ->catalogProductView ->getViewBlock ()->clickAddToWishlist ();
115
+ $ this ->objectManager ->create (
116
+ 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep ' ,
117
+ ['customer ' => $ customer ]
118
+ )->run ();
119
+ $ this ->objectManager ->create (
120
+ 'Magento\Wishlist\Test\TestStep\AddProductsToWishlistStep ' ,
121
+ ['products ' => [$ product ]]
122
+ )->run ();
140
123
$ this ->wishlistIndex ->getMessagesBlock ()->waitSuccessMessage ();
141
124
$ this ->wishlistIndex ->getWishlistBlock ()->clickShareWishList ();
142
125
$ this ->cmsIndex ->getCmsPageBlock ()->waitPageInit ();
143
126
$ this ->wishlistShare ->getSharingInfoForm ()->fillForm ($ sharingInfo );
144
127
$ this ->wishlistShare ->getSharingInfoForm ()->shareWishlist ();
145
128
}
146
-
147
- /**
148
- * Login customer.
149
- *
150
- * @param Customer $customer
151
- * @return void
152
- */
153
- protected function loginCustomer (Customer $ customer )
154
- {
155
- $ this ->objectManager ->create (
156
- 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep ' ,
157
- ['customer ' => $ customer ]
158
- )->run ();
159
- }
160
129
}
0 commit comments