-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ishanvyas22/tests
Tests added
- Loading branch information
Showing
6 changed files
with
226 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,67 @@ | ||
<?php | ||
/** | ||
* Test suite bootstrap for AssetMix. | ||
* | ||
* This function is used to find the location of CakePHP whether CakePHP | ||
* has been installed as a dependency of the plugin, or the plugin is itself | ||
* installed as a dependency of an application. | ||
*/ | ||
$findRoot = function ($root) { | ||
do { | ||
$lastRoot = $root; | ||
$root = dirname($root); | ||
if (is_dir($root . '/vendor/cakephp/cakephp')) { | ||
return $root; | ||
} | ||
} while ($root !== $lastRoot); | ||
use Cake\Cache\Cache; | ||
use Cake\Core\Configure; | ||
use Cake\Core\Plugin; | ||
use Cake\I18n\I18n; | ||
|
||
throw new Exception("Cannot find the root of the application, unable to run tests"); | ||
}; | ||
$root = $findRoot(__FILE__); | ||
unset($findRoot); | ||
require_once 'vendor/autoload.php'; | ||
|
||
chdir($root); | ||
// Path constants to a few helpful things. | ||
define('ROOT', dirname(__DIR__) . DS); | ||
define('CAKE_CORE_INCLUDE_PATH', ROOT . 'vendor' . DS . 'cakephp' . DS . 'cakephp'); | ||
define('CORE_PATH', ROOT . 'vendor' . DS . 'cakephp' . DS . 'cakephp' . DS); | ||
define('CAKE', CORE_PATH . 'src' . DS); | ||
define('TESTS', ROOT . 'tests'); | ||
define('APP', ROOT . 'tests' . DS . 'test_app' . DS); | ||
define('COMPARE_PATH', ROOT . 'tests' . DS . 'test_files' . DS); | ||
define('APP_DIR', 'test_app'); | ||
define('WEBROOT_DIR', 'webroot'); | ||
define('TMP', sys_get_temp_dir() . DS); | ||
define('CONFIG', APP . 'config' . DS); | ||
define('WWW_ROOT', APP . 'webroot' . DS); | ||
define('CACHE', TMP); | ||
define('LOGS', TMP); | ||
|
||
require_once $root . '/vendor/autoload.php'; | ||
require_once CORE_PATH . 'config/bootstrap.php'; | ||
|
||
/** | ||
* Define fallback values for required constants and configuration. | ||
* To customize constants and configuration remove this require | ||
* and define the data required by your plugin here. | ||
*/ | ||
require_once $root . '/vendor/cakephp/cakephp/tests/bootstrap.php'; | ||
date_default_timezone_set('UTC'); | ||
mb_internal_encoding('UTF-8'); | ||
|
||
if (file_exists($root . '/config/bootstrap.php')) { | ||
require $root . '/config/bootstrap.php'; | ||
Configure::write('debug', true); | ||
Configure::write('App', [ | ||
'namespace' => 'TestApp', | ||
'encoding' => 'UTF-8', | ||
'base' => false, | ||
'baseUrl' => false, | ||
'dir' => 'src', | ||
'webroot' => 'webroot', | ||
'wwwRoot' => WWW_ROOT, | ||
'fullBaseUrl' => 'http://localhost', | ||
'imageBaseUrl' => 'img/', | ||
'jsBaseUrl' => 'js/', | ||
'cssBaseUrl' => 'css/', | ||
'paths' => [ | ||
'plugins' => [APP . 'plugins' . DS], | ||
'templates' => [APP . 'src' . DS . 'Template' . DS] | ||
] | ||
]); | ||
|
||
return; | ||
} | ||
Cache::setConfig([ | ||
'_cake_core_' => [ | ||
'engine' => 'File', | ||
'prefix' => 'cake_core_', | ||
'serialize' => true | ||
], | ||
'_cake_model_' => [ | ||
'engine' => 'File', | ||
'prefix' => 'cake_model_', | ||
'serialize' => true | ||
], | ||
'default' => [ | ||
'engine' => 'File', | ||
'prefix' => 'default_', | ||
'serialize' => true | ||
], | ||
]); | ||
|
||
Plugin::getCollection()->add(new \AssetMix\Plugin()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"/js/app.js": "/js/app.js?id=f059fcadc7eba26be9ae", | ||
"/css/main.css": "/css/main.css?id=9c4259d5465e35535a2a" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"/js/app.js": "/js/app.js", | ||
"/css/main.css": "/css/main.css" | ||
} |