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 Multidimensional\Subdomains\Middleware\SubdomainMiddleware; |
19
|
|
|
use Multidimensional\Subdomains\Routing\Route\SubdomainRoute; |
20
|
|
|
|
21
|
|
|
use Cake\Routing\Router; |
22
|
|
|
use Cake\Network\Request; |
23
|
|
|
use Cake\Routing\Route\Route; |
24
|
|
|
use Cake\TestSuite\TestCase; |
25
|
|
|
use Cake\Core\Configure; |
26
|
|
|
|
27
|
|
|
class SubdomainRouteTest extends TestCase |
28
|
|
|
{ |
29
|
|
|
|
30
|
|
|
private $SubdomainRoute; |
|
|
|
|
31
|
|
|
|
32
|
|
|
public function setUp() |
33
|
|
|
{ |
34
|
|
|
parent::setUp(); |
35
|
|
|
Configure::write('Multidimensional/Subdomains.Subdomains', ['admin']); |
36
|
|
|
$this->SubdomainRoute = new SubdomainRoute(); |
|
|
|
|
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function tearDown() |
40
|
|
|
{ |
41
|
|
|
unset($this->SubdomainRoute); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
/* public function testParse() { |
48
|
|
|
* |
49
|
|
|
* $url = ['prefix' => 'admin', 'Controller' => 'pages', 'action' => 'index']; |
50
|
|
|
* $response = $this->SubdomainRoute->parse($url, ''); |
51
|
|
|
* //assertSame |
52
|
|
|
* $url = ['prefix' => 'users', 'Controller' => 'pages', 'action' => 'index']; |
53
|
|
|
* $response = $this->SubdomainRoute->parse($url, ''); |
54
|
|
|
* //assertwrong |
55
|
|
|
* |
56
|
|
|
* } |
57
|
|
|
*/ |
58
|
|
|
/** |
59
|
|
|
* @return void |
60
|
|
|
*/ |
61
|
|
|
/* public function testMatch() { |
62
|
|
|
* |
63
|
|
|
* $url = ['prefix' => 'admin', 'Controller' => 'pages', 'action' => 'index']; |
64
|
|
|
* $response = $this->SubdomainRoute->match($url, ''); |
65
|
|
|
* //assertSame |
66
|
|
|
* $url = ['prefix' => 'users', 'Controller' => 'pages', 'action' => 'index']; |
67
|
|
|
* $response = $this->SubdomainRoute->match($url, ''); |
68
|
|
|
* //assertwrong |
69
|
|
|
* |
70
|
|
|
* } |
71
|
|
|
*/ |
72
|
|
|
} |
73
|
|
|
|
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.