Permalink
Browse files

reflection: add test for class that inherits from class 'object'

  • Loading branch information...
vlastavesely committed Oct 1, 2017
1 parent 4a77729 commit 8fbaaa6efde9def56622da75557859a4f26c9bb7
@@ -4,24 +4,44 @@
use ApiGen\Reflection\Parser\Parser;
use ApiGen\Reflection\ReflectionStorage;
use ApiGen\Reflection\Tests\Parser\Source\ChildOfObject;
use ApiGen\Reflection\Tests\Parser\Source\Object;
use ApiGen\Tests\AbstractContainerAwareTestCase;
final class ObjectClassTest extends AbstractContainerAwareTestCase
{
public function test(): void
/**
* @var Parser
*/
private $parser;
/**
* @var ReflectionStorage
*/
private $reflectionStorage;
public function setUp(): void
{
/** @var Parser $parser */
$parser = $this->container->get(Parser::class);
$parser->parseFilesAndDirectories([__DIR__ . '/Source']);
$this->parser = $this->container->get(Parser::class);
$this->parser->parseFilesAndDirectories([__DIR__ . '/Source']);
/** @var ReflectionStorage */
$reflectionStorage = $this->container->get(ReflectionStorage::class);
$this->reflectionStorage = $this->container->get(ReflectionStorage::class);
}
$classReflections = $reflectionStorage->getClassReflections();
$this->assertCount(3, $classReflections);
public function testDirect(): void
{
$classReflections = $this->reflectionStorage->getClassReflections();
$this->assertCount(4, $classReflections);
$this->assertArrayHasKey(Object::class, $classReflections);
$this->assertSame(Object::class, $classReflections[Object::class]->getName());
}
public function testGetParent(): void
{
$classReflections = $this->reflectionStorage->getClassReflections();
$classReflection = $classReflections[ChildOfObject::class]->getParentClass();
$this->assertSame(Object::class, $classReflection->getName());
}
}
@@ -14,7 +14,7 @@ public function test(): void
$this->parser->parseFilesAndDirectories([__DIR__ . '/Source']);
$classReflections = $this->reflectionStorage->getClassReflections();
$this->assertCount(3, $classReflections);
$this->assertCount(4, $classReflections);
$classReflection = $classReflections[ClassWithParentFromAnotherSource::class];
@@ -0,0 +1,7 @@
<?php declare(strict_types=1);
namespace ApiGen\Reflection\Tests\Parser\Source;
final class ChildOfObject extends Object
{
}
@@ -2,6 +2,6 @@
namespace ApiGen\Reflection\Tests\Parser\Source;
final class Object
class Object
{
}

0 comments on commit 8fbaaa6

Please sign in to comment.