@@ -44,9 +44,9 @@ function correctExpectations()
4444 [ function () { expect ('foo bar ' )->toEndWith ('bar ' ); } ],
4545 [ function () { expect ('foo bar ' )->toMatch ('/bar/ ' ); } ],
4646 [ function () { expect ((new Foo ()))->toThrow ('InvalidArgumentException ' )->duringThrowException (); } ],
47- [ function () { expect ((new Foo ()))->toTrigger (E_USER_DEPRECATED )->duringTriggerError (); } ],
48- [ function () { expect (1.444447777 )->toBeApproximately (1.444447777 , 1.0e-9 ); } ],
49- [ function () { expect ((new Foo ())->getIterator ())->toIterateAs (new \ArrayIterator (['Foo ' , 'Bar ' ])); } ],
47+ [ function () { method_exists ( expect ( '' ), ' toTrigger ' ) && expect ((new Foo ()))->toTrigger (E_USER_DEPRECATED )->duringTriggerError (); } ],
48+ [ function () { method_exists ( expect ( '' ), ' toBeApproximately ' ) && expect (1.444447777 )->toBeApproximately (1.444447777 , 1.0e-9 ); } ],
49+ [ function () { method_exists ( expect ( '' ), ' toIterateAs ' ) && expect ((new Foo ())->getIterator ())->toIterateAs (new \ArrayIterator (['Foo ' , 'Bar ' ])); } ],
5050 ];
5151 }
5252
@@ -55,7 +55,7 @@ function correctExpectations()
5555 */
5656 function incorrectExpectations ()
5757 {
58- return [
58+ $ incorrectExpectations = [
5959 [ function () { expect (6 )->toBe (5 ); } ],
6060 [ function () { expect (6 )->toBeLike ('5 ' ); } ],
6161 [ function () { expect ((new Foo ()))->toHaveType ('Bar ' ); } ],
@@ -70,9 +70,16 @@ function incorrectExpectations()
7070 [ function () { expect ('foo bar ' )->toStartWith ('baz ' ); } ],
7171 [ function () { expect ('foo bar ' )->toEndWith ('baz ' ); } ],
7272 [ function () { expect ('foo bar ' )->toMatch ('/baz/ ' ); } ],
73- [ function () { expect ((new Foo ()))->toThrow ('AnotherException ' )->duringThrowException (); } ],
74- [ function () { expect (1.444447777 )->toBeApproximately (1.444447778 , 1.0e-9 ); } ],
75- [ function () { expect ((new Foo ())->getIterator ())->toIterateAs (new \ArrayIterator (['Bar ' , 'Foo ' ])); } ]
73+ [ function () { expect ((new Foo ()))->toThrow ('AnotherException ' )->duringThrowException (); } ]
7674 ];
75+
76+ if (method_exists (expect ('' ), 'toBeApproximately ' )) {
77+ $ incorrectExpectations [] = [function () { expect (1.444447777 )->toBeApproximately (1.444447778 , 1.0e-9 ); }];
78+ }
79+ if (method_exists (expect ('' ), 'toIterateAs ' )) {
80+ $ incorrectExpectations = [ function () { expect ((new Foo ())->getIterator ())->toIterateAs (new \ArrayIterator (['Bar ' , 'Foo ' ])); } ];
81+ }
82+
83+ return $ incorrectExpectations ;
7784 }
7885}
0 commit comments