@@ -324,9 +324,9 @@ public function testResetPasswordActionCoreException()
324
324
);
325
325
326
326
// Setup a core exception to return
327
- $ error = ' Something Bad happened ' ;
328
- $ exception = new \Magento \Framework \Validator \ ValidatorException ( $ error );
329
- $ exception ->addError ( ' Something Bad happened ' );
327
+ $ exception = new \ Magento \ Framework \ Validator \ ValidatorException () ;
328
+ $ error = new \Magento \Framework \Message \ Error ( ' Something Bad happened ' );
329
+ $ exception ->addMessage ( $ error );
330
330
331
331
$ this ->_customerRepositoryMock ->expects (
332
332
$ this ->once ()
@@ -341,7 +341,7 @@ public function testResetPasswordActionCoreException()
341
341
// Verify error message is set
342
342
$ this ->messageManager ->expects ($ this ->once ())
343
343
->method ('addMessage ' )
344
- ->with ($ this ->equalTo (new \ Magento \ Framework \ Message \ Error ( $ error) ));
344
+ ->with ($ this ->equalTo ($ error ));
345
345
346
346
$ this ->_testedObject ->execute ();
347
347
}
@@ -351,34 +351,26 @@ public function testResetPasswordActionCoreExceptionWarn()
351
351
$ warningText = 'Warning ' ;
352
352
$ customerId = 1 ;
353
353
354
- $ this ->_request ->expects (
355
- $ this ->once ()
356
- )->method (
357
- 'getParam '
358
- )->with (
359
- $ this ->equalTo ('customer_id ' ),
360
- $ this ->equalTo (0 )
361
- )->will (
362
- $ this ->returnValue ($ customerId )
363
- );
354
+ $ this ->_request ->expects ($ this ->once ())
355
+ ->method ('getParam ' )
356
+ ->with ($ this ->equalTo ('customer_id ' ), $ this ->equalTo (0 ))
357
+ ->will ($ this ->returnValue ($ customerId ));
364
358
365
359
// Setup a core exception to return
366
360
$ exception = new \Magento \Framework \Validator \ValidatorException ($ warningText );
367
- $ error = 'Something Not So Bad happened ' ;
368
- $ exception ->addError ($ error );
361
+
362
+ $ error = new \Magento \Framework \Message \Warning ('Something Not So Bad happened ' );
363
+ $ exception ->addMessage ($ error );
369
364
370
365
$ this ->_customerRepositoryMock ->expects ($ this ->once ())
371
366
->method ('getById ' )
372
367
->with ($ customerId )
373
368
->will ($ this ->throwException ($ exception ));
374
369
375
370
// Verify Warning is converted to an Error and message text is set to exception text
376
- $ this ->messageManager ->expects (
377
- $ this ->once ()
378
- )->method (
379
- 'addMessage '
380
- )->with (
381
- $ this ->equalTo (new \Magento \Framework \Message \Error ($ warningText ))
371
+ $ this ->messageManager ->expects ($ this ->once ())
372
+ ->method ('addMessage ' )
373
+ ->with ($ this ->equalTo (new \Magento \Framework \Message \Error ($ warningText ))
382
374
);
383
375
384
376
$ this ->_testedObject ->execute ();
0 commit comments