Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isStopwatchInstalled example
$this
->
assertEquals
(
0,
$c
->
getStartTime
(
)
)
;
$kernel
=
$this
->
createMock
(
KernelInterface::
class
)
;
$kernel
->
expects
(
$this
->
once
(
)
)
->
method
(
'getStartTime'
)
->
willReturn
(
123456.0
)
;
$c
=
new
TimeDataCollector
(
$kernel
)
;
$request
=
new
Request
(
)
;
$request
->server->
set
(
'REQUEST_TIME', 1
)
;
$c
->
collect
(
$request
,
new
Response
(
)
)
;
$this
->
assertEquals
(
123456000,
$c
->
getStartTime
(
)
)
;
$this
->
assertSame
(
class_exists
(
Stopwatch::
class
, false
)
,
$c
->
isStopwatchInstalled
(
)
)
;
}
public
function
testReset
(
)
{
$collector
=
new
TimeDataCollector
(
)
;
// Fill Collector
$request
= Request::
create
(
'http://test.com/foo?bar=baz'
)
;
$response
=
new
Response
(
'test'
)
;
$collector
->
collect
(
$request
,
$response
)
;