. * */ namespace OC\AppFramework\Utility; class ControllerMethodReflectorTest extends \PHPUnit_Framework_TestCase { /** * @Annotation */ public function testReadAnnotation(){ $reader = new ControllerMethodReflector(); $reader->reflect( '\OC\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotation' ); $this->assertTrue($reader->hasAnnotation('Annotation')); } /** * @Annotation * @param test */ public function testReadAnnotationNoLowercase(){ $reader = new ControllerMethodReflector(); $reader->reflect( '\OC\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotationNoLowercase' ); $this->assertTrue($reader->hasAnnotation('Annotation')); $this->assertFalse($reader->hasAnnotation('param')); } /** * @Annotation * @param int $test */ public function testReadTypeIntAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( '\OC\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeIntAnnotations' ); $this->assertEquals('int', $reader->getType('test')); } /** * @Annotation * @param double $test */ public function testReadTypeDoubleAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( '\OC\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeDoubleAnnotations' ); $this->assertEquals('double', $reader->getType('test')); } public function arguments($arg, $arg2) {} public function testReflectParameters() { $reader = new ControllerMethodReflector(); $reader->reflect( '\OC\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments' ); $this->assertEquals(array('arg', 'arg2'), $reader->getParameters()); } public function arguments2($arg) {} public function testReflectParameters2() { $reader = new ControllerMethodReflector(); $reader->reflect( '\OC\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments2' ); $this->assertEquals(array('arg',), $reader->getParameters()); } }