|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* CakePHP Plugin : CakePHP Subdomain Routing |
|
4
|
|
|
* Copyright (c) Multidimension.al (http://multidimension.al) |
|
5
|
|
|
* Github : https://github.com/multidimension-al/cakephp-subdomains |
|
6
|
|
|
* |
|
7
|
|
|
* Licensed under The MIT License |
|
8
|
|
|
* For full copyright and license information, please see the LICENSE file |
|
9
|
|
|
* Redistributions of files must retain the above copyright notice. |
|
10
|
|
|
* |
|
11
|
|
|
* @copyright (c) Multidimension.al (http://multidimension.al) |
|
12
|
|
|
* @link https://github.com/multidimension-al/cakephp-subdomains Github |
|
13
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace Multidimensional\Subdomains\Tests\TestCase\Routing\Route; |
|
17
|
|
|
|
|
18
|
|
|
use Cake\Core\Configure; |
|
19
|
|
|
use Cake\Network\Request; |
|
20
|
|
|
use Cake\Routing\Router; |
|
21
|
|
|
use Cake\Routing\Route\Route; |
|
22
|
|
|
use Cake\TestSuite\TestCase; |
|
23
|
|
|
use Multidimensional\Subdomains\Middleware\SubdomainMiddleware; |
|
24
|
|
|
use Multidimensional\Subdomains\Routing\Route\SubdomainRoute; |
|
25
|
|
|
|
|
26
|
|
|
class SubdomainRouteTest extends TestCase |
|
27
|
|
|
{ |
|
28
|
|
|
|
|
29
|
|
|
private $subdomainRoute; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @return void |
|
33
|
|
|
*/ |
|
34
|
|
|
public function setUp() |
|
35
|
|
|
{ |
|
36
|
|
|
parent::setUp(); |
|
37
|
|
|
Configure::write('Multidimensional/Subdomains.Subdomains', ['admin']); |
|
38
|
|
|
$this->subdomainRoute = new SubdomainRoute(); |
|
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return void |
|
43
|
|
|
*/ |
|
44
|
|
|
public function tearDown() |
|
45
|
|
|
{ |
|
46
|
|
|
unset($this->subdomainRoute); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return void |
|
51
|
|
|
*/ |
|
52
|
|
|
public function testParse() |
|
53
|
|
|
{ |
|
54
|
|
|
$this->markTestIncomplete('Not implemented yet.'); |
|
55
|
|
|
/*$url = ['prefix' => 'admin', 'Controller' => 'pages', 'action' => 'index']; |
|
|
|
|
|
|
56
|
|
|
$response = $this->subdomainRoute->parse($url, ''); |
|
57
|
|
|
//assertSame |
|
58
|
|
|
$url = ['prefix' => 'users', 'Controller' => 'pages', 'action' => 'index']; |
|
59
|
|
|
$response = $this->subdomainRoute->parse($url, ''); |
|
60
|
|
|
//assertwrong*/ |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return void |
|
65
|
|
|
*/ |
|
66
|
|
|
public function testMatch() |
|
67
|
|
|
{ |
|
68
|
|
|
$this->markTestIncomplete('Not implemented yet.'); |
|
69
|
|
|
/*$url = ['prefix' => 'admin', 'Controller' => 'pages', 'action' => 'index']; |
|
|
|
|
|
|
70
|
|
|
$response = $this->subdomainRoute->match($url, ''); |
|
71
|
|
|
//assertSame |
|
72
|
|
|
$url = ['prefix' => 'users', 'Controller' => 'pages', 'action' => 'index']; |
|
73
|
|
|
$response = $this->subdomainRoute->match($url, ''); |
|
74
|
|
|
//assertwrong*/ |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
This check looks for function calls that miss required arguments.