Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getMemoryLimit example
use
Symfony\Component\HttpFoundation\Response;
use
Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector;
class
MemoryDataCollectorTest
extends
TestCase
{
public
function
testCollect
(
)
{
$collector
=
new
MemoryDataCollector
(
)
;
$collector
->
collect
(
new
Request
(
)
,
new
Response
(
)
)
;
$this
->
assertIsInt
(
$collector
->
getMemory
(
)
)
;
$this
->
assertIsInt
(
$collector
->
getMemoryLimit
(
)
)
;
$this
->
assertSame
(
'memory',
$collector
->
getName
(
)
)
;
}
/** @dataProvider getBytesConversionTestData */
public
function
testBytesConversion
(
$limit
,
$bytes
)
{
$collector
=
new
MemoryDataCollector
(
)
;
$method
=
new
\
ReflectionMethod
(
$collector
, 'convertToBytes'
)
;
$this
->
assertEquals
(
$bytes
,
$method
->
invoke
(
$collector
,
$limit
)
)
;
}