1
0
Fork 0

Add test case in DefinitionResolverTest for 'define' node

pull/363/head
Stephan Unverwerth 2017-04-24 11:03:35 +02:00
parent 0c77049dff
commit e7d1a60273
1 changed files with 14 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class DefinitionResolverTest extends TestCase
$this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $type); $this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $type);
} }
public function testGetDefinedFqn() public function testGetDefinedFqnForIncompleteDefine()
{ {
// define('XXX') (only one argument) must not introduce a new symbol // define('XXX') (only one argument) must not introduce a new symbol
$parser = new Parser; $parser = new Parser;
@ -48,4 +48,17 @@ class DefinitionResolverTest extends TestCase
$this->assertNull($fqn); $this->assertNull($fqn);
} }
public function testGetDefinedFqnForDefine()
{
$parser = new Parser;
$stmts = $parser->parse("<?php\ndefine('TEST_DEFINE', true);");
$stmts[0]->setAttribute('ownerDocument', new MockPhpDocument);
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$fqn = $definitionResolver->getDefinedFqn($stmts[0]);
$this->assertEquals('TEST_DEFINE', $fqn);
}
} }