Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
41ff7af2
Commit
41ff7af2
authored
Jul 13, 2012
by
Franz Liedke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change inner workings of test runner to use different bootstrap file when testing the core.
parent
9bd87551
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
33 deletions
+51
-33
phpunit.php
laravel/cli/tasks/test/phpunit.php
+0
-24
runner.php
laravel/cli/tasks/test/runner.php
+19
-9
phpunit.php
laravel/tests/phpunit.php
+32
-0
No files found.
laravel/cli/tasks/test/phpunit.php
View file @
41ff7af2
<?php
<?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 the directory separator for the environment.
...
@@ -18,22 +10,6 @@ define('DS', DIRECTORY_SEPARATOR);
...
@@ -18,22 +10,6 @@ define('DS', DIRECTORY_SEPARATOR);
// --------------------------------------------------------------
// --------------------------------------------------------------
require
'paths.php'
;
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.
// Bootstrap the Laravel core.
// --------------------------------------------------------------
// --------------------------------------------------------------
...
...
laravel/cli/tasks/test/runner.php
View file @
41ff7af2
...
@@ -7,6 +7,15 @@ use Laravel\CLI\Tasks\Task;
...
@@ -7,6 +7,15 @@ use Laravel\CLI\Tasks\Task;
class
Runner
extends
Task
{
class
Runner
extends
Task
{
/**
* The base directory where the tests will be executed.
*
* A phpunit.xml should also be stored in that directory.
*
* @var string
*/
protected
$base_path
;
/**
/**
* Run all of the unit tests for the application.
* Run all of the unit tests for the application.
*
*
...
@@ -26,7 +35,8 @@ class Runner extends Task {
...
@@ -26,7 +35,8 @@ class Runner extends Task {
*/
*/
public
function
core
()
public
function
core
()
{
{
$this
->
stub
(
path
(
'sys'
)
.
'tests/cases'
);
$this
->
base_path
=
path
(
'sys'
)
.
'tests'
.
DS
;
$this
->
stub
(
path
(
'sys'
)
.
'tests'
.
DS
.
'cases'
);
$this
->
test
();
$this
->
test
();
}
}
...
@@ -44,6 +54,8 @@ class Runner extends Task {
...
@@ -44,6 +54,8 @@ class Runner extends Task {
$bundles
=
Bundle
::
names
();
$bundles
=
Bundle
::
names
();
}
}
$this
->
base_path
=
path
(
'sys'
)
.
'cli'
.
DS
.
'tasks'
.
DS
.
'test'
.
DS
;
foreach
(
$bundles
as
$bundle
)
foreach
(
$bundles
as
$bundle
)
{
{
// To run PHPUnit for the application, bundles, and the framework
// To run PHPUnit for the application, bundles, and the framework
...
@@ -67,9 +79,9 @@ class Runner extends Task {
...
@@ -67,9 +79,9 @@ class Runner extends Task {
protected
function
test
()
protected
function
test
()
{
{
// We'll simply fire off PHPUnit with the configuration switch
// We'll simply fire off PHPUnit with the configuration switch
// pointing to our
temporary
configuration file. This allows
// pointing to our
requested
configuration file. This allows
// us to flexibly run tests for any setup.
// us to flexibly run tests for any setup.
$path
=
path
(
'base'
)
.
'phpunit.xml'
;
$path
=
'phpunit.xml'
;
// fix the spaced directories problem when using the command line
// fix the spaced directories problem when using the command line
// strings with spaces inside should be wrapped in quotes.
// strings with spaces inside should be wrapped in quotes.
...
@@ -97,7 +109,7 @@ class Runner extends Task {
...
@@ -97,7 +109,7 @@ class Runner extends Task {
// locations depending on what the developer wants to test.
// locations depending on what the developer wants to test.
foreach
(
array
(
'bootstrap'
,
'directory'
)
as
$item
)
foreach
(
array
(
'bootstrap'
,
'directory'
)
as
$item
)
{
{
$stub
=
$this
->
{
"swap_
{
$item
}
"
}(
$stub
,
$
path
,
$
directory
);
$stub
=
$this
->
{
"swap_
{
$item
}
"
}(
$stub
,
$directory
);
}
}
File
::
put
(
path
(
'base'
)
.
'phpunit.xml'
,
$stub
);
File
::
put
(
path
(
'base'
)
.
'phpunit.xml'
,
$stub
);
...
@@ -107,24 +119,22 @@ class Runner extends Task {
...
@@ -107,24 +119,22 @@ class Runner extends Task {
* Swap the bootstrap file in the stub.
* Swap the bootstrap file in the stub.
*
*
* @param string $stub
* @param string $stub
* @param string $path
* @param string $directory
* @param string $directory
* @return string
* @return string
*/
*/
protected
function
swap_bootstrap
(
$stub
,
$
path
,
$
directory
)
protected
function
swap_bootstrap
(
$stub
,
$directory
)
{
{
return
str_replace
(
'{{bootstrap}}'
,
$path
.
'phpunit.php'
,
$stub
);
return
str_replace
(
'{{bootstrap}}'
,
$
this
->
base_
path
.
'phpunit.php'
,
$stub
);
}
}
/**
/**
* Swap the directory in the stub.
* Swap the directory in the stub.
*
*
* @param string $stub
* @param string $stub
* @param string $path
* @param string $directory
* @param string $directory
* @return string
* @return string
*/
*/
protected
function
swap_directory
(
$stub
,
$
path
,
$
directory
)
protected
function
swap_directory
(
$stub
,
$directory
)
{
{
return
str_replace
(
'{{directory}}'
,
$directory
,
$stub
);
return
str_replace
(
'{{directory}}'
,
$directory
,
$stub
);
}
}
...
...
laravel/tests/phpunit.php
0 → 100644
View file @
41ff7af2
<?php
// --------------------------------------------------------------
// 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.
// --------------------------------------------------------------
$path
=
path
(
'sys'
)
.
'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.
// --------------------------------------------------------------
Laravel\Bundle
::
start
(
DEFAULT_BUNDLE
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment