1- <?php declare (strict_types=1 );
1+ <?php
2+
3+ declare (strict_types=1 );
24
35namespace Codeception \Verify \Asserts ;
46
@@ -18,23 +20,23 @@ public function assertThrows($throws = null, $message = false): self
1820
1921 try {
2022 call_user_func ($ this ->actual );
21- } catch (Throwable $ exception ) {
23+ } catch (Throwable $ throwable ) {
2224 if (!$ throws ) {
2325 return $ this ; // it throws
2426 }
2527
26- $ actualThrows = get_class ($ exception );
27- $ actualMessage = $ exception ->getMessage ();
28+ $ actualThrows = get_class ($ throwable );
29+ $ actualMessage = $ throwable ->getMessage ();
2830
29- Assert::assertSame ($ throws , $ actualThrows , sprintf (' exception \ '%s \ ' was expected, but \ '%s \ ' was thrown ' , $ throws , $ actualThrows ));
31+ Assert::assertSame ($ throws , $ actualThrows , sprintf (" exception '%s' was expected, but '%s' was thrown " , $ throws , $ actualThrows ));
3032
3133 if ($ message ) {
32- Assert::assertSame ($ message , $ actualMessage , sprintf (' exception message \ '%s \ ' was expected, but \ '%s \ ' was received ' , $ message , $ actualMessage ));
34+ Assert::assertSame ($ message , $ actualMessage , sprintf (" exception message '%s' was expected, but '%s' was received " , $ message , $ actualMessage ));
3335 }
3436 }
3537
36- if (!isset ($ exception )) {
37- throw new ExpectationFailedException (sprintf (' exception \ '%s \ ' was not thrown as expected ' , $ throws ));
38+ if (!isset ($ throwable )) {
39+ throw new ExpectationFailedException (sprintf (" exception '%s' was not thrown as expected " , $ throws ));
3840 }
3941
4042 return $ this ;
@@ -62,11 +64,11 @@ public function assertDoesNotThrow($throws = null, $message = false): self
6264 }
6365
6466 if (!$ message ) {
65- throw new ExpectationFailedException (sprintf (' exception \ '%s \ ' was not expected to be thrown ' , $ throws ));
67+ throw new ExpectationFailedException (sprintf (" exception '%s' was not expected to be thrown " , $ throws ));
6668 }
6769
6870 if ($ message === $ actualMessage ) {
69- throw new ExpectationFailedException (sprintf (' exception \ '%s \ ' with message \ '%s \ ' was not expected to be thrown ' , $ throws , $ message ));
71+ throw new ExpectationFailedException (sprintf (" exception '%s' with message '%s' was not expected to be thrown " , $ throws , $ message ));
7072 }
7173 }
7274
0 commit comments