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
322dbb5d
Commit
322dbb5d
authored
Nov 19, 2013
by
Jared Kazimir
Committed by
Fabien Potencier
Apr 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated route_factory service to use Pimple 2 factory method
parent
fc8bbb62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
src/Silex/Application.php
src/Silex/Application.php
+2
-2
tests/Silex/Tests/ApplicationTest.php
tests/Silex/Tests/ApplicationTest.php
+12
-0
No files found.
src/Silex/Application.php
View file @
322dbb5d
...
@@ -78,9 +78,9 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte
...
@@ -78,9 +78,9 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte
});
});
$this
[
'route_class'
]
=
'Silex\\Route'
;
$this
[
'route_class'
]
=
'Silex\\Route'
;
$this
[
'route_factory'
]
=
function
()
use
(
$app
)
{
$this
[
'route_factory'
]
=
$this
->
factory
(
function
()
use
(
$app
)
{
return
new
$app
[
'route_class'
]();
return
new
$app
[
'route_class'
]();
};
}
)
;
$this
[
'exception_handler'
]
=
function
()
use
(
$app
)
{
$this
[
'exception_handler'
]
=
function
()
use
(
$app
)
{
return
new
ExceptionHandler
(
$app
[
'debug'
]);
return
new
ExceptionHandler
(
$app
[
'debug'
]);
...
...
tests/Silex/Tests/ApplicationTest.php
View file @
322dbb5d
...
@@ -497,6 +497,18 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
...
@@ -497,6 +497,18 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$response
=
$app
->
handle
(
Request
::
create
(
'/foo'
));
$response
=
$app
->
handle
(
Request
::
create
(
'/foo'
));
$this
->
assertEquals
(
301
,
$response
->
getStatusCode
());
$this
->
assertEquals
(
301
,
$response
->
getStatusCode
());
}
}
public
function
testBeforeFilterOnMountedControllerGroupIsolatedToGroup
()
{
$app
=
new
Application
();
$app
->
match
(
'/'
,
function
()
{
return
new
Response
(
'ok'
);
});
$mounted
=
$app
[
'controllers_factory'
];
$mounted
->
before
(
function
()
{
return
new
Response
(
'not ok'
);
});
$app
->
mount
(
'/group'
,
$mounted
);
$response
=
$app
->
handle
(
Request
::
create
(
'/'
));
$this
->
assertEquals
(
'ok'
,
$response
->
getContent
());
}
}
}
class
FooController
class
FooController
...
...
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