Merge branch 'master' of github.com:espocrm/espocrm
This commit is contained in:
@@ -330,4 +330,66 @@ class RouteTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals($result, $this->reflection->invokeMethod('unify'));
|
||||
}
|
||||
|
||||
public function testUnifyCase4ModuleRoutesWithRewrites()
|
||||
{
|
||||
// prepare path
|
||||
$paths = [
|
||||
'corePath' => $this->filesPath.'/testCase4/application/Espo/Resources/routes.json',
|
||||
'modulePath' => $this->filesPath.'/testCase4/application/Espo/Modules/{*}/Resources/routes.json',
|
||||
'customPath' => $this->filesPath.'/testCase4/custom/Espo/Custom/Resources/routes.json',
|
||||
];
|
||||
|
||||
$this->reflection->setProperty('paths', $paths);
|
||||
|
||||
$this->objects['metadata']
|
||||
->expects($this->once())
|
||||
->method('getModuleList')
|
||||
->will($this->returnValue(array(
|
||||
'Crm',
|
||||
'Test',
|
||||
'TestExt'
|
||||
)));
|
||||
|
||||
// prepare expected result
|
||||
$result = [
|
||||
[
|
||||
'route' => '/Activities/:scope/:id/:name',
|
||||
'method' => 'get',
|
||||
'params' => [
|
||||
'controller' => 'TestExt',
|
||||
'action' => 'list',
|
||||
'scope' => ':scope',
|
||||
'id' => ':id',
|
||||
'name' => ':name',
|
||||
],
|
||||
],
|
||||
[
|
||||
'route' => '/Activities',
|
||||
'method' => 'get',
|
||||
'params' => [
|
||||
'controller' => 'TestExt',
|
||||
'action' => 'testExtListCalendarEvents'
|
||||
],
|
||||
],
|
||||
[
|
||||
'route' => '/Product',
|
||||
'method' => 'get',
|
||||
'params' => [
|
||||
'controller' => 'Product',
|
||||
'action' => 'listProduct'
|
||||
],
|
||||
],
|
||||
[
|
||||
'route' => '/Test',
|
||||
'method' => 'get',
|
||||
'params' => [
|
||||
'controller' => 'Test',
|
||||
'action' => 'testAction'
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->assertEquals($result, $this->reflection->invokeMethod('unify'));
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
[
|
||||
{
|
||||
"route": "/Activities/:scope/:id/:name",
|
||||
"method": "get",
|
||||
"params": {
|
||||
"controller": "Activities",
|
||||
"action": "list",
|
||||
"scope": ":scope",
|
||||
"id": ":id",
|
||||
"name": ":name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"route": "/Activities",
|
||||
"method": "get",
|
||||
"params": {
|
||||
"controller": "Activities",
|
||||
"action": "listCalendarEvents"
|
||||
}
|
||||
},
|
||||
{
|
||||
"route": "/Product",
|
||||
"method": "get",
|
||||
"params": {
|
||||
"controller": "Product",
|
||||
"action": "listProduct"
|
||||
}
|
||||
}
|
||||
]
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"route": "/Activities/:scope/:id/:name",
|
||||
"method": "get",
|
||||
"params": {
|
||||
"controller": "Test",
|
||||
"action": "list",
|
||||
"scope": ":scope",
|
||||
"id": ":id",
|
||||
"name": ":name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"route": "/Test",
|
||||
"method": "get",
|
||||
"params": {
|
||||
"controller": "Test",
|
||||
"action": "testAction"
|
||||
}
|
||||
}
|
||||
]
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"route": "/Activities/:scope/:id/:name",
|
||||
"method": "get",
|
||||
"params": {
|
||||
"controller": "TestExt",
|
||||
"action": "list",
|
||||
"scope": ":scope",
|
||||
"id": ":id",
|
||||
"name": ":name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"route": "/Activities",
|
||||
"method": "get",
|
||||
"params": {
|
||||
"controller": "TestExt",
|
||||
"action": "testExtListCalendarEvents"
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user