phpdoc-parser/tests/PHPStan/Ast/PhpDoc/NodePrintTest.php
2022-02-08 12:41:11 +01:00

47 lines
754 B
PHP

<?php declare(strict_types = 1);
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
use Iterator;
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);
}
public function providePhpDocData(): Iterator
{
yield [
new PhpDocNode([
new PhpDocTextNode('It works'),
]),
'/**
* It works
*/',
];
yield [
new PhpDocNode([
new PhpDocTextNode('It works'),
new PhpDocTextNode(''),
new PhpDocTextNode('with empty lines'),
]),
'/**
* It works
*
* with empty lines
*/',
];
}
}