for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace phpDocumentor\Reflection;
use PHPUnit\Framework\TestCase;
final class DocblockLexerTest extends TestCase
{
/**
* @dataProvider docblockProvider
*/
public function testLexer(string $input, array $expectedTokens) : void
$lexer = new DocBlockLexer();
$lexer->setInput($input);
$lexer->moveNext();
$tokens = [];
while (true) {
if (!$lexer->lookahead) {
break;
}
$tokens[] = $lexer->token['type'];
$this->assertSame($expectedTokens, $tokens);
public function docblockProvider()
return [
'empty single line docbloc' => [
<<<DOCBLOCK
/** */
DOCBLOCK
,
[
DocBlockLexer::T_START,
DocBlockLexer::T_END
]
],
'empty docbloc' => [
DocBlockLexer::T_CRLF,
'docblock with summary' => [
* My docblock summary.
DocBlockLexer::T_LINE_START,
DocBlockLexer::T_WHITESPACE,
DocBlockLexer::T_STRING,
DocBlockLexer::T_DOT,
'docblock simple tag' => [
* @var
DocBlockLexer::T_AT,
'docblock specialized tags' => [
* @var:unittest
DocBlockLexer::T_COLON,
];