Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
c463a6e1
Commit
c463a6e1
authored
Jun 18, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some unit tests
parent
e29c91ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
tests/Silex/Tests/ControllerCollectionTest.php
tests/Silex/Tests/ControllerCollectionTest.php
+31
-0
tests/Silex/Tests/ControllerTest.php
tests/Silex/Tests/ControllerTest.php
+31
-0
No files found.
tests/Silex/Tests/ControllerCollectionTest.php
View file @
c463a6e1
...
...
@@ -155,4 +155,35 @@ class ControllerCollectionTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
array
(
'mid1'
,
'mid2'
,
'mid3'
),
$controller
->
getRoute
()
->
getOption
(
'_after_middlewares'
));
}
public
function
testRouteExtension
()
{
$route
=
new
MyRoute1
();
$controller
=
new
ControllerCollection
(
$route
);
$controller
->
foo
(
'foo'
);
$this
->
assertEquals
(
'foo'
,
$route
->
foo
);
}
/**
* @expectedException \BadMethodCallException
*/
public
function
testRouteMethodDoesNotExist
()
{
$route
=
new
MyRoute1
();
$controller
=
new
ControllerCollection
(
$route
);
$controller
->
bar
();
}
}
class
MyRoute1
extends
Route
{
public
$foo
;
public
function
foo
(
$value
)
{
$this
->
foo
=
$value
;
}
}
tests/Silex/Tests/ControllerTest.php
View file @
c463a6e1
...
...
@@ -88,4 +88,35 @@ class ControllerTest extends \PHPUnit_Framework_TestCase
array
(
new
Route
(
'/underscores_and.periods'
),
'_underscores_and.periods'
),
);
}
public
function
testRouteExtension
()
{
$route
=
new
MyRoute
();
$controller
=
new
Controller
(
$route
);
$controller
->
foo
(
'foo'
);
$this
->
assertEquals
(
'foo'
,
$route
->
foo
);
}
/**
* @expectedException \BadMethodCallException
*/
public
function
testRouteMethodDoesNotExist
()
{
$route
=
new
MyRoute
();
$controller
=
new
Controller
(
$route
);
$controller
->
bar
();
}
}
class
MyRoute
extends
Route
{
public
$foo
;
public
function
foo
(
$value
)
{
$this
->
foo
=
$value
;
}
}
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