55 */
66namespace Magento \Newsletter \Test \Unit \Model ;
77
8+ use Magento \Newsletter \Model \Subscriber ;
9+
810/**
911 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1012 */
@@ -116,7 +118,7 @@ public function testSubscribe()
116118117119 $ this ->resource ->expects ($ this ->any ())->method ('loadByEmail ' )->willReturn (
118120 [
119- 'subscriber_status ' => 3 ,
121+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED ,
120122 'subscriber_email ' => $ email ,
121123 'name ' => 'subscriber_name '
122124 ]
@@ -133,15 +135,15 @@ public function testSubscribe()
133135 $ this ->sendEmailCheck ();
134136 $ this ->resource ->expects ($ this ->atLeastOnce ())->method ('save ' )->willReturnSelf ();
135137
136- $ this ->assertEquals (1 , $ this ->subscriber ->subscribe ($ email ));
138+ $ this ->assertEquals (Subscriber:: STATUS_NOT_ACTIVE , $ this ->subscriber ->subscribe ($ email ));
137139 }
138140
139141 public function testSubscribeNotLoggedIn ()
140142 {
141143142144 $ this ->resource ->expects ($ this ->any ())->method ('loadByEmail ' )->willReturn (
143145 [
144- 'subscriber_status ' => 3 ,
146+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED ,
145147 'subscriber_email ' => $ email ,
146148 'name ' => 'subscriber_name '
147149 ]
@@ -158,7 +160,7 @@ public function testSubscribeNotLoggedIn()
158160 $ this ->sendEmailCheck ();
159161 $ this ->resource ->expects ($ this ->atLeastOnce ())->method ('save ' )->willReturnSelf ();
160162
161- $ this ->assertEquals (2 , $ this ->subscriber ->subscribe ($ email ));
163+ $ this ->assertEquals (Subscriber:: STATUS_NOT_ACTIVE , $ this ->subscriber ->subscribe ($ email ));
162164 }
163165
164166 public function testUpdateSubscription ()
@@ -175,7 +177,7 @@ public function testUpdateSubscription()
175177 ->willReturn (
176178 [
177179 'subscriber_id ' => 1 ,
178- 'subscriber_status ' => 1
180+ 'subscriber_status ' => Subscriber:: STATUS_SUBSCRIBED
179181 ]
180182 );
181183 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -210,7 +212,7 @@ public function testUnsubscribeCustomerById()
210212 ->willReturn (
211213 [
212214 'subscriber_id ' => 1 ,
213- 'subscriber_status ' => 1
215+ 'subscriber_status ' => Subscriber:: STATUS_SUBSCRIBED
214216 ]
215217 );
216218 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -236,7 +238,7 @@ public function testSubscribeCustomerById()
236238 ->willReturn (
237239 [
238240 'subscriber_id ' => 1 ,
239- 'subscriber_status ' => 3
241+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED
240242 ]
241243 );
242244 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -262,7 +264,7 @@ public function testSubscribeCustomerById1()
262264 ->willReturn (
263265 [
264266 'subscriber_id ' => 1 ,
265- 'subscriber_status ' => 3
267+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED
266268 ]
267269 );
268270 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -276,7 +278,7 @@ public function testSubscribeCustomerById1()
276278 $ this ->scopeConfig ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->with ()->willReturn (true );
277279
278280 $ this ->subscriber ->subscribeCustomerById ($ customerId );
279- $ this ->assertEquals (\ Magento \ Newsletter \ Model \ Subscriber::STATUS_NOT_ACTIVE , $ this ->subscriber ->getStatus ());
281+ $ this ->assertEquals (Subscriber::STATUS_NOT_ACTIVE , $ this ->subscriber ->getStatus ());
280282 }
281283
282284 public function testSubscribeCustomerByIdAfterConfirmation ()
@@ -293,7 +295,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
293295 ->willReturn (
294296 [
295297 'subscriber_id ' => 1 ,
296- 'subscriber_status ' => 4
298+ 'subscriber_status ' => Subscriber:: STATUS_UNCONFIRMED
297299 ]
298300 );
299301 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -305,7 +307,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
305307 $ this ->scopeConfig ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->with ()->willReturn (true );
306308
307309 $ this ->subscriber ->updateSubscription ($ customerId );
308- $ this ->assertEquals (\ Magento \ Newsletter \ Model \ Subscriber::STATUS_SUBSCRIBED , $ this ->subscriber ->getStatus ());
310+ $ this ->assertEquals (Subscriber::STATUS_SUBSCRIBED , $ this ->subscriber ->getStatus ());
309311 }
310312
311313 public function testUnsubscribe ()
0 commit comments