BetterReflectionTest\SourceLocator\Type\EvaledCodeSourceLocatorTest::testCanReflectEvaledTrait PHP Метод

testCanReflectEvaledTrait() публичный Метод

    public function testCanReflectEvaledTrait()
    {
        $traitName = uniqid('foo');
        eval('trait ' . $traitName . ' {function foo(){}}');
        $locator = new EvaledCodeSourceLocator();
        $reflection = $locator->locateIdentifier($this->getMockReflector(), new Identifier($traitName, new IdentifierType(IdentifierType::IDENTIFIER_CLASS)));
        $this->assertInstanceOf(EvaledLocatedSource::class, $reflection->getLocatedSource());
        $this->assertStringMatchesFormat('%Atrait%A' . $traitName . '%A', $reflection->getLocatedSource()->getSource());
    }