55 */
66namespace Magento \Newsletter \Test \Unit \Model ;
77
8+ use Magento \Newsletter \Model \Subscriber ;
9+
810/**
911 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1012 */
@@ -148,7 +150,7 @@ public function testSubscribe()
148150 );
149151 $ this ->resource ->expects ($ this ->any ())->method ('loadByCustomerData ' )->with ($ customer )->willReturn (
150152 [
151- 'subscriber_status ' => 3 ,
153+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED ,
152154 'subscriber_email ' => $ email ,
153155 'name ' => 'subscriber_name '
154156 ]
@@ -165,7 +167,7 @@ public function testSubscribe()
165167 $ this ->sendEmailCheck ();
166168 $ this ->resource ->expects ($ this ->atLeastOnce ())->method ('save ' )->willReturnSelf ();
167169
168- $ this ->assertEquals (1 , $ this ->subscriber ->subscribe ($ email ));
170+ $ this ->assertEquals (Subscriber:: STATUS_NOT_ACTIVE , $ this ->subscriber ->subscribe ($ email ));
169171 }
170172
171173 public function testSubscribeNotLoggedIn ()
@@ -187,7 +189,7 @@ public function testSubscribeNotLoggedIn()
187189 );
188190 $ this ->resource ->expects ($ this ->any ())->method ('loadByCustomerData ' )->with ($ customer )->willReturn (
189191 [
190- 'subscriber_status ' => 3 ,
192+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED ,
191193 'subscriber_email ' => $ email ,
192194 'name ' => 'subscriber_name '
193195 ]
@@ -204,7 +206,7 @@ public function testSubscribeNotLoggedIn()
204206 $ this ->sendEmailCheck ();
205207 $ this ->resource ->expects ($ this ->atLeastOnce ())->method ('save ' )->willReturnSelf ();
206208
207- $ this ->assertEquals (2 , $ this ->subscriber ->subscribe ($ email ));
209+ $ this ->assertEquals (Subscriber:: STATUS_NOT_ACTIVE , $ this ->subscriber ->subscribe ($ email ));
208210 }
209211
210212 public function testUpdateSubscription ()
@@ -221,7 +223,7 @@ public function testUpdateSubscription()
221223 ->willReturn (
222224 [
223225 'subscriber_id ' => 1 ,
224- 'subscriber_status ' => 1
226+ 'subscriber_status ' => Subscriber:: STATUS_SUBSCRIBED
225227 ]
226228 );
227229 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -256,7 +258,7 @@ public function testUnsubscribeCustomerById()
256258 ->willReturn (
257259 [
258260 'subscriber_id ' => 1 ,
259- 'subscriber_status ' => 1
261+ 'subscriber_status ' => Subscriber:: STATUS_SUBSCRIBED
260262 ]
261263 );
262264 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -282,7 +284,7 @@ public function testSubscribeCustomerById()
282284 ->willReturn (
283285 [
284286 'subscriber_id ' => 1 ,
285- 'subscriber_status ' => 3
287+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED
286288 ]
287289 );
288290 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -308,7 +310,7 @@ public function testSubscribeCustomerById1()
308310 ->willReturn (
309311 [
310312 'subscriber_id ' => 1 ,
311- 'subscriber_status ' => 3
313+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED
312314 ]
313315 );
314316 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -322,7 +324,7 @@ public function testSubscribeCustomerById1()
322324 $ this ->scopeConfig ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->with ()->willReturn (true );
323325
324326 $ this ->subscriber ->subscribeCustomerById ($ customerId );
325- $ this ->assertEquals (\ Magento \ Newsletter \ Model \ Subscriber::STATUS_NOT_ACTIVE , $ this ->subscriber ->getStatus ());
327+ $ this ->assertEquals (Subscriber::STATUS_NOT_ACTIVE , $ this ->subscriber ->getStatus ());
326328 }
327329
328330 public function testSubscribeCustomerByIdAfterConfirmation ()
@@ -339,7 +341,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
339341 ->willReturn (
340342 [
341343 'subscriber_id ' => 1 ,
342- 'subscriber_status ' => 4
344+ 'subscriber_status ' => Subscriber:: STATUS_UNCONFIRMED
343345 ]
344346 );
345347 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -351,7 +353,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
351353 $ this ->scopeConfig ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->with ()->willReturn (true );
352354
353355 $ this ->subscriber ->updateSubscription ($ customerId );
354- $ this ->assertEquals (\ Magento \ Newsletter \ Model \ Subscriber::STATUS_SUBSCRIBED , $ this ->subscriber ->getStatus ());
356+ $ this ->assertEquals (Subscriber::STATUS_SUBSCRIBED , $ this ->subscriber ->getStatus ());
355357 }
356358
357359 public function testUnsubscribe ()
0 commit comments