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
d7c280e9
Commit
d7c280e9
authored
Apr 18, 2011
by
Igor Wiedler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mount] adjust testLazyMount to verify laziness
parent
a3a784b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
tests/Silex/Tests/FunctionalTest.php
tests/Silex/Tests/FunctionalTest.php
+18
-2
No files found.
tests/Silex/Tests/FunctionalTest.php
View file @
d7c280e9
...
...
@@ -57,17 +57,33 @@ class FunctionalTest extends \PHPUnit_Framework_TestCase
public
function
testLazyMount
()
{
$mountedFactory
=
function
()
{
$i
=
0
;
$mountedFactory
=
function
()
use
(
&
$i
)
{
$i
++
;
$mounted
=
new
Application
();
$mounted
->
get
(
'/{name}'
,
function
(
$name
)
{
return
new
Response
(
$name
);
});
$mounted
->
get
(
'/{name}'
,
function
(
$name
)
{
return
new
Response
(
$name
);
});
return
$mounted
;
};
$app
=
new
Application
();
$app
->
mount
(
'/hello'
,
$mountedFactory
);
$app
->
get
(
'/main'
,
function
()
{
return
new
Response
(
'main app'
);
});
$response
=
$app
->
handle
(
Request
::
create
(
'/main'
));
$this
->
assertEquals
(
'main app'
,
$response
->
getContent
());
$this
->
assertEquals
(
0
,
$i
);
$response
=
$app
->
handle
(
Request
::
create
(
'/hello/Silex'
));
$this
->
assertEquals
(
'Silex'
,
$response
->
getContent
());
$this
->
assertEquals
(
1
,
$i
);
}
public
function
testLazyMountWithAnExternalFile
()
...
...
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