-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Found a bug while going through the d11 run on project analysis (#274)
* Found a bug while going through the d11 run on project analysis * Be more defensive while refactoring entitymanager * Fix codestyle * Fix mistake with depth * Extra isntance check for phpstan * Simplify second if in findInstanceByNameInAssign * Remove disbled old rule * Is has been implemented * We need to check for ->name. We cannot use getName(node) for some weird reason * Fix codestyle, and add phpstan hint to make it happy
- Loading branch information
Showing
5 changed files
with
574 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/src/Drupal8/Rector/Deprecation/EntityManagerRector/EntityManagerRectorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal8\Rector\Deprecation\EntityManagerRector; | ||
|
||
use Iterator; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
class EntityManagerRectorTest extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @covers ::refactor | ||
* | ||
* @dataProvider provideData | ||
*/ | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
/** | ||
* @return Iterator<<string>> | ||
*/ | ||
public static function provideData(): \Iterator | ||
{ | ||
return self::yieldFilesFromDirectory(__DIR__.'/fixture'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__.'/config/configured_rule.php'; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/src/Drupal8/Rector/Deprecation/EntityManagerRector/config/configured_rule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use DrupalRector\Drupal8\Rector\Deprecation\EntityManagerRector; | ||
use DrupalRector\Tests\Rector\Deprecation\DeprecationBase; | ||
use Rector\Config\RectorConfig; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
DeprecationBase::addClass(EntityManagerRector::class, $rectorConfig); | ||
}; |
Oops, something went wrong.