Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Feb 6, 2019
1 parent ec68ae0 commit e540e60
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"require-dev": {
"ocramius/package-versions": "^1.3",
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^7.5|^8.0",
"symplify/easy-coding-standard": "^5.4.2",
"friendsofphp/php-cs-fixer": "^2.14",
"symplify/monorepo-builder": "^5.4.2",
Expand Down
6 changes: 4 additions & 2 deletions packages/Doctrine/src/Rector/AliasToClassRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ final class AliasToClassRector extends AbstractRector
/**
* @param string[] $aliasesToNamespaces
*/
public function __construct(array $aliasesToNamespaces, string $entityManagerClass = 'Doctrine\ORM\EntityManagerInterface')
{
public function __construct(
array $aliasesToNamespaces,
string $entityManagerClass = 'Doctrine\ORM\EntityManagerInterface'
) {
$this->aliasesToNamespaces = $aliasesToNamespaces;
$this->entityManagerClass = $entityManagerClass;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function getRectorConfiguration(): array
'$aliasesToNamespaces' => [
'App' => 'App\Entity',
],
'$entityManagerClass' => DoctrineEntityManager::class
'$entityManagerClass' => DoctrineEntityManager::class,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@

final class ReplaceCreateMethodWithoutReviewerRector extends AbstractRector
{
/**
* @var string
*/
private $reviewFactoryInterface;

public function __construct(
string $reviewFactoryInterface = 'Sylius\Component\Review\Factory\ReviewFactoryInterface'
) {
$this->reviewFactoryInterface = $reviewFactoryInterface;
}

public function getDefinition(): RectorDefinition
{
return new RectorDefinition(
Expand All @@ -38,6 +49,10 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
if (! $this->isType($node, $this->reviewFactoryInterface)) {
return null;
}

if (! $this->isName($node, 'createForSubjectWithReviewer')) {
return null;
}
Expand Down
8 changes: 6 additions & 2 deletions packages/Sylius/tests/Rector/Review/Fixture/fixture.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Rector\Sylius\Tests\Rector\Review\Fixture;

use Rector\Sylius\Tests\Rector\Review\Source\ReviewFactoryInterface;

class SomeClass
{
/**
* @var \Sylius\Component\Review\Factory\ReviewFactoryInterface
* @var ReviewFactoryInterface
*/
private $reviewFactory;

Expand All @@ -21,10 +23,12 @@ class SomeClass

namespace Rector\Sylius\Tests\Rector\Review\Fixture;

use Rector\Sylius\Tests\Rector\Review\Source\ReviewFactoryInterface;

class SomeClass
{
/**
* @var \Sylius\Component\Review\Factory\ReviewFactoryInterface
* @var ReviewFactoryInterface
*/
private $reviewFactory;

Expand Down
8 changes: 6 additions & 2 deletions packages/Sylius/tests/Rector/Review/Fixture/fixture2.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Rector\Sylius\Tests\Rector\Review\Fixture;

use Rector\Sylius\Tests\Rector\Review\Source\ReviewFactoryInterface;

class SomeClass2
{
/**
* @var \Sylius\Component\Review\Factory\ReviewFactoryInterface
* @var ReviewFactoryInterface
*/
private $reviewFactory;

Expand All @@ -21,10 +23,12 @@ class SomeClass2

namespace Rector\Sylius\Tests\Rector\Review\Fixture;

use Rector\Sylius\Tests\Rector\Review\Source\ReviewFactoryInterface;

class SomeClass2
{
/**
* @var \Sylius\Component\Review\Factory\ReviewFactoryInterface
* @var ReviewFactoryInterface
*/
private $reviewFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,11 @@ public function getRectorClass(): string
{
return ReplaceCreateMethodWithoutReviewerRector::class;
}

protected function getRectorConfiguration(): ?array
{
return [
'$reviewFactoryInterface' => \Rector\Sylius\Tests\Rector\Review\Source\ReviewFactoryInterface::class
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php declare(strict_types=1);

namespace Rector\Sylius\Tests\Rector\Review\Source;

interface ReviewFactoryInterface
{

}

0 comments on commit e540e60

Please sign in to comment.