Skip to content

Commit

Permalink
fix: all test execution, fixes #44
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Feb 7, 2025
1 parent 68af632 commit fd1a09b
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\Rector\AbstractRector;
use Rector\StaticTypeMapper\StaticTypeMapper;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

class AddArgumentToClassWithoutDefaultRector extends AbstractRector implements ConfigurableRectorInterface
{
public function __construct(private readonly StaticTypeMapper $staticTypeMapper)
{
}

/**
* @var AddArgumentToClassWithoutDefault[]
*/
Expand Down Expand Up @@ -74,7 +79,7 @@ public function refactor(Node $node): ?Node
{
$hasChanged = false;

foreach ($node as $method) {
foreach ($node->stmts as $method) {
if ($method instanceof ClassMethod) {
foreach ($this->configuration as $config) {
if (!$this->isObjectType($node, $config->getObjectType())) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/v65/AddBanAllToReverseProxyRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function refactor(Node $node)
$node->stmts[] = $builderFactory
->method('banAll')
->makePublic()
->addStmt($builderFactory->methodCall($builderFactory->var('this'), 'ban', $builderFactory->args([new Array_([new String_('/')])])))
->addStmt(new Node\Expr\MethodCall(new Node\Expr\Variable('this'), 'ban', [new Node\Arg(new Array_([]))]))
->getNode()
;

Expand Down
6 changes: 3 additions & 3 deletions src/Rule/v65/ThumbnailGenerateSingleToMultiGenerateRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public function refactor(Node $node): ?Node
}

$node->name = new Name('generate');
$node->args[0] = new New_(new Name(MediaCollection::class), [
new Array_([$node->args[0]]),
]);
$node->args[0] = new Node\Arg(new New_(new Name\FullyQualified(MediaCollection::class), [
new Node\Arg(new Array_([new Node\Expr\ArrayItem($node->args[0]->value)])),
]));

return $node;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Shopware\Storefront\Framework\Cache\ReverseProxy;

class AbstractReverseProxyGateway {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Frosh\Rector\Tests\Rector\Class\InterfaceReplacedWithAbstractClassRector;

use Frosh\Rector\Tests\Rector\AbstractFroshRectorTestCase;

/**
* @internal
*/
final class InterfaceReplacedWithAbstractClassRectorTest extends AbstractFroshRectorTestCase
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Frosh\Rector\Tests\Rector\ClassMethod\AddArgumentToClassWithoutDefaultValueRector;

use Frosh\Rector\Tests\Rector\AbstractFroshRectorTestCase;

/**
* @internal
*
* @coversNothing
*/
class AddArgumentToClassWithoutDefaultValueRectorTest extends AbstractFroshRectorTestCase
{
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
*
* @coversNothing
*/
final class AddBanAllToReverseProxyRector extends AbstractFroshRectorTestCase
final class AddBanAllToReverseProxyRectorTest extends AbstractFroshRectorTestCase
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ class Test extends \Shopware\Storefront\Framework\Cache\ReverseProxy\AbstractRev
<?php
namespace Frosh\Rector\Tests\Rector\v65\AddBanAllToReverseProxyRector\Fixture;

use Shopware\Storefront\Framework\Cache\ReverseProxy\AbstractReverseProxyGateway;
class Test extends AbstractReverseProxyGateway
class Test extends \Shopware\Storefront\Framework\Cache\ReverseProxy\AbstractReverseProxyGateway
{
public function banAll()
{
$this->ban(['/']);
$this->ban([]);
}
}
?>
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ $thumbnail->generateThumbnails($media, $context);
<?php
namespace Frosh\Rector\Tests\Rector\v65\RedisConnectionFactoryCreateRector\Fixture;

use Shopware\Core\Content\Media\MediaCollection;
use Shopware\Core\Content\Media\Thumbnail\ThumbnailService;

$thumbnail = new ThumbnailService();

$thumbnail->generate(new MediaCollection([$media]), $context);
$thumbnail->generate(new \Shopware\Core\Content\Media\MediaCollection([$media]), $context);
?>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
*
* @coversNothing
*/
final class ThumbnailGenerateSingleToMultiGenerate extends AbstractFroshRectorTestCase
final class ThumbnailGenerateSingleToMultiGenerateTest extends AbstractFroshRectorTestCase
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
*
* @coversNothing
*/
class AddEntityNameToEntityExtension extends AbstractFroshRectorTestCase
class AddEntityNameToEntityExtensionTest extends AbstractFroshRectorTestCase
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
*
* @covers \Frosh\Rector\Rule\v67\AddLoggerToScheduledTaskConstructorRector
*/
class AddLoggerToScheduledTaskConstructorRector extends AbstractFroshRectorTestCase
class AddLoggerToScheduledTaskConstructorRectorTest extends AbstractFroshRectorTestCase
{
}

0 comments on commit fd1a09b

Please sign in to comment.