Skip to content

Commit 292071e

Browse files
committed
[phpunit 12] Add ExplicitMockExpectsCallRector
1 parent db0d1d5 commit 292071e

File tree

13 files changed

+184
-9
lines changed

13 files changed

+184
-9
lines changed

rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/both_annotation_and_attribute_exists.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ final class BothAnnotationAndAttributeExists extends TestCase
4545
}
4646
}
4747

48-
?>
48+
?>

rules-tests/CodeQuality/Rector/MethodCall/WithCallbackIdenticalToStandaloneAssertsRector/Fixture/on_self.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ final class OnSelf extends TestCase
4444
}
4545
}
4646

47-
?>
47+
?>

rules-tests/CodeQuality/Rector/StmtsAwareInterface/DeclareStrictTypesTestsRector/Fixture/without_namespace.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ class WithoutNamespaceTest extends \PHPUnit\Framework\TestCase
3838
}
3939
}
4040

41-
?>
41+
?>

rules-tests/PHPUnit120/Rector/MethodCall/AssertIsTypeMethodCallRector/AssertIsTypeMethodCallRectorTest.php renamed to rules-tests/PHPUnit120/Rector/Class_/AssertIsTypeMethodCallRector/AssertIsTypeMethodCallRectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\AssertIsTypeMethodCallRector;
5+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AssertIsTypeMethodCallRector;
66

77
use Iterator;
88
use PHPUnit\Framework\Attributes\DataProvider;

rules-tests/PHPUnit120/Rector/MethodCall/AssertIsTypeMethodCallRector/Fixture/fixture.php.inc renamed to rules-tests/PHPUnit120/Rector/Class_/AssertIsTypeMethodCallRector/Fixture/fixture.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\AssertIsTypeMethodCallRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AssertIsTypeMethodCallRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

@@ -31,7 +31,7 @@ final class Fixture extends TestCase
3131
-----
3232
<?php
3333

34-
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\AssertIsTypeMethodCallRector\Fixture;
34+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AssertIsTypeMethodCallRector\Fixture;
3535

3636
use PHPUnit\Framework\TestCase;
3737

rules-tests/PHPUnit120/Rector/MethodCall/AssertIsTypeMethodCallRector/Fixture/static_fixture.php.inc renamed to rules-tests/PHPUnit120/Rector/Class_/AssertIsTypeMethodCallRector/Fixture/static_fixture.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\AssertIsTypeMethodCallRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AssertIsTypeMethodCallRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

@@ -31,7 +31,7 @@ final class StaticFixture extends TestCase
3131
-----
3232
<?php
3333

34-
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\AssertIsTypeMethodCallRector\Fixture;
34+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AssertIsTypeMethodCallRector\Fixture;
3535

3636
use PHPUnit\Framework\TestCase;
3737

rules-tests/PHPUnit120/Rector/MethodCall/AssertIsTypeMethodCallRector/config/configured_rule.php renamed to rules-tests/PHPUnit120/Rector/Class_/AssertIsTypeMethodCallRector/config/configured_rule.php

File renamed without changes.
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\PHPUnit120\Rector\MethodCall\ExplicitMockExpectsCallRector;
6+
7+
use Iterator;
8+
use PHPUnit\Framework\Attributes\DataProvider;
9+
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
10+
11+
final class ExplicitMockExpectsCallRectorTest 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/configured_rule.php';
27+
}
28+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\ExplicitMockExpectsCallRector\Fixture;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
final class Fixture extends TestCase
8+
{
9+
public function testMethod(): void
10+
{
11+
$someClass = $this->createMock(\stdClass::class);
12+
13+
$someClass->method('some');
14+
}
15+
}
16+
17+
?>
18+
-----
19+
<?php
20+
21+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\ExplicitMockExpectsCallRector\Fixture;
22+
23+
use PHPUnit\Framework\TestCase;
24+
25+
final class Fixture extends TestCase
26+
{
27+
public function testMethod(): void
28+
{
29+
$someClass = $this->createMock(\stdClass::class);
30+
31+
$someClass->expects($this->atLeastOnce())->method('some');
32+
}
33+
}
34+
35+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\PHPUnit\PHPUnit120\Rector\MethodCall\ExplicitMockExpectsCallRector;
7+
8+
return RectorConfig::configure()
9+
->withRules([ExplicitMockExpectsCallRector::class]);

0 commit comments

Comments
 (0)