|
|
@@ -1,7 +1,41 @@
|
|
|
+<%
|
|
|
+/**
|
|
|
+ * Tests bootstrap file
|
|
|
+ *
|
|
|
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
|
|
+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
+ *
|
|
|
+ * Licensed under The MIT License
|
|
|
+ * For full copyright and license information, please see the LICENSE.txt
|
|
|
+ * Redistributions of files must retain the above copyright notice.
|
|
|
+ *
|
|
|
+ * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
+ * @link http://cakephp.org CakePHP(tm) Project
|
|
|
+ * @since 3.0.0
|
|
|
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
|
|
|
+ */
|
|
|
+%>
|
|
|
<?php
|
|
|
/**
|
|
|
* Test suite bootstrap for <%= $plugin %>.
|
|
|
+ *
|
|
|
+ * 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.
|
|
|
*/
|
|
|
-// Customize this to be a relative path for embedded plugins.
|
|
|
-// For standalone plugins, this should point at a CakePHP installation.
|
|
|
-require '<%= $root %>/config/bootstrap.php';
|
|
|
+$findRoot = function($root) {
|
|
|
+ do {
|
|
|
+ $lastRoot = $root;
|
|
|
+ $root = dirname($root);
|
|
|
+ if (is_dir($root . '/vendor/cakephp/cakephp')) {
|
|
|
+ return $root;
|
|
|
+ }
|
|
|
+ } while($root !== $lastRoot);
|
|
|
+
|
|
|
+ throw new Exception("Cannot find the root of the application, unable to run tests");
|
|
|
+};
|
|
|
+$root = $findRoot(__FILE__);
|
|
|
+unset($findRoot);
|
|
|
+
|
|
|
+chdir($root);
|
|
|
+require $root . '/config/bootstrap.php';
|