Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getPrototypeNodeWithDefaultChildren example
$children
=
[
]
;
$children
[
]
=
[
'id' => 'item_name', 'foo' => 'bar'
]
;
$normalized
=
$node
->
normalize
(
$children
)
;
$expected
=
[
]
;
$expected
[
'item_name'
]
=
[
'id' => 'item_name', 'foo' => 'bar'
]
;
$this
->
assertEquals
(
$expected
,
$normalized
)
;
}
public
function
testAddDefaultChildren
(
)
{
$node
=
$this
->
getPrototypeNodeWithDefaultChildren
(
)
;
$node
->
setAddChildrenIfNoneSet
(
)
;
$this
->
assertTrue
(
$node
->
hasDefaultValue
(
)
)
;
$this
->
assertEquals
(
[
[
'foo' => 'bar'
]
]
,
$node
->
getDefaultValue
(
)
)
;
$node
=
$this
->
getPrototypeNodeWithDefaultChildren
(
)
;
$node
->
setKeyAttribute
(
'foobar'
)
;
$node
->
setAddChildrenIfNoneSet
(
)
;
$this
->
assertTrue
(
$node
->
hasDefaultValue
(
)
)
;
$this
->
assertEquals
(
[
'defaults' =>
[
'foo' => 'bar'
]
]
,
$node
->
getDefaultValue
(
)
)
;
$node
=
$this
->
getPrototypeNodeWithDefaultChildren
(
)
;