Skip to content

Commit 9a41b64

Browse files
committed
add tests for AddTestsVoidReturnTypeWhereNoReturnRector
1 parent 21199b3 commit 9a41b64

File tree

7 files changed

+167
-0
lines changed

7 files changed

+167
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Rector\PHPUnit\Tests\AddTestsVoidReturnTypeWhereNoReturn;
6+
7+
use Iterator;
8+
use PHPUnit\Framework\Attributes\DataProvider;
9+
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
10+
11+
final class AddTestsVoidReturnTypeWhereNoReturnTest extends AbstractRectorTestCase
12+
{
13+
#[DataProvider('provideData')]
14+
public function test(string $filePath): void
15+
{
16+
$this->doTestFile($filePath);
17+
}
18+
19+
public static function provideData(): Iterator
20+
{
21+
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture');
22+
}
23+
24+
public function provideConfigFilePath(): string
25+
{
26+
return __DIR__ . '/config/add_tests_void_return_type_where_no_return.php';
27+
}
28+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class SomeClassTest extends TestCase
6+
{
7+
#[\PHPUnit\Framework\Attributes\Test]
8+
public function shouldDoStuff()
9+
{
10+
}
11+
}
12+
13+
?>
14+
-----
15+
<?php
16+
17+
use PHPUnit\Framework\TestCase;
18+
19+
class SomeClassTest extends TestCase
20+
{
21+
#[\PHPUnit\Framework\Attributes\Test]
22+
public function shouldDoStuff(): void
23+
{
24+
}
25+
}
26+
27+
?>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class SomeClassTest extends TestCase
6+
{
7+
/** @test */
8+
public function shouldDoStuff()
9+
{
10+
}
11+
}
12+
13+
?>
14+
-----
15+
<?php
16+
17+
use PHPUnit\Framework\TestCase;
18+
19+
class SomeClassTest extends TestCase
20+
{
21+
/** @test */
22+
public function shouldDoStuff(): void
23+
{
24+
}
25+
}
26+
27+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class SomeClassTest extends TestCase
6+
{
7+
public function test_should_do_stuff()
8+
{
9+
}
10+
}
11+
12+
?>
13+
-----
14+
<?php
15+
16+
use PHPUnit\Framework\TestCase;
17+
18+
class SomeClassTest extends TestCase
19+
{
20+
public function test_should_do_stuff(): void
21+
{
22+
}
23+
}
24+
25+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class SomeClassTest extends TestCase
6+
{
7+
public function testShouldDoStuff()
8+
{
9+
}
10+
}
11+
12+
?>
13+
-----
14+
<?php
15+
16+
use PHPUnit\Framework\TestCase;
17+
18+
class SomeClassTest extends TestCase
19+
{
20+
public function testShouldDoStuff(): void
21+
{
22+
}
23+
}
24+
25+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class SomeClassTest extends TestCase
6+
{
7+
private function testShouldDoStuff()
8+
{
9+
}
10+
}
11+
12+
?>
13+
-----
14+
<?php
15+
16+
use PHPUnit\Framework\TestCase;
17+
18+
class SomeClassTest extends TestCase
19+
{
20+
private function testShouldDoStuff()
21+
{
22+
}
23+
}
24+
25+
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\TypeDeclaration\Rector\Class_\AddTestsVoidReturnTypeWhereNoReturnRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rule(AddTestsVoidReturnTypeWhereNoReturnRector::class);
10+
};

0 commit comments

Comments
 (0)