Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
runRequest example
$response
=
$client
->
request
(
'GET', 'http://example.com/foo-bar'
)
;
rmdir
(
sys_get_temp_dir
(
)
.'/sf_http_cache'
)
;
self::
assertInstanceOf
(
MockResponse::
class
,
$response
)
;
self::
assertSame
(
$response
->
getRequestOptions
(
)
[
'normalized_headers'
]
[
'application-name'
]
[
0
]
, 'Application-Name: test1234'
)
;
self::
assertSame
(
$response
->
getRequestOptions
(
)
[
'normalized_headers'
]
[
'test-name-header'
]
[
0
]
, 'Test-Name-Header: test12345'
)
;
}
public
function
testDoesNotEvaluateResponseBody
(
)
{
$body
=
file_get_contents
(
__DIR__.'/Fixtures/assertion_failure.php'
)
;
$response
=
$this
->
runRequest
(
new
MockResponse
(
$body
,
[
'response_headers' =>
[
'X-Body-Eval' => true
]
]
)
)
;
$headers
=
$response
->
getHeaders
(
)
;
$this
->
assertSame
(
$body
,
$response
->
getContent
(
)
)
;
$this
->
assertArrayNotHasKey
(
'x-body-eval',
$headers
)
;
}
public
function
testDoesNotIncludeFile
(
)
{
$file
= __DIR__.'/Fixtures/assertion_failure.php';
$response
=
$this
->
runRequest
(
new
MockResponse
(