Completed
Push — master ( c2606f...ff2953 )
by Cheren
08:57
created

IntegrationTestCase::_getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * CakeCMS Core
4
 *
5
 * This file is part of the of the simple cms based on CakePHP 3.
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @package   Core
10
 * @license   MIT
11
 * @copyright MIT License http://www.opensource.org/licenses/mit-license.php
12
 * @link      https://github.com/CakeCMS/Core".
13
 * @author    Sergey Kalistratov <[email protected]>
14
 */
15
16
namespace Core\TestSuite;
17
18
use Cake\Utility\Hash;
19
use Core\Plugin;
20
use Cake\TestSuite\IntegrationTestCase as CakeIntegrationTestCase;
21
22
/**
23
 * Class IntegrationTestCase
24
 *
25
 * @package Core\TestSuite
26
 */
27
class IntegrationTestCase extends CakeIntegrationTestCase
28
{
29
30
    /**
31
     * Default plugin.
32
     *
33
     * @var string
34
     */
35
    protected $_plugin = 'Core';
36
37
    /**
38
     * Default url.
39
     *
40
     * @var array
41
     */
42
    protected $_url = [
43
        'prefix' => null,
44
        'plugin' => 'Core',
45
        'action' => '',
46
    ];
47
48
    /**
49
     * Setup the test case, backup the static object values so they can be restored.
50
     * Specifically backs up the contents of Configure and paths in App if they have
51
     * not already been backed up.
52
     *
53
     * @return void
54
     */
55
    public function setUp()
56
    {
57
        parent::setUp();
58
        Plugin::load('Core', [
59
            'path'      => ROOT . DS,
60
            'bootstrap' => true,
61
            'routes'    => true,
62
        ]);
63
64
        $this->_url['plugin'] = $this->_plugin;
65
    }
66
67
    /**
68
     * Clears the state used for requests.
69
     *
70
     * @return void
71
     */
72
    public function tearDown()
73
    {
74
        parent::tearDown();
75
        Plugin::unload('Core');
76
        unset($this->_url);
77
    }
78
79
    /**
80
     * Prepare url.
81
     *
82
     * @param array $url
83
     * @return array
84
     */
85
    protected function _getUrl(array $url = [])
86
    {
87
        return Hash::merge($this->_url, $url);
88
    }
89
}
90