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\View\Helper; |
17
|
|
|
|
18
|
|
|
use Cake\Routing\Router; |
19
|
|
|
use Cake\TestSuite\TestCase; |
20
|
|
|
use Cake\View\View; |
21
|
|
|
use Multidimensional\Subdomains\View\Helper\SubdomainHtmlHelper; |
22
|
|
|
|
23
|
|
|
class SubdomainHtmlHelperTest extends TestCase |
24
|
|
|
{ |
25
|
|
|
|
26
|
|
|
public $helper = null; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @return void |
30
|
|
|
*/ |
31
|
|
|
public function setUp() |
32
|
|
|
{ |
33
|
|
|
parent::setUp(); |
34
|
|
|
$View = new View(); |
|
|
|
|
35
|
|
|
$this->helper = new SubdomainHtmlHelper($View); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return void |
40
|
|
|
*/ |
41
|
|
|
public function tearDown() |
42
|
|
|
{ |
43
|
|
|
parent::tearDown(); |
44
|
|
|
unset($this->View); |
45
|
|
|
unset($this->helper); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return void |
50
|
|
|
*/ |
51
|
|
|
public function testLink() |
52
|
|
|
{ |
53
|
|
|
/*Router::connect('/:controller/:action/*'); |
54
|
|
|
|
55
|
|
|
$result = $this->helper->link('/home'); |
56
|
|
|
$expected = ['a' => ['href' => '/home'], 'preg:/\/home/', '/a']; |
57
|
|
|
$this->assertHtml($expected, $result); |
58
|
|
|
|
59
|
|
|
$result = $this->helper->link('http://www.example.org?param1=value1¶m2=value2'); |
60
|
|
|
$expected = ['a' => ['href' => 'http://www.example.org?param1=value1&param2=value2'], 'http://www.example.org?param1=value1&param2=value2', '/a']; |
61
|
|
|
$this->assertHtml($expected, $result); |
62
|
|
|
|
63
|
|
|
$result = $this->helper->link('Google.com', 'http://www.google.com'); |
64
|
|
|
$expected = ['a' => ['href' => 'http://www.google.com'], 'Google.com', '/a']; |
65
|
|
|
$this->assertHtml($expected, $result); |
66
|
|
|
|
67
|
|
|
$result = $this->helper->link('http://admin.example.com'); |
68
|
|
|
$expected = ['a' => ['href' => 'http://admin.example.com'], 'http://admin.example.com', '/a']; |
69
|
|
|
$this->assertHtml($expected, $result); |
70
|
|
|
|
71
|
|
|
Router::scope('/', ['prefix' => 'admin'], |
72
|
|
|
function ($routes) { |
73
|
|
|
$routes->fallbacks(); |
74
|
|
|
} |
75
|
|
|
); |
76
|
|
|
|
77
|
|
|
$result = $this->helper->link('Admin Panel', ['prefix' => 'admin', 'controller' => 'test', 'action' => 'index']); |
78
|
|
|
$expected = ['a' => ['href' => 'http://admin.example.com'], 'http://admin.example.com', '/a'];*/ |
79
|
|
|
|
80
|
|
|
$this->markTestIncomplete('Not implemented yet.'); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
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.