55 */
66namespace Magento \Newsletter \Test \Unit \Model ;
77
8+ use Magento \Newsletter \Model \Subscriber ;
9+
810/**
911 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1012 */
@@ -134,7 +136,7 @@ public function testSubscribe()
134136135137 $ this ->resource ->expects ($ this ->any ())->method ('loadByEmail ' )->willReturn (
136138 [
137- 'subscriber_status ' => 3 ,
139+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED ,
138140 'subscriber_email ' => $ email ,
139141 'name ' => 'subscriber_name '
140142 ]
@@ -151,15 +153,15 @@ public function testSubscribe()
151153 $ this ->sendEmailCheck ();
152154 $ this ->resource ->expects ($ this ->atLeastOnce ())->method ('save ' )->willReturnSelf ();
153155
154- $ this ->assertEquals (1 , $ this ->subscriber ->subscribe ($ email ));
156+ $ this ->assertEquals (Subscriber:: STATUS_NOT_ACTIVE , $ this ->subscriber ->subscribe ($ email ));
155157 }
156158
157159 public function testSubscribeNotLoggedIn ()
158160 {
159161160162 $ this ->resource ->expects ($ this ->any ())->method ('loadByEmail ' )->willReturn (
161163 [
162- 'subscriber_status ' => 3 ,
164+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED ,
163165 'subscriber_email ' => $ email ,
164166 'name ' => 'subscriber_name '
165167 ]
@@ -176,7 +178,7 @@ public function testSubscribeNotLoggedIn()
176178 $ this ->sendEmailCheck ();
177179 $ this ->resource ->expects ($ this ->atLeastOnce ())->method ('save ' )->willReturnSelf ();
178180
179- $ this ->assertEquals (2 , $ this ->subscriber ->subscribe ($ email ));
181+ $ this ->assertEquals (Subscriber:: STATUS_NOT_ACTIVE , $ this ->subscriber ->subscribe ($ email ));
180182 }
181183
182184 public function testUpdateSubscription ()
@@ -193,7 +195,7 @@ public function testUpdateSubscription()
193195 ->willReturn (
194196 [
195197 'subscriber_id ' => 1 ,
196- 'subscriber_status ' => 1
198+ 'subscriber_status ' => Subscriber:: STATUS_SUBSCRIBED
197199 ]
198200 );
199201 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -228,7 +230,7 @@ public function testUnsubscribeCustomerById()
228230 ->willReturn (
229231 [
230232 'subscriber_id ' => 1 ,
231- 'subscriber_status ' => 1
233+ 'subscriber_status ' => Subscriber:: STATUS_SUBSCRIBED
232234 ]
233235 );
234236 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -254,7 +256,7 @@ public function testSubscribeCustomerById()
254256 ->willReturn (
255257 [
256258 'subscriber_id ' => 1 ,
257- 'subscriber_status ' => 3
259+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED
258260 ]
259261 );
260262 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -280,7 +282,7 @@ public function testSubscribeCustomerById1()
280282 ->willReturn (
281283 [
282284 'subscriber_id ' => 1 ,
283- 'subscriber_status ' => 3
285+ 'subscriber_status ' => Subscriber:: STATUS_UNSUBSCRIBED
284286 ]
285287 );
286288 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -294,7 +296,7 @@ public function testSubscribeCustomerById1()
294296 $ this ->scopeConfig ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->with ()->willReturn (true );
295297
296298 $ this ->subscriber ->subscribeCustomerById ($ customerId );
297- $ this ->assertEquals (\ Magento \ Newsletter \ Model \ Subscriber::STATUS_NOT_ACTIVE , $ this ->subscriber ->getStatus ());
299+ $ this ->assertEquals (Subscriber::STATUS_NOT_ACTIVE , $ this ->subscriber ->getStatus ());
298300 }
299301
300302 public function testSubscribeCustomerByIdAfterConfirmation ()
@@ -311,7 +313,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
311313 ->willReturn (
312314 [
313315 'subscriber_id ' => 1 ,
314- 'subscriber_status ' => 4
316+ 'subscriber_status ' => Subscriber:: STATUS_UNCONFIRMED
315317 ]
316318 );
317319 $ customerDataMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ('id ' );
@@ -323,7 +325,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
323325 $ this ->scopeConfig ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->with ()->willReturn (true );
324326
325327 $ this ->subscriber ->updateSubscription ($ customerId );
326- $ this ->assertEquals (\ Magento \ Newsletter \ Model \ Subscriber::STATUS_SUBSCRIBED , $ this ->subscriber ->getStatus ());
328+ $ this ->assertEquals (Subscriber::STATUS_SUBSCRIBED , $ this ->subscriber ->getStatus ());
327329 }
328330
329331 public function testUnsubscribe ()
0 commit comments