2021-03-22 17:52:24 +01:00
|
|
|
<?php declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
|
|
|
|
2022-02-02 01:38:03 +01:00
|
|
|
use Iterator;
|
2021-03-22 17:52:24 +01:00
|
|
|
use PHPStan\PhpDocParser\Ast\Node;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
final class NodePrintTest extends TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providePhpDocData
|
|
|
|
*/
|
|
|
|
public function testPrintMultiline(Node $node, string $expectedPrinted): void
|
|
|
|
{
|
|
|
|
$this->assertSame($expectedPrinted, (string) $node);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-02 01:38:03 +01:00
|
|
|
public function providePhpDocData(): Iterator
|
2021-03-22 17:52:24 +01:00
|
|
|
{
|
|
|
|
yield [
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode('It works'),
|
|
|
|
]),
|
|
|
|
'/**
|
|
|
|
* It works
|
2021-08-31 10:08:22 +02:00
|
|
|
*/',
|
|
|
|
];
|
|
|
|
|
|
|
|
yield [
|
|
|
|
new PhpDocNode([
|
|
|
|
new PhpDocTextNode('It works'),
|
|
|
|
new PhpDocTextNode(''),
|
|
|
|
new PhpDocTextNode('with empty lines'),
|
|
|
|
]),
|
|
|
|
'/**
|
|
|
|
* It works
|
|
|
|
*
|
|
|
|
* with empty lines
|
2021-03-22 17:52:24 +01:00
|
|
|
*/',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|