Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AllowMockObjectsWhereParentClassRector\Fixture;

use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

final class SkipConstraintValidatorTestCase extends ConstraintValidatorTestCase
{
private \PHPUnit\Framework\MockObject\MockObject $someMock;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AllowMockObjectsWhereParentClassRector\Fixture;

use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

abstract class IntermediateConstraintValidatorBase extends ConstraintValidatorTestCase
{
}

final class SkipConstraintValidatorTestCaseViaIntermediate extends IntermediateConstraintValidatorBase
{
private \PHPUnit\Framework\MockObject\MockObject $someMock;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AllowMockObjectsWhereParentClassRector\Fixture;

use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
use Symfony\Component\Form\Test\TypeTestCase;

final class SomeClass extends ConstraintValidatorTestCase
final class SomeClass extends TypeTestCase
{
private \PHPUnit\Framework\MockObject\MockObject $someMock;
}
Expand All @@ -15,10 +15,10 @@ final class SomeClass extends ConstraintValidatorTestCase

namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\Class_\AllowMockObjectsWhereParentClassRector\Fixture;

use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
use Symfony\Component\Form\Test\TypeTestCase;

#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
final class SomeClass extends ConstraintValidatorTestCase
final class SomeClass extends TypeTestCase
{
private \PHPUnit\Framework\MockObject\MockObject $someMock;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ final class AllowMockObjectsWhereParentClassRector extends AbstractRector
/**
* @var string[]
*/
private const array PARENT_CLASSES = [
PHPUnitClassName::SYMFONY_CONSTRAINT_VALIDATOR_TEST_CASE,
PHPUnitClassName::SYMFONY_TYPE_TEST_CASE,
];
private const array PARENT_CLASSES = [PHPUnitClassName::SYMFONY_TYPE_TEST_CASE];

public function __construct(
private readonly TestsNodeAnalyzer $testsNodeAnalyzer,
Expand Down Expand Up @@ -75,18 +72,18 @@ public function getRuleDefinition(): RuleDefinition
[
new CodeSample(
<<<'CODE_SAMPLE'
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
use Symfony\Component\Form\Test\TypeTestCase;

final class SomeTest extends ConstraintValidatorTestCase
final class SomeTest extends TypeTestCase
{
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
use Symfony\Component\Form\Test\TypeTestCase;

#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
final class SomeTest extends ConstraintValidatorTestCase
final class SomeTest extends TypeTestCase
{
}
CODE_SAMPLE
Expand Down
2 changes: 0 additions & 2 deletions src/Enum/PHPUnitClassName.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ final class PHPUnitClassName

public const string STUB = 'PHPUnit\Framework\MockObject\Stub';

public const string SYMFONY_CONSTRAINT_VALIDATOR_TEST_CASE = 'Symfony\Component\Validator\Test\ConstraintValidatorTestCase';

public const string SYMFONY_TYPE_TEST_CASE = 'Symfony\Component\Form\Test\TypeTestCase';

/**
Expand Down
9 changes: 9 additions & 0 deletions stubs/Symfony/Component/Form/Test/TypeTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Symfony\Component\Form\Test;

use PHPUnit\Framework\TestCase;

abstract class TypeTestCase extends TestCase
{
}
Loading