File tree Expand file tree Collapse file tree
rules-tests/CodeQuality/Rector/MethodCall/WithCallbackIdenticalToStandaloneAssertsRector/Fixture Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Rector \PHPUnit \Tests \CodeQuality \Rector \MethodCall \WithCallbackIdenticalToStandaloneAssertsRector \Fixture ;
6+
7+ use PHPUnit \Framework \TestCase ;
8+
9+ final class OnStaticClosure extends TestCase
10+ {
11+ public function test ()
12+ {
13+ $ this ->createMock ('SomeClass ' )
14+ ->expects ($ this ->once ())
15+ ->method ('someMethod ' )
16+ ->with ($ this ->callback (static function (array $ args ): bool {
17+ return count ($ args ) === 2 && $ args [0 ] === 'correct ' ;
18+ }));
19+ }
20+ }
21+
22+ ?>
23+ -----
24+ <?php
25+
26+ declare (strict_types=1 );
27+
28+ namespace Rector \PHPUnit \Tests \CodeQuality \Rector \MethodCall \WithCallbackIdenticalToStandaloneAssertsRector \Fixture ;
29+
30+ use PHPUnit \Framework \TestCase ;
31+
32+ final class OnStaticClosure extends TestCase
33+ {
34+ public function test ()
35+ {
36+ $ this ->createMock ('SomeClass ' )
37+ ->expects ($ this ->once ())
38+ ->method ('someMethod ' )
39+ ->with ($ this ->callback (static function (array $ args ): bool {
40+ self ::assertCount (2 , $ args );
41+ self ::assertSame ('correct ' , $ args [0 ]);
42+ return true ;
43+ }));
44+ }
45+ }
46+
47+ ?>
You can’t perform that action at this time.
0 commit comments