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
f706ed75
Commit
f706ed75
authored
Jan 27, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made testing elegant.
parent
ae7faf1e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
16 deletions
+81
-16
example.test.php
application/tests/example.test.php
+1
-1
build.xml
build.xml
+0
-9
dependencies.php
laravel/cli/dependencies.php
+12
-2
publisher.php
laravel/cli/tasks/bundle/publisher.php
+1
-3
runner.php
laravel/cli/tasks/test/runner.php
+66
-0
stub.xml
laravel/cli/tasks/test/stub.xml
+1
-1
.gitignore
tests/application/.gitignore
+0
-0
.gitignore
tests/bundles/.gitignore
+0
-0
No files found.
tests/application
/example.test.php
→
application/tests
/example.test.php
View file @
f706ed75
build.xml
deleted
100644 → 0
View file @
ae7faf1e
<phpunit
colors=
"true"
bootstrap=
"phpunit.php"
backupGlobals=
"false"
>
<testsuites>
<testsuite
name=
"Test Suite"
>
<directory
suffix=
".test.php"
>
bundles/laravel-tests/cases
</directory>
</testsuite>
</testsuites>
</phpunit>
\ No newline at end of file
laravel/cli/dependencies.php
View file @
f706ed75
...
@@ -46,6 +46,16 @@ IoC::singleton('task: session', function()
...
@@ -46,6 +46,16 @@ IoC::singleton('task: session', function()
return
new
Tasks\Session\Manager
;
return
new
Tasks\Session\Manager
;
});
});
/**
* The "test" task is responsible for running the unit tests for
* the application, bundles, and the core framework itself.
* It provides a nice wrapper around PHPUnit.
*/
IoC
::
singleton
(
'task: test'
,
function
()
{
return
new
Tasks\Test\Runner
;
});
/**
/**
* The bundle repository is responsible for communicating with
* The bundle repository is responsible for communicating with
* the Laravel bundle sources to get information regarding any
* the Laravel bundle sources to get information regarding any
...
@@ -58,8 +68,8 @@ IoC::singleton('bundle.repository', function()
...
@@ -58,8 +68,8 @@ IoC::singleton('bundle.repository', function()
/**
/**
* The bundle publisher is responsible for publishing bundle
* The bundle publisher is responsible for publishing bundle
* assets
and tests to their correct directories within the
* assets
to their correct directories within the install,
*
application,
such as the web accessible directory.
* such as the web accessible directory.
*/
*/
IoC
::
singleton
(
'bundle.publisher'
,
function
()
IoC
::
singleton
(
'bundle.publisher'
,
function
()
{
{
...
...
laravel/cli/tasks/bundle/publisher.php
View file @
f706ed75
...
@@ -18,9 +18,7 @@ class Publisher {
...
@@ -18,9 +18,7 @@ class Publisher {
$this
->
move
(
$path
.
'public'
,
PUBLIC_PATH
.
'bundles'
.
DS
.
$bundle
);
$this
->
move
(
$path
.
'public'
,
PUBLIC_PATH
.
'bundles'
.
DS
.
$bundle
);
$this
->
move
(
$path
.
'tests'
,
TESTS_PATH
.
'cases'
.
DS
.
'bundles'
.
DS
.
$bundle
);
echo
"Assets published for bundle [
$bundle
]."
.
PHP_EOL
;
echo
"Assets and tests published for bundle [
$bundle
]."
.
PHP_EOL
;
}
}
/**
/**
...
...
laravel/cli/tasks/test/runner.php
0 → 100644
View file @
f706ed75
<?php
namespace
Laravel\CLI\Tasks\Test
;
use
Laravel\File
;
use
Laravel\Bundle
;
use
Laravel\CLI\Tasks\Task
;
class
Runner
extends
Task
{
/**
* Run all of the unit tests for the application.
*
* @return void
*/
public
function
run
()
{
$this
->
bundle
(
array
(
DEFAULT_BUNDLE
));
}
/**
* Run the tests for a given bundle.
*
* @param array $arguments
* @return void
*/
public
function
bundle
(
$arguments
=
array
())
{
// To run PHPUnit for the application, bundles, and the framework
// from one task, we'll dynamically stub PHPUnit.xml files via
// the task and point the test suite to the correct directory
// based on what was requested.
$this
->
stub
(
Bundle
::
path
(
$arguments
[
0
])
.
'tests'
);
$this
->
test
();
}
/**
* Run PHPUnit with the temporary XML configuration.
*
* @return void
*/
protected
function
test
()
{
// We'll simply fire off PHPUnit with the configuration switch
// pointing to our temporary configuration file. This allows
// us to flexibly run tests for any setup.
passthru
(
'phpunit -c '
.
BASE_PATH
.
'phpunit.xml'
);
@
unlink
(
BASE_PATH
.
'phpunit.xml'
);
}
/**
* Write a stub phpunit.xml file to the base directory.
*
* @param string $directory
* @return void
*/
protected
function
stub
(
$directory
)
{
$stub
=
File
::
get
(
SYS_PATH
.
'cli/tasks/test/stub.xml'
);
$stub
=
str_replace
(
'{{directory}}'
,
$directory
,
$stub
);
File
::
put
(
BASE_PATH
.
'phpunit.xml'
,
$stub
);
}
}
\ No newline at end of file
phpunit
.xml
→
laravel/cli/tasks/test/stub
.xml
View file @
f706ed75
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
backupGlobals=
"false"
>
backupGlobals=
"false"
>
<testsuites>
<testsuites>
<testsuite
name=
"Test Suite"
>
<testsuite
name=
"Test Suite"
>
<directory
suffix=
".test.php"
>
tests
</directory>
<directory
suffix=
".test.php"
>
{{directory}}
</directory>
</testsuite>
</testsuite>
</testsuites>
</testsuites>
</phpunit>
</phpunit>
\ No newline at end of file
tests/application/.gitignore
deleted
100644 → 0
View file @
ae7faf1e
tests/bundles/.gitignore
deleted
100644 → 0
View file @
ae7faf1e
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