mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-29 07:20:52 +00:00
72 lines
2.2 KiB
PHP
72 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Rector\Tests\BetterPhpDocParser\ValueObjectFactory;
|
|
|
|
use Iterator;
|
|
use Rector\BetterPhpDocParser\ValueObjectFactory\PhpDocNode\Doctrine\ColumnTagValueNodeFactory;
|
|
use Rector\BetterPhpDocParser\ValueObjectFactory\PhpDocNode\Symfony\SymfonyRouteTagValueNodeFactory;
|
|
use Rector\BetterPhpDocParser\ValueObjectFactory\TagValueNodeConfigurationFactory;
|
|
use Rector\Core\HttpKernel\RectorKernel;
|
|
use Symplify\PackageBuilder\Testing\AbstractKernelTestCase;
|
|
|
|
final class TagValueNodeConfigurationFactoryTest extends AbstractKernelTestCase
|
|
{
|
|
/**
|
|
* @var TagValueNodeConfigurationFactory
|
|
*/
|
|
private $tagValueNodeConfigurationFactory;
|
|
|
|
/**
|
|
* @var SymfonyRouteTagValueNodeFactory
|
|
*/
|
|
private $symfonyRouteTagValueNodeFactory;
|
|
|
|
/**
|
|
* @var ColumnTagValueNodeFactory
|
|
*/
|
|
private $columnTagValueNodeFactory;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->bootKernel(RectorKernel::class);
|
|
$this->tagValueNodeConfigurationFactory = $this->getService(TagValueNodeConfigurationFactory::class);
|
|
$this->symfonyRouteTagValueNodeFactory = $this->getService(SymfonyRouteTagValueNodeFactory::class);
|
|
$this->columnTagValueNodeFactory = $this->getService(ColumnTagValueNodeFactory::class);
|
|
}
|
|
|
|
public function test(): void
|
|
{
|
|
$symfonyRouteTagValueNode = $this->symfonyRouteTagValueNodeFactory->create();
|
|
|
|
$tagValueNodeConfiguration = $this->tagValueNodeConfigurationFactory->createFromOriginalContent(
|
|
'...',
|
|
$symfonyRouteTagValueNode
|
|
);
|
|
|
|
$this->assertSame('=', $tagValueNodeConfiguration->getArrayEqualSign());
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideData()
|
|
*/
|
|
public function testArrayColonIsNotChangedToEqual(string $originalContent): void
|
|
{
|
|
$tagValueNodeConfiguration = $this->tagValueNodeConfigurationFactory->createFromOriginalContent(
|
|
$originalContent,
|
|
$this->columnTagValueNodeFactory->create()
|
|
);
|
|
|
|
$this->assertSame(':', $tagValueNodeConfiguration->getArrayEqualSign());
|
|
}
|
|
|
|
/**
|
|
* @return Iterator<string[]>
|
|
*/
|
|
public function provideData(): Iterator
|
|
{
|
|
yield ['(type="integer", nullable=true, options={"default":0})'];
|
|
}
|
|
}
|