Skip to content

Commit ced40b9

Browse files
committed
Clean travis config.
1 parent 7e320e2 commit ced40b9

File tree

4 files changed

+77
-29
lines changed

4 files changed

+77
-29
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"cakephp/cakephp": "~3.0"
99
},
1010
"require-dev": {
11-
"cakephp/cakephp": "~3.0",
1211
"phpunit/phpunit": "*"
1312
},
1413
"autoload": {

phpunit.xml.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
3-
colors="true"
4-
stopOnFailure="false"
5-
bootstrap="./tests/bootstrap.php"
3+
bootstrap="./tests/bootstrap.php"
4+
colors="true"
5+
stopOnFailure="false"
66
>
77

88
<testsuites>

tests/bootstrap.php

Lines changed: 53 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,55 @@
11
<?php
2-
/**
3-
* Test suite bootstrap.
4-
*
5-
* This function is used to find the location of CakePHP whether CakePHP
6-
* has been installed as a dependency of the plugin, or the plugin is itself
7-
* installed as a dependency of an application.
8-
*/
9-
$findRoot = function ($root) {
10-
do {
11-
$lastRoot = $root;
12-
$root = dirname($root);
13-
if (is_dir($root . '/vendor/cakephp/cakephp')) {
14-
return $root;
15-
}
16-
} while ($root !== $lastRoot);
17-
throw new Exception("Cannot find the root of the application, unable to run tests");
18-
};
19-
$root = $findRoot(__FILE__);
20-
unset($findRoot);
21-
chdir($root);
22-
if (file_exists($root . '/config/bootstrap.php')) {
23-
require $root . '/config/bootstrap.php';
24-
return;
2+
// @codingStandardsIgnoreFile
3+
use Cake\Cache\Cache;
4+
use Cake\Core\Configure;
5+
use Cake\Core\Plugin;
6+
use Cake\Datasource\ConnectionManager;
7+
use Cake\I18n\I18n;
8+
9+
require_once 'vendor/autoload.php';
10+
11+
// Path constants to a few helpful things.
12+
if (!defined('DS')) {
13+
define('DS', DIRECTORY_SEPARATOR);
2514
}
26-
require $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';
27-
\Cake\Core\Plugin::load('Bootstrap', ['path' => dirname(dirname(__FILE__)) . DS]);
15+
16+
define('ROOT', dirname(__DIR__) . DS);
17+
define('CAKE_CORE_INCLUDE_PATH', ROOT . 'vendor' . DS . 'cakephp' . DS . 'cakephp');
18+
define('CORE_PATH', ROOT . 'vendor' . DS . 'cakephp' . DS . 'cakephp' . DS);
19+
define('CAKE', CORE_PATH . 'src' . DS);
20+
define('TESTS', ROOT . 'tests');
21+
define('APP', ROOT . 'tests' . DS . 'test_app' . DS);
22+
define('APP_DIR', 'app');
23+
define('WEBROOT_DIR', 'webroot');
24+
define('WWW_ROOT', dirname(APP) . DS . 'webroot' . DS);
25+
define('TMP', sys_get_temp_dir() . DS);
26+
define('CONFIG', APP . 'config' . DS);
27+
define('CACHE', TMP);
28+
define('LOGS', TMP);
29+
30+
//@codingStandardsIgnoreStart
31+
@mkdir(LOGS);
32+
@mkdir(SESSIONS);
33+
@mkdir(CACHE);
34+
@mkdir(CACHE . 'views');
35+
@mkdir(CACHE . 'models');
36+
37+
require_once CORE_PATH . 'config/bootstrap.php';
38+
date_default_timezone_set('UTC');
39+
mb_internal_encoding('UTF-8');
40+
41+
Cache::config([
42+
'_cake_core_' => [
43+
'engine' => 'File',
44+
'prefix' => 'cake_core_',
45+
'serialize' => true
46+
],
47+
'_cake_model_' => [
48+
'engine' => 'File',
49+
'prefix' => 'cake_model_',
50+
'serialize' => true
51+
]
52+
]);
53+
54+
55+
Plugin::load('Search', ['path' => ROOT]);

tests/test_app/config/routes.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* CakePHP : Rapid Development Framework (http://cakephp.org)
4+
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
5+
*
6+
* Licensed under The MIT License
7+
* For full copyright and license information, please see the LICENSE.txt
8+
* Redistributions of files must retain the above copyright notice.
9+
*
10+
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11+
* @link http://cakephp.org CakePHP Project
12+
* @since 2.0.0
13+
* @license http://www.opensource.org/licenses/mit-license.php MIT License
14+
*/
15+
use Cake\Routing\Router;
16+
Router::extensions('json');
17+
Router::scope('/', function ($routes) {
18+
$routes->connect('/', ['controller' => 'pages', 'action' => 'display', 'home']);
19+
$routes->connect('/some_alias', ['controller' => 'tests_apps', 'action' => 'some_method']);
20+
$routes->fallbacks();
21+
});

0 commit comments

Comments
 (0)