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
5630a8b5
Commit
5630a8b5
authored
Jun 01, 2012
by
Klaus Silveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed options since Silex WebTestCase has no createKernel, added missing server parameter array
parent
2bd47d64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
src/Silex/WebTestCase.php
src/Silex/WebTestCase.php
+2
-3
tests/Silex/Tests/WebTestCaseTest.php
tests/Silex/Tests/WebTestCaseTest.php
+20
-0
No files found.
src/Silex/WebTestCase.php
View file @
5630a8b5
...
...
@@ -43,13 +43,12 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
/**
* Creates a Client.
*
* @param array $options An array of options to pass to the createKernel class
* @param array $server An array of server parameters
*
* @return Client A Client instance
*/
public
function
createClient
(
array
$
options
=
array
(),
array
$
server
=
array
())
public
function
createClient
(
array
$server
=
array
())
{
return
new
Client
(
$this
->
app
);
return
new
Client
(
$this
->
app
,
$server
);
}
}
tests/Silex/Tests/WebTestCaseTest.php
View file @
5630a8b5
...
...
@@ -33,6 +33,12 @@ class WebTestCaseTest extends WebTestCase
return
'<h1>title</h1>'
;
});
$app
->
match
(
'/server'
,
function
()
use
(
$app
)
{
$user
=
$app
[
'request'
]
->
server
->
get
(
'PHP_AUTH_USER'
);
$pass
=
$app
[
'request'
]
->
server
->
get
(
'PHP_AUTH_PW'
);
return
"<h1>
$user
:
$pass
</h1>"
;
});
return
$app
;
}
...
...
@@ -53,4 +59,18 @@ class WebTestCaseTest extends WebTestCase
$crawler
=
$client
->
request
(
'GET'
,
'/html'
);
$this
->
assertEquals
(
'title'
,
$crawler
->
filter
(
'h1'
)
->
text
());
}
public
function
testServerVariables
()
{
$user
=
'klaus'
;
$pass
=
'123456'
;
$client
=
$this
->
createClient
(
array
(
'PHP_AUTH_USER'
=>
$user
,
'PHP_AUTH_PW'
=>
$pass
,
));
$crawler
=
$client
->
request
(
'GET'
,
'/server'
);
$this
->
assertEquals
(
"
$user
:
$pass
"
,
$crawler
->
filter
(
'h1'
)
->
text
());
}
}
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