/** * It should throw a helpful exception when an annotation is not recognized. * * @expectedException InvalidArgumentException * @expectedExceptionMessage Unrecognized annotation @Foobar, valid PHPBench annotations: @BeforeMethods, */ public function testUsefulException() { $hierarchy = 'test'; $reflection = new ReflectionClass(); $reflection->class = 'TestChild'; $reflection->comment = <<<EOT /** * @Foobar("foo") */ EOT; $hierarchy = new ReflectionHierarchy(); $hierarchy->addReflectionClass($reflection); $this->driver->getMetadataForHierarchy($hierarchy); }
/** * It should allow a custom subject pattern. */ public function testCustomSubjectPattern() { $reflection = new ReflectionClass(); $reflection->class = 'Test'; $method = new ReflectionMethod(); $method->reflectionClass = $reflection; $method->class = 'Test'; $method->name = 'foo_bar_Foo'; $reflection->methods[$method->name] = $method; $hierarchy = new ReflectionHierarchy(); $hierarchy->addReflectionClass($reflection); $metadata = $this->createDriver('foo_bar_')->getMetadataForHierarchy($hierarchy); $this->assertCount(1, $metadata->getSubjects()); $this->assertArrayHasKey('foo_bar_Foo', $metadata->getSubjects()); }