Skip to content

Commit 73e1ed6

Browse files
committed
add fixtures to handle
1 parent a0186ba commit 73e1ed6

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AllowMockObjectsWithoutExpectationsAttributeRector\Fixture;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
final class SkipIfAllTestsMethodsDefineExpectations extends TestCase
8+
{
9+
private \PHPUnit\Framework\MockObject\MockObject $someMock;
10+
11+
protected function setUp(): void
12+
{
13+
$this->someMock = $this->createMock(\stdClass::class);
14+
}
15+
16+
public function testOne()
17+
{
18+
$this->someMock->method('doSomething')->willReturn('value');
19+
}
20+
21+
public function testTwo()
22+
{
23+
$this->someMock->method('doSomethingElse')->willReturn('another value');
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AllowMockObjectsWithoutExpectationsAttributeRector\Fixture;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
final class SkipIfMockNotUsedIn2TestMethods extends TestCase
8+
{
9+
private \PHPUnit\Framework\MockObject\MockObject $someMock;
10+
11+
protected function setUp(): void
12+
{
13+
$this->someMock = $this->createMock(\stdClass::class);
14+
}
15+
16+
public function testOne()
17+
{
18+
}
19+
20+
public function testTwo()
21+
{
22+
23+
}
24+
}

rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWithoutExpectationsAttributeRector/Fixture/some_class.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ final class SomeClass extends TestCase
4343

4444
public function testOne()
4545
{
46+
$this->someMock->method('doSomething')->willReturn('value');
4647
}
4748

4849
public function testTwo()
4950
{
50-
5151
}
5252
}
5353

0 commit comments

Comments
 (0)