-
-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathDoctrineTest.php
More file actions
38 lines (31 loc) · 1.39 KB
/
DoctrineTest.php
File metadata and controls
38 lines (31 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Rector\Tests\BetterPhpDocParser\PhpDocInfo\PhpDocInfoPrinter;
use Iterator;
use Nette\Utils\FileSystem;
use PhpParser\Node\Stmt\Class_;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Tests\BetterPhpDocParser\PhpDocInfo\PhpDocInfoPrinter\Source\Doctrine\CaseSensitive;
use Rector\Tests\BetterPhpDocParser\PhpDocInfo\PhpDocInfoPrinter\Source\Doctrine\IndexInTable;
use Rector\Tests\BetterPhpDocParser\PhpDocInfo\PhpDocInfoPrinter\Source\Doctrine\Short;
final class DoctrineTest extends AbstractPhpDocInfoPrinterTestCase
{
#[DataProvider('provideDataClass')]
public function testClass(string $docFilePath, string $className): void
{
$class = new Class_($className);
$docComment = FileSystem::read($docFilePath);
$phpDocInfo = $this->createPhpDocInfoFromDocCommentAndNode($docComment, $class);
$printedPhpDocInfo = $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo);
$this->assertSame($docComment, $printedPhpDocInfo);
}
/**
* @return Iterator<array<array<int, mixed>, mixed>>
*/
public static function provideDataClass(): Iterator
{
yield [__DIR__ . '/Source/Doctrine/index_in_table.txt', IndexInTable::class];
yield [__DIR__ . '/Source/Doctrine/case_sensitive.txt', CaseSensitive::class];
yield [__DIR__ . '/Source/Doctrine/short.txt', Short::class];
}
}