Merge pull request #13780 from owncloud/cmreflector-inheritance
Additional controllermethodreflector inheritance tests
This commit is contained in:
commit
bd5440a8a3
|
@ -25,6 +25,38 @@
|
||||||
namespace OC\AppFramework\Utility;
|
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 {
|
class ControllerMethodReflectorTest extends \Test\TestCase {
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,4 +144,28 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue