Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-07-08 19:23:06 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2020-07-08 20:52:45 +0300
commit3f447b9c8c52c371aee52a51dfcbeb2e91a85992 (patch)
tree0dfc3b1f70a7d1b03bb588a578c875555eb8990f /tests
parent32927fd4701fdd395f929a37e483575841f412dc (diff)
Fix supporting defaults for routes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/Routing/RoutingTest.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php
index c078023e653..4712d2f30eb 100644
--- a/tests/lib/AppFramework/Routing/RoutingTest.php
+++ b/tests/lib/AppFramework/Routing/RoutingTest.php
@@ -419,7 +419,7 @@ class RoutingTest extends \Test\TestCase {
array $defaults=[]
) {
$route = $this->getMockBuilder(Route::class)
- ->onlyMethods(['method', 'setDefault', 'requirements', 'defaults'])
+ ->onlyMethods(['method', 'requirements', 'defaults'])
->disableOriginalConstructor()
->getMock();
$route
@@ -428,12 +428,6 @@ class RoutingTest extends \Test\TestCase {
->with($this->equalTo($verb))
->willReturn($route);
- $route
- ->expects($this->once())
- ->method('setDefault')
- ->with('caller', ['app1', $controllerName, $actionName])
- ->willReturn($route);
-
if (count($requirements) > 0) {
$route
->expects($this->once())
@@ -442,13 +436,15 @@ class RoutingTest extends \Test\TestCase {
->willReturn($route);
}
- if (count($defaults) > 0) {
- $route
- ->expects($this->once())
- ->method('defaults')
- ->with($this->equalTo($defaults))
- ->willReturn($route);
- }
+ $route->expects($this->once())
+ ->method('defaults')
+ ->with($this->callback(function (array $def) use ($defaults, $controllerName, $actionName) {
+ $defaults['caller'] = ['app1', $controllerName, $actionName];
+
+ $this->assertEquals($defaults, $def);
+ return true;
+ }))
+ ->willReturn($route);
return $route;
}