clean up base directory of phpunit stuff.
This commit is contained in:
@@ -39,6 +39,19 @@ class Bundle {
|
||||
* @return array
|
||||
*/
|
||||
public static function detect($path)
|
||||
{
|
||||
$bundles = static::search($path);
|
||||
|
||||
return array_merge($bundles, require path('base').'bundles.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect all of the installed bundles from disk.
|
||||
*
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
protected static function search($path)
|
||||
{
|
||||
$bundles = array();
|
||||
|
||||
|
||||
45
laravel/cli/tasks/test/phpunit.php
Normal file
45
laravel/cli/tasks/test/phpunit.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Laravel - A PHP Framework For Web Artisans
|
||||
*
|
||||
* @package Laravel
|
||||
* @version 3.0.0
|
||||
* @author Taylor Otwell <taylorotwell@gmail.com>
|
||||
* @link http://laravel.com
|
||||
*/
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Define the directory separator for the environment.
|
||||
// --------------------------------------------------------------
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Set the core Laravel path constants.
|
||||
// --------------------------------------------------------------
|
||||
require 'paths.php';
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Override the application paths when testing the core.
|
||||
// --------------------------------------------------------------
|
||||
$config = file_get_contents('phpunit.xml');
|
||||
|
||||
if (strpos($config, 'laravel-tests') !== false)
|
||||
{
|
||||
$path = path('bundle').'laravel-tests'.DS;
|
||||
|
||||
set_path('app', $path.'application'.DS);
|
||||
|
||||
set_path('bundle', $path.'bundles'.DS);
|
||||
|
||||
set_path('storage', $path.'storage'.DS);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Bootstrap the Laravel core.
|
||||
// --------------------------------------------------------------
|
||||
require path('sys').'core.php';
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Start the default bundle.
|
||||
// --------------------------------------------------------------
|
||||
Bundle::start(DEFAULT_BUNDLE);
|
||||
@@ -89,11 +89,45 @@ class Runner extends Task {
|
||||
*/
|
||||
protected function stub($directory)
|
||||
{
|
||||
$stub = File::get(path('sys').'cli/tasks/test/stub.xml');
|
||||
$path = path('sys').'cli/tasks/test/';
|
||||
|
||||
$stub = str_replace('{{directory}}', $directory, $stub);
|
||||
$stub = File::get($path.'stub.xml');
|
||||
|
||||
// The PHPUnit bootstrap file contains several items that are swapped
|
||||
// at test time. This allows us to point PHPUnit at a few different
|
||||
// locations depending on what the develoepr wants to test.
|
||||
foreach (array('bootstrap', 'directory') as $item)
|
||||
{
|
||||
$stub = $this->{"swap_{$item}"}($stub, $path, $directory);
|
||||
}
|
||||
|
||||
File::put(path('base').'phpunit.xml', $stub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap the bootstrap file in the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @param string $path
|
||||
* @param string $directory
|
||||
* @return string
|
||||
*/
|
||||
protected function swap_bootstrap($stub, $path, $directory)
|
||||
{
|
||||
return str_replace('{{bootstrap}}', $path.'phpunit.php', $stub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap the directory in the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @param string $path
|
||||
* @param string $directory
|
||||
* @return string
|
||||
*/
|
||||
protected function swap_directory($stub, $path, $directory)
|
||||
{
|
||||
return str_replace('{{directory}}', $directory, $stub);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<phpunit colors="true"
|
||||
bootstrap="phpunit.php"
|
||||
bootstrap="{{bootstrap}}"
|
||||
backupGlobals="false">
|
||||
<testsuites>
|
||||
<testsuite name="Test Suite">
|
||||
|
||||
Reference in New Issue
Block a user