Skip to content

Commit

Permalink
[Reflection] add __DIR__ and __CLASS_ test [closes #972]
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 17, 2017
1 parent 4734440 commit 3fb6d2a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/Reflection/tests/Reflection/Common/ReflectionTest.php
Expand Up @@ -34,4 +34,16 @@ public function testClassConstant(): void
$methodReflection = $this->reflection->getMethods()['getClass'];
$this->assertFalse($methodReflection->returnsReference());
}

public function testBetterReflectionsConstantsParsing(): void
{
$constants = $this->reflection->getConstants();
$this->assertCount(2, $constants);

$thisDirectoryConstant = $constants['THIS_DIRECTORY'];
$this->assertSame(__DIR__ . '/Source', $thisDirectoryConstant->getValue());

$thisClassConstant = $constants['THIS_CLASS_METHOD'];
$this->assertSame(CommonReflection::class . '::methodWithArgs', $thisClassConstant->getValue());
}
}
Expand Up @@ -9,6 +9,16 @@
*/
class CommonReflection
{
/**
* @var string
*/
public const THIS_CLASS_METHOD = __CLASS__ . '::methodWithArgs';

/**
* @var string
*/
public const THIS_DIRECTORY = __DIR__;

/**
* Send a POST request.
*
Expand Down

0 comments on commit 3fb6d2a

Please sign in to comment.