Skip to content

Commit 3bfd2b8

Browse files
authored
Failling test: MergeWithCallableAndWillReturnRector forgest to introduce closure use
1 parent 6d2b1ba commit 3bfd2b8

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
namespace Rector\Tests\PHPUnit\CodeQuality\Rector\MethodCall\MergeWithCallableAndWillReturnRector\Fixture;
4+
5+
final class DemoFile extends PHPUnit\Framework\TestCase
6+
{
7+
public function test_it(): void
8+
{
9+
$initialStatements = [
10+
new FakeNode(),
11+
new FakeNode(),
12+
];
13+
14+
$this->fileParserMock
15+
->expects($this->once())
16+
->method('parse')
17+
->with($this->callback(
18+
function (SplFileInfo $fileInfo): bool {
19+
$this->assertSame('/path/to/file', $fileInfo->getRealPath());
20+
21+
return true;
22+
},
23+
))
24+
->willReturn([$initialStatements, []])
25+
;
26+
}
27+
28+
}
29+
?>
30+
-----
31+
<?php
32+
33+
namespace Rector\Tests\PHPUnit\CodeQuality\Rector\MethodCall\MergeWithCallableAndWillReturnRector\Fixture;
34+
35+
final class DemoFile extends PHPUnit\Framework\TestCase
36+
{
37+
public function test_it(): void
38+
{
39+
$initialStatements = [
40+
new FakeNode(),
41+
new FakeNode(),
42+
];
43+
44+
$this->fileParserMock
45+
->expects($this->once())
46+
->method('parse')
47+
->willReturnCallback(function (SplFileInfo $fileInfo) use ($initialStatements): array {
48+
$this->assertSame('/path/to/file', $fileInfo->getRealPath());
49+
50+
return [$initialStatements, []];
51+
})
52+
;
53+
}
54+
55+
}
56+
?>

0 commit comments

Comments
 (0)