@@ -192,7 +192,30 @@ public function testIsLoggedIn()
192
192
$ this ->assertInstanceOf ('Magento\Framework\Controller\Result\Redirect ' , $ this ->model ->execute ());
193
193
}
194
194
195
+ public function testGetDefaultRedirect ()
196
+ {
197
+ $ testUrl = 'http://example.com ' ;
198
+ $ this ->urlMock ->expects ($ this ->once ())
199
+ ->method ('getUrl ' )
200
+ ->with ('*/*/index ' , ['_secure ' => true ])
201
+ ->willReturn ($ testUrl );
202
+
203
+ $ this ->redirectMock ->expects ($ this ->once ())
204
+ ->method ('error ' )
205
+ ->with ($ testUrl )
206
+ ->willReturn ($ testUrl );
207
+
208
+ $ this ->redirectResultMock ->expects ($ this ->once ())
209
+ ->method ('setUrl ' )
210
+ ->with ($ testUrl )
211
+ ->willReturnSelf ();
212
+
213
+ $ this ->model ->getDefaultRedirect ();
214
+ }
215
+
195
216
/**
217
+ * @expectedException \Exception
218
+ * @expectedExceptionMessage Bad request.
196
219
* @dataProvider getParametersDataProvider
197
220
*/
198
221
public function testNoCustomerIdInRequest ($ customerId , $ key )
@@ -210,27 +233,6 @@ public function testNoCustomerIdInRequest($customerId, $key)
210
233
->with ($ this ->equalTo ('key ' ), false )
211
234
->will ($ this ->returnValue ($ key ));
212
235
213
- $ exception = new \Exception ('Bad request. ' );
214
- $ this ->messageManagerMock ->expects ($ this ->once ())
215
- ->method ('addException ' )
216
- ->with ($ this ->equalTo ($ exception ), $ this ->equalTo ('There was an error confirming the account ' ));
217
-
218
- $ testUrl = 'http://example.com ' ;
219
- $ this ->urlMock ->expects ($ this ->once ())
220
- ->method ('getUrl ' )
221
- ->with ($ this ->equalTo ('*/*/index ' ), ['_secure ' => true ])
222
- ->will ($ this ->returnValue ($ testUrl ));
223
-
224
- $ this ->redirectMock ->expects ($ this ->once ())
225
- ->method ('error ' )
226
- ->with ($ this ->equalTo ($ testUrl ))
227
- ->will ($ this ->returnValue ($ testUrl ));
228
-
229
- $ this ->redirectResultMock ->expects ($ this ->once ())
230
- ->method ('setUrl ' )
231
- ->with ($ this ->equalTo ($ testUrl ))
232
- ->willReturnSelf ();
233
-
234
236
$ this ->assertInstanceOf ('Magento\Framework\Controller\Result\Redirect ' , $ this ->model ->execute ());
235
237
}
236
238
@@ -315,9 +317,9 @@ public function testSuccessMessage($customerId, $key, $vatValidationEnabled, $ad
315
317
public function getSuccessMessageDataProvider ()
316
318
{
317
319
return [
318
- [1 , 1 , false , null , __ ( 'Thank you for registering with ' ) ],
319
- [1 , 1 , true , Address::TYPE_BILLING , __ ( 'enter you billing address for proper VAT calculation ' ) ],
320
- [1 , 1 , true , Address::TYPE_SHIPPING , __ ( 'enter you shipping address for proper VAT calculation ' ) ],
320
+ [1 , 1 , false , null , 'Thank you for registering with ' ],
321
+ [1 , 1 , true , Address::TYPE_BILLING , 'enter you billing address for proper VAT calculation ' ],
322
+ [1 , 1 , true , Address::TYPE_SHIPPING , 'enter you shipping address for proper VAT calculation ' ],
321
323
];
322
324
}
323
325
@@ -390,18 +392,17 @@ public function testSuccessRedirect(
390
392
->with ($ this ->equalTo ('*/*/index ' ), ['_secure ' => true ])
391
393
->will ($ this ->returnValue ($ successUrl ));
392
394
393
- $ this ->redirectMock ->expects ($ this ->never ())
395
+ $ this ->redirectMock ->expects ($ this ->once ())
394
396
->method ('success ' )
395
397
->with ($ this ->equalTo ($ resultUrl ))
396
- ->will ( $ this -> returnValue ( $ resultUrl) );
398
+ ->willReturn ( $ resultUrl );
397
399
398
- $ this ->scopeConfigMock ->expects ($ this ->never ())
400
+ $ this ->scopeConfigMock ->expects ($ this ->once ())
399
401
->method ('isSetFlag ' )
400
- ->with (
401
- $ this ->equalTo (Url::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD ),
402
- $ this ->equalTo (ScopeInterface::SCOPE_STORE )
402
+ ->with (Url::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD ,
403
+ ScopeInterface::SCOPE_STORE
403
404
)
404
- ->will ( $ this -> returnValue ( $ isSetFlag) );
405
+ ->willReturn ( $ isSetFlag );
405
406
406
407
$ this ->model ->execute ();
407
408
}
@@ -419,7 +420,7 @@ public function getSuccessRedirectDataProvider()
419
420
null ,
420
421
'http://example.com/back ' ,
421
422
true ,
422
- __ ( 'Thank you for registering with ' ) ,
423
+ 'Thank you for registering with ' ,
423
424
],
424
425
[
425
426
1 ,
@@ -428,7 +429,7 @@ public function getSuccessRedirectDataProvider()
428
429
'http://example.com/success ' ,
429
430
'http://example.com/success ' ,
430
431
true ,
431
- __ ( 'Thank you for registering with ' ) ,
432
+ 'Thank you for registering with ' ,
432
433
],
433
434
[
434
435
1 ,
@@ -437,7 +438,7 @@ public function getSuccessRedirectDataProvider()
437
438
'http://example.com/success ' ,
438
439
'http://example.com/success ' ,
439
440
false ,
440
- __ ( 'Thank you for registering with ' ) ,
441
+ 'Thank you for registering with ' ,
441
442
],
442
443
];
443
444
}
0 commit comments