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
6543379c
Commit
6543379c
authored
Nov 27, 2012
by
Marijn Huizendveld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow constructor arguments.
parent
0829298b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
src/Silex/Application.php
src/Silex/Application.php
+8
-2
tests/Silex/Tests/ApplicationTest.php
tests/Silex/Tests/ApplicationTest.php
+8
-0
No files found.
src/Silex/Application.php
View file @
6543379c
...
@@ -52,10 +52,16 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte
...
@@ -52,10 +52,16 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte
private
$booted
=
false
;
private
$booted
=
false
;
/**
/**
* Constructor.
* Instantiate a new Application.
*
* Objects and parameters can be passed as argument to the constructor.
*
* @param array $values The parameters or objects.
*/
*/
public
function
__construct
()
public
function
__construct
(
array
$values
=
array
()
)
{
{
parent
::
__construct
(
$values
);
$app
=
$this
;
$app
=
$this
;
$this
[
'logger'
]
=
null
;
$this
[
'logger'
]
=
null
;
...
...
tests/Silex/Tests/ApplicationTest.php
View file @
6543379c
...
@@ -48,6 +48,14 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
...
@@ -48,6 +48,14 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this
->
assertInstanceOf
(
'Silex\Controller'
,
$returnValue
);
$this
->
assertInstanceOf
(
'Silex\Controller'
,
$returnValue
);
}
}
public
function
testConstructorInjection
()
{
$params
=
array
(
"param"
=>
"value"
);
$app
=
new
Application
(
$params
);
$this
->
assertSame
(
$params
[
'param'
],
$app
[
'param'
]);
}
public
function
testGetRequest
()
public
function
testGetRequest
()
{
{
$request
=
Request
::
create
(
'/'
);
$request
=
Request
::
create
(
'/'
);
...
...
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