/** * Test if the `getAnnotationList` method return a list of all annotations in a doc comment. */ public function testGetAnnotationList() { $class = new ReflectionClass('\\com\\mohiva\\test\\resources\\common\\lang\\AnnotationTest'); $this->assertInstanceOf('com\\mohiva\\common\\lang\\AnnotationList', $class->getAnnotationList()); }
/** * Test if the `DoubleParameterAnnotation` class has correct values. */ public function testDoubleParameterAnnotation() { $class = 'com\\mohiva\\test\\resources\\common\\lang\\annotations\\DoubleParameter'; $reflection = new ReflectionClass(self::TEST_CLASS); $iterator = $reflection->getAnnotationList()->getAnnotations(DoubleParameter::NAME)->getIterator(); /* @var \com\mohiva\test\resources\common\lang\annotations\DoubleParameter $annotation */ $annotation = $iterator->current(); $this->assertInstanceOf($class, $annotation); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam1()); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam2()); $this->assertEquals($annotation->getParam1(), "pa\"r\"am1\""); $this->assertEquals($annotation->getParam2(), "param\"2"); $iterator->next(); $annotation = $iterator->current(); $this->assertInstanceOf($class, $annotation); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam1()); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam2()); $this->assertEquals($annotation->getParam1(), "pa\\'r\\'am1\""); $this->assertEquals($annotation->getParam2(), "param\\'2"); $iterator->next(); $annotation = $iterator->current(); $this->assertInstanceOf($class, $annotation); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam1()); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam2()); $this->assertEquals($annotation->getParam1(), "pa'r'am1"); $this->assertEquals($annotation->getParam2(), 'param"2'); $iterator->next(); $annotation = $iterator->current(); $this->assertInstanceOf($class, $annotation); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam1()); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam2()); $this->assertEquals($annotation->getParam1(), 'pa\'r\'am1\''); $this->assertEquals($annotation->getParam2(), 'param\'2'); $iterator->next(); $annotation = $iterator->current(); $this->assertInstanceOf($class, $annotation); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam1()); $this->assertInternalType(PHPUnitType::TYPE_STRING, $annotation->getParam2()); $this->assertEquals($annotation->getParam1(), 'pa\\"r\\"am1\''); $this->assertEquals($annotation->getParam2(), 'param\\"2'); }