Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DeprecatedTestHook example
'second-script' => 'called',
]
,
$object
->
all
(
)
)
;
}
public
function
testExecuteDeprecatedHookTriggersDeprecation
(
)
: void
{
$this
->
loadAppsFromDir
(
__DIR__ . '/_fixtures'
)
;
$object
=
new
ArrayStruct
(
)
;
$context
= Context::
createDefaultContext
(
)
;
$this
->executor->
execute
(
new
DeprecatedTestHook
(
'simple-function-case',
$context
,
[
'object' =>
$object
]
)
)
;
static
::
assertTrue
(
$object
->
has
(
'foo'
)
)
;
static
::
assertEquals
(
'bar',
$object
->
get
(
'foo'
)
)
;
$traces
=
$this
->
getScriptTraces
(
)
;
static
::
assertArrayHasKey
(
'simple-function-case',
$traces
)
;
static
::
assertCount
(
1,
$traces
[
'simple-function-case'
]
[
0
]
[
'deprecations'
]
)
;
static
::
assertEquals
(
[
DeprecatedTestHook::
getDeprecationNotice
(
)
=> 1,
]
,
$traces
[
'simple-function-case'
]
[
0
]
[
'deprecations'
]
)
;
}