File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
rules-tests/PHPUnit120/Rector/ClassMethod/ExpressionCreateMockToCreateStubRector/Fixture Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \PHPUnit \Tests \PHPUnit120 \Rector \ClassMethod \ExpressionCreateMockToCreateStubRector \Fixture ;
4+
5+ use PHPUnit \Framework \TestCase ;
6+ use Rector \PHPUnit \Tests \PHPUnit120 \Rector \ClassMethod \ExpressionCreateMockToCreateStubRector \Source \ClassWithDependency ;
7+
8+ final class SkipMocking extends TestCase
9+ {
10+ public function test ()
11+ {
12+ $ mock = $ this ->createMock (\stdClass::class);
13+ $ mock ->expects ($ this ->once ())->method ('someMethod ' )->willReturn ('someValue ' );
14+
15+ $ someObject = new ClassWithDependency ($ mock );
16+ $ this ->assertSame ($ mock , $ someObject ->getDependency ());
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \PHPUnit \Tests \PHPUnit120 \Rector \ClassMethod \ExpressionCreateMockToCreateStubRector \Fixture ;
4+
5+ use PHPUnit \Framework \TestCase ;
6+ use Rector \PHPUnit \Tests \PHPUnit120 \Rector \ClassMethod \ExpressionCreateMockToCreateStubRector \Source \ClassWithDependency ;
7+
8+ final class SkipUsedOutsideArg extends TestCase
9+ {
10+ public function test ()
11+ {
12+ $ mock = $ this ->createMock (\stdClass::class);
13+
14+ if ($ mock instanceof \stdClass) {
15+ // do something
16+ }
17+
18+ $ someObject = new ClassWithDependency ($ mock );
19+ $ this ->assertSame ($ mock , $ someObject ->getDependency ());
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments