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
e05b05a3
Commit
e05b05a3
authored
Oct 27, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added route loader tests.
parent
0a2587d2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
0 deletions
+112
-0
RouteLoaderTest.php
tests/Cases/Routing/RouteLoaderTest.php
+53
-0
routes.php
tests/Fixtures/RouteLoader/routes.php
+15
-0
panel.php
tests/Fixtures/RouteLoader/routes/admin/panel.php
+15
-0
user.php
tests/Fixtures/RouteLoader/routes/user.php
+15
-0
bootstrap.php
tests/bootstrap.php
+14
-0
No files found.
tests/Cases/Routing/RouteLoaderTest.php
0 → 100644
View file @
e05b05a3
<?php
use
Laravel\Routing\Loader
;
class
RouteLoaderTest
extends
PHPUnit_Framework_TestCase
{
public
function
test_loader_can_load_base_routes
()
{
$loader
=
$this
->
getLoader
();
$routes
=
$loader
->
load
(
'/'
);
$this
->
assertEquals
(
count
(
$routes
),
2
);
$this
->
assertTrue
(
array_key_exists
(
'GET /'
,
$routes
));
$this
->
assertTrue
(
array_key_exists
(
'GET /root'
,
$routes
));
}
public
function
test_loader_can_load_single_nested_routes
()
{
$loader
=
$this
->
getLoader
();
$routes
=
$loader
->
load
(
'user'
);
$this
->
assertEquals
(
count
(
$routes
),
4
);
$this
->
assertTrue
(
array_key_exists
(
'GET /user'
,
$routes
));
$this
->
assertTrue
(
array_key_exists
(
'GET /user/profile'
,
$routes
));
}
public
function
test_loader_can_load_multi_nested_routes
()
{
$loader
=
$this
->
getLoader
();
$routes
=
$loader
->
load
(
'admin/panel'
);
$this
->
assertEquals
(
count
(
$routes
),
4
);
$this
->
assertTrue
(
array_key_exists
(
'GET /admin/panel/show'
,
$routes
));
$this
->
assertTrue
(
array_key_exists
(
'GET /admin/panel/update'
,
$routes
));
}
public
function
test_everything_loads_all_routes
()
{
$loader
=
$this
->
getLoader
();
$routes
=
$loader
->
everything
();
$this
->
assertEquals
(
count
(
$routes
),
6
);
}
private
function
getLoader
()
{
return
new
Loader
(
FIXTURE_PATH
.
'RouteLoader/'
,
FIXTURE_PATH
.
'RouteLoader/routes/'
);
}
}
tests/Fixtures/RouteLoader/routes.php
0 → 100644
View file @
e05b05a3
<?php
return
array
(
'GET /'
=>
function
()
{
return
'GET /'
;
},
'GET /root'
=>
function
()
{
return
'GET /root'
;
},
);
\ No newline at end of file
tests/Fixtures/RouteLoader/routes/admin/panel.php
0 → 100644
View file @
e05b05a3
<?php
return
array
(
'GET /admin/panel/show'
=>
function
()
{
return
'GET /admin/panel/show'
;
},
'GET /admin/panel/update'
=>
function
()
{
return
'GET /admin/panel/update'
;
},
);
\ No newline at end of file
tests/Fixtures/RouteLoader/routes/user.php
0 → 100644
View file @
e05b05a3
<?php
return
array
(
'GET /user'
=>
function
()
{
return
'GET /user'
;
},
'GET /user/profile'
=>
function
()
{
return
'GET /user/profile'
;
},
);
\ No newline at end of file
tests/bootstrap.php
View file @
e05b05a3
...
@@ -23,4 +23,18 @@ $storage = '../storage';
...
@@ -23,4 +23,18 @@ $storage = '../storage';
$public
=
'../public'
;
$public
=
'../public'
;
/*
|--------------------------------------------------------------------------
| Test Path Constants
|--------------------------------------------------------------------------
*/
define
(
'FIXTURE_PATH'
,
realpath
(
'Fixtures'
)
.
'/'
);
/*
|--------------------------------------------------------------------------
| Bootstrap The Laravel Core
|--------------------------------------------------------------------------
*/
require
realpath
(
$laravel
)
.
'/bootstrap/core.php'
;
require
realpath
(
$laravel
)
.
'/bootstrap/core.php'
;
\ 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