@@ -33,23 +33,23 @@ $e = Assert::exception(function () use (&$inner) {
3333}, Tester \AssertException::class, 'UnknownException was expected but got Exception (message) ' );
3434Assert::same ($ inner , $ e ->getPrevious ());
3535
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 ' );
3939 }, Exception::class, 'Abc ' );
4040}, 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 ());
4242
4343Assert::exception (function () {
4444 throw new Exception ('Text ' , 42 );
4545}, Exception::class, null , 42 );
4646
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 );
5050 }, Exception::class, null , 42 );
5151}, Tester \AssertException::class, 'Exception with a code 42 was expected but got 1 ' );
52- Assert::null ( $ e ->getPrevious ());
52+ Assert::same ( $ inner , $ e ->getPrevious ());
5353
5454$ old = Assert::$ onFailure ;
5555Assert::$ onFailure = function () {};
0 commit comments