@@ -33,23 +33,23 @@ $e = Assert::exception(function () use (&$inner) {
33
33
}, Tester \AssertException::class, 'UnknownException was expected but got Exception (message) ' );
34
34
Assert::same ($ inner , $ e ->getPrevious ());
35
35
36
- $ e = Assert::exception (function () {
37
- Assert::exception (function () {
38
- throw new Exception ('Text ' );
36
+ $ e = Assert::exception (function () use (& $ inner ) {
37
+ Assert::exception (function () use (& $ inner ) {
38
+ throw $ inner = new Exception ('Text ' );
39
39
}, Exception::class, 'Abc ' );
40
40
}, Tester \AssertException::class, "Exception with a message matching 'Abc' was expected but got 'Text' " );
41
- Assert::null ( $ e ->getPrevious ());
41
+ Assert::same ( $ inner , $ e ->getPrevious ());
42
42
43
43
Assert::exception (function () {
44
44
throw new Exception ('Text ' , 42 );
45
45
}, Exception::class, null , 42 );
46
46
47
- $ e = Assert::exception (function () {
48
- Assert::exception (function () {
49
- throw new Exception ('Text ' , 1 );
47
+ $ e = Assert::exception (function () use (& $ inner ) {
48
+ Assert::exception (function () use (& $ inner ) {
49
+ throw $ inner = new Exception ('Text ' , 1 );
50
50
}, Exception::class, null , 42 );
51
51
}, Tester \AssertException::class, 'Exception with a code 42 was expected but got 1 ' );
52
- Assert::null ( $ e ->getPrevious ());
52
+ Assert::same ( $ inner , $ e ->getPrevious ());
53
53
54
54
$ old = Assert::$ onFailure ;
55
55
Assert::$ onFailure = function () {};
0 commit comments