SubdomainHtmlHelperTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 60
rs 10
c 3
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A tearDown() 0 6 1
B testLink() 0 31 1
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/*');
0 ignored issues
show
Unused Code Comprehensibility introduced by
61% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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&param2=value2');
60
        $expected = ['a' => ['href' => 'http://www.example.org?param1=value1&amp;param2=value2'], 'http://www.example.org?param1=value1&amp;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