Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testWithRouteAttribute test case #1479

Closed
wants to merge 5 commits into from
Closed
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
35 changes: 35 additions & 0 deletions tests/Issues/Issue6861/Fixture/fixture.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Rector\Core\Tests\Issues\Issue6861\Fixture;

use Doctrine\DBAL\DBALException;

class Fixture
{
/**
* @throws DBALException
*/
#[Route(path: '/top/', name: 'top')]
public function testWithRouteAttribute(){
// something throws the exception deep down here....
}
}

?>
-----
<?php

namespace Rector\Core\Tests\Issues\Issue6861\Fixture;

class Fixture
{
/**
* @throws \Doctrine\DBAL\Exception
*/
#[Route(path: '/top/', name: 'top')]
public function testWithRouteAttribute(){
// something throws the exception deep down here....
}
}

?>
33 changes: 33 additions & 0 deletions tests/Issues/Issue6861/RenameClassRectorBeforeAttributeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Rector\Core\Tests\Issues\Issue6861;

use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

final class RenameClassRectorBeforeAttributeTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}

/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}
14 changes: 14 additions & 0 deletions tests/Issues/Issue6861/config/configured_rule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

use Rector\Renaming\Rector\Name\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->configure([
'Doctrine\DBAL\DBALException' => 'Doctrine\DBAL\Exception',
]);
};