diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-02-12 18:34:07 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-02-12 18:34:07 +0100 |
commit | bd5440a8a38e7960a382866a233ed313663fe50f (patch) | |
tree | 9d003bd2ac383ee8a61b7625189b94d56e830130 /tests | |
parent | 8e8acad550e45dfd7b17efca2fcb41582cd09e36 (diff) | |
parent | 81836ccc7e19289d401ab9def6b8f467ed6e20f5 (diff) | |
download | nextcloud-server-bd5440a8a38e7960a382866a233ed313663fe50f.tar.gz nextcloud-server-bd5440a8a38e7960a382866a233ed313663fe50f.zip |
Merge pull request #13780 from owncloud/cmreflector-inheritance
Additional controllermethodreflector inheritance tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/appframework/utility/ControllerMethodReflectorTest.php | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php index cd6bd57da4c..c513e23cd6b 100644 --- a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php +++ b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php @@ -25,6 +25,38 @@ namespace OC\AppFramework\Utility; +class BaseController { + + /** + * @Annotation + */ + public function test(){} + + /** + * @Annotation + */ + public function test2(){} + + /** + * @Annotation + */ + public function test3(){} + +} + +class MiddleController extends BaseController { + + /** + * @NoAnnotation + */ + public function test2() {} + + public function test3() {} + +} + +class EndController extends MiddleController {} + class ControllerMethodReflectorTest extends \Test\TestCase { @@ -96,7 +128,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { 'arguments' ); - $this->assertEquals(array('arg' => null, 'arg2' => 'hi'), $reader->getParameters()); + $this->assertEquals(array('arg' => null, 'arg2' => 'hi'), $reader->getParameters()); } @@ -108,8 +140,32 @@ class ControllerMethodReflectorTest extends \Test\TestCase { 'arguments2' ); - $this->assertEquals(array('arg' => null), $reader->getParameters()); + $this->assertEquals(array('arg' => null), $reader->getParameters()); + } + + + public function testInheritance() { + $reader = new ControllerMethodReflector(); + $reader->reflect('OC\AppFramework\Utility\EndController', 'test'); + + $this->assertTrue($reader->hasAnnotation('Annotation')); } + public function testInheritanceOverride() { + $reader = new ControllerMethodReflector(); + $reader->reflect('OC\AppFramework\Utility\EndController', 'test2'); + + $this->assertTrue($reader->hasAnnotation('NoAnnotation')); + $this->assertFalse($reader->hasAnnotation('Annotation')); + } + + + public function testInheritanceOverrideNoDocblock() { + $reader = new ControllerMethodReflector(); + $reader->reflect('OC\AppFramework\Utility\EndController', 'test3'); + + $this->assertFalse($reader->hasAnnotation('Annotation')); + } + } |