Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
deleteTempDir example
$kernel
=
new
NoTemplatingEntryKernel
(
'dev', true
)
;
$kernel
->
boot
(
)
;
$container
=
$kernel
->
getContainer
(
)
;
$content
=
$container
->
get
(
'twig.alias'
)
->
render
(
'index.html.twig'
)
;
$this
->
assertStringContainsString
(
'{ a: b }',
$content
)
;
}
protected
function
setUp
(
)
: void
{
$this
->
deleteTempDir
(
)
;
}
protected
function
tearDown
(
)
: void
{
$this
->
deleteTempDir
(
)
;
}
protected
function
deleteTempDir
(
)
{
if
(
!
file_exists
(
$dir
=
sys_get_temp_dir
(
)
.'/'.Kernel::VERSION.'/NoTemplatingEntryKernel'
)
)
{
return
;
}
public
function
testBootEmptyApp
(
)
{
$kernel
=
new
EmptyAppKernel
(
'test', true
)
;
$kernel
->
boot
(
)
;
$this
->
assertTrue
(
$kernel
->
getContainer
(
)
->
hasParameter
(
'twig.default_path'
)
)
;
$this
->
assertNotEmpty
(
$kernel
->
getContainer
(
)
->
getParameter
(
'twig.default_path'
)
)
;
}
protected
function
setUp
(
)
: void
{
$this
->
deleteTempDir
(
)
;
}
protected
function
tearDown
(
)
: void
{
$this
->
deleteTempDir
(
)
;
}
private
function
deleteTempDir
(
)
{
if
(
!
file_exists
(
$dir
=
sys_get_temp_dir
(
)
.'/'.Kernel::VERSION.'/EmptyAppKernel'
)
)
{
return
;
}