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
baac975f
Commit
baac975f
authored
Feb 01, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added route task.
parent
10ee41f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
dependencies.php
laravel/cli/dependencies.php
+10
-0
route.php
laravel/cli/tasks/route.php
+56
-0
No files found.
laravel/cli/dependencies.php
View file @
baac975f
...
@@ -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 route task is responsible for calling routes within the
* application and dumping the result. This allows for simple
* testing of APIs and JSON based applications.
*/
IoC
::
singleton
(
'task: route'
,
function
()
{
return
new
Tasks\Route
;
});
/**
/**
* The "test" task is responsible for running the unit tests for
* The "test" task is responsible for running the unit tests for
* the application, bundles, and the core framework itself.
* the application, bundles, and the core framework itself.
...
...
laravel/cli/tasks/route.php
0 → 100644
View file @
baac975f
<?php
namespace
Laravel\CLI\Tasks
;
use
Laravel\URI
;
use
Laravel\Request
;
use
Laravel\Routing\Router
;
class
Route
extends
Task
{
/**
* Execute a route and dump the result.
*
* @param array $arguments
* @return void
*/
public
function
run
(
$arguments
=
array
())
{
if
(
!
count
(
$arguments
)
==
2
)
{
throw
new
\Exception
(
"Please specify a request method and URI."
);
}
// First we'll set the request method and URI in the $_SERVER array,
// which will allow the framework to retrieve the proper method
// and URI using the normal URI and Request classes.
$_SERVER
[
'REQUEST_METHOD'
]
=
strtoupper
(
$arguments
[
0
]);
$_SERVER
[
'REQUEST_URI'
]
=
$arguments
[
1
];
$this
->
route
();
echo
PHP_EOL
;
}
/**
* Dump the results of the currently established route.
*
* @return void
*/
protected
function
route
()
{
// We'll call the router using the method and URI specified by
// the developer on the CLI. If a route is found, we will not
// run the filters, but simply dump the result.
$route
=
Router
::
route
(
Request
::
method
(),
URI
::
current
());
if
(
!
is_null
(
$route
))
{
var_dump
(
$route
->
response
());
}
else
{
echo
'404: Not Found'
;
}
}
}
\ 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