Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
bd5440a8
Commit
bd5440a8
authored
10 years ago
by
Lukas Reschke
Browse files
Options
Downloads
Plain Diff
Merge pull request #13780 from owncloud/cmreflector-inheritance
Additional controllermethodreflector inheritance tests
parents
8e8acad5
81836ccc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/appframework/utility/ControllerMethodReflectorTest.php
+58
-2
58 additions, 2 deletions
...ib/appframework/utility/ControllerMethodReflectorTest.php
with
58 additions
and
2 deletions
tests/lib/appframework/utility/ControllerMethodReflectorTest.php
+
58
−
2
View file @
bd5440a8
...
...
@@ -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'
));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment