File tree Expand file tree Collapse file tree 6 files changed +163
-0
lines changed
tests/lib/Rule/Internal/RemoveLegacyClassAliasRector Expand file tree Collapse file tree 6 files changed +163
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php /** @noinspection ALL */
2+
3+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
4+
5+ class MyAnotherLegacyClass
6+ {
7+ public function foo (): void
8+ {
9+ }
10+ }
11+
12+ class_alias (MyAnotherLegacyClass::class, 'eZ\Some\Namespace\MyAnotherLegacyClass ' );
13+
14+ ?>
15+ -----
16+ <?php /** @noinspection ALL */
17+
18+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
19+
20+ class MyAnotherLegacyClass
21+ {
22+ public function foo (): void
23+ {
24+ }
25+ }
26+
27+ ?>
Original file line number Diff line number Diff line change 1+ <?php /** @noinspection ALL */
2+
3+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
4+
5+ class MyIbexaClass
6+ {
7+ public function foo (): void
8+ {
9+ }
10+ }
11+
12+ class_alias (MyIbexaClass::class, 'Ibexa\Platform\MyAnotherLegacyClass ' );
13+
14+ ?>
15+ -----
16+ <?php /** @noinspection ALL */
17+
18+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
19+
20+ class MyIbexaClass
21+ {
22+ public function foo (): void
23+ {
24+ }
25+ }
26+
27+ ?>
Original file line number Diff line number Diff line change 1+ <?php /** @noinspection ALL */
2+
3+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
4+
5+ class MyLegacyClass
6+ {
7+ public function foo (): void
8+ {
9+ }
10+ }
11+
12+ class_alias (MyLegacyClass::class, 'EzSystems\Some\Namespace\MyLegacyClass ' );
13+
14+ ?>
15+ -----
16+ <?php /** @noinspection ALL */
17+
18+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
19+
20+ class MyLegacyClass
21+ {
22+ public function foo (): void
23+ {
24+ }
25+ }
26+
27+ ?>
Original file line number Diff line number Diff line change 1+ <?php /** @noinspection ALL */
2+
3+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
4+
5+ class ThirdPartyClass
6+ {
7+ public function foo (): void
8+ {
9+ }
10+ }
11+
12+ // this is not ours, should remain
13+ class_alias (ThirdPartyClass::class, 'ThirdPartyVendor\Accidental\Ibexa\Collsion ' );
14+
15+ ?>
16+ -----
17+ <?php /** @noinspection ALL */
18+
19+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector \Fixture ;
20+
21+ class ThirdPartyClass
22+ {
23+ public function foo (): void
24+ {
25+ }
26+ }
27+
28+ // this is not ours, should remain
29+ class_alias (ThirdPartyClass::class, 'ThirdPartyVendor\Accidental\Ibexa\Collsion ' );
30+
31+ ?>
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * @copyright Copyright (C) Ibexa AS. All rights reserved.
5+ * @license For full copyright and license information view LICENSE file distributed with this source code.
6+ */
7+ declare (strict_types=1 );
8+
9+ namespace Ibexa \Rector \Tests \Rule \Internal \RemoveLegacyClassAliasRector ;
10+
11+ use PHPUnit \Framework \Attributes \DataProvider ;
12+ use Rector \Testing \PHPUnit \AbstractRectorTestCase ;
13+
14+ /**
15+ * @covers \Ibexa\Rector\Rule\Internal\RemoveLegacyClassAliasRector
16+ */
17+ final class RemoveLegacyClassAliasRectorTest extends AbstractRectorTestCase
18+ {
19+ /**
20+ * @throws \Rector\Exception\ShouldNotHappenException
21+ */
22+ #[DataProvider('provideData ' )]
23+ public function test (string $ filePath ): void
24+ {
25+ $ this ->doTestFile ($ filePath );
26+ }
27+
28+ public static function provideData (): \Iterator
29+ {
30+ return self ::yieldFilesFromDirectory (__DIR__ . '/Fixture ' );
31+ }
32+
33+ public function provideConfigFilePath (): string
34+ {
35+ return __DIR__ . '/config/configured_rule.php ' ;
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * @copyright Copyright (C) Ibexa AS. All rights reserved.
5+ * @license For full copyright and license information view LICENSE file distributed with this source code.
6+ */
7+ declare (strict_types=1 );
8+
9+ use Ibexa \Rector \Rule \Internal \RemoveLegacyClassAliasRector ;
10+ use Rector \Config \RectorConfig ;
11+
12+ return static function (RectorConfig $ rectorConfig ): void {
13+ $ rectorConfig ->rule (RemoveLegacyClassAliasRector::class);
14+ };
You can’t perform that action at this time.
0 commit comments