PhpBench\Tests\Unit\Benchmark\Metadata\Driver\AnnotationDriverTest::testMetadataExtend PHP Метод

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

It should extend values of previous annotations when the "extend" option is true.
public testMetadataExtend ( )
    public function testMetadataExtend()
    {
        $reflection = new ReflectionClass();
        $reflection->class = 'TestChild';
        $reflection->comment = <<<'EOT'
    /**
     * @Groups({"group1"})
     */
EOT;
        $hierarchy = new ReflectionHierarchy();
        $hierarchy->addReflectionClass($reflection);
        $method = new ReflectionMethod();
        $method->reflectionClass = $reflection;
        $method->class = 'Test';
        $method->name = 'benchFoo';
        $method->comment = <<<'EOT'
    /**
     * @Groups({"group2", "group3"}, extend=true)
     */
EOT;
        $reflection->methods[$method->name] = $method;
        $metadata = $this->createDriver()->getMetadataForHierarchy($hierarchy);
        $subjects = $metadata->getSubjects();
        $this->assertCount(1, $subjects);
        $subjectOne = array_shift($subjects);
        $this->assertEquals(['group1', 'group2', 'group3'], $subjectOne->getGroups());
    }