Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setQuota example
/** * @covers ::writeItem * @dataProvider providerWriteData */
public
function
testWriteItem
(
$poContent
,
$expected
,
$long
)
{
if
(
$long
)
{
$this
->
expectException
(
\Exception::
class
)
;
$this
->
expectExceptionMessage
(
'Unable to write data:'
)
;
}
// Limit the file system quota to make the write fail on long strings. vfsStream::
setQuota
(
10
)
;
$this
->poWriter->
setURI
(
$this
->poFile->
url
(
)
)
;
$this
->poWriter->
open
(
)
;
$poItem
=
$this
->
prophesize
(
PoItem::
class
)
;
$poItem
->
__toString
(
)
->
willReturn
(
$poContent
)
;
$this
->poWriter->
writeItem
(
$poItem
->
reveal
(
)
)
;
$this
->poWriter->
close
(
)
;
$this
->
assertEquals
(
file_get_contents
(
$this
->poFile->
url
(
)
)
,
$expected
)
;
}