public function testChangeQuantityOfParentLineItem(): void
{ $lineItem =
(new LineItem('A', 'type'
))->
setStackable(true
);
$child1 =
(new LineItem('A.1', 'child', null, 3
))->
setStackable(true
);
$child2 =
(new LineItem('A.2', 'child', null, 2
))->
setStackable(true
);
$child3 =
(new LineItem('A.3', 'child'
))->
setStackable(true
);
$child4 =
(new LineItem('A.3.1', 'child', null, 5
))->
setStackable(true
);
$child5 =
(new LineItem('A.3.2', 'child', null, 10
))->
setStackable(true
);
$child3->
setChildren(new LineItemCollection([$child4,
$child5]));
$lineItem->
setChildren(new LineItemCollection([$child1,
$child2,
$child3]));
$lineItem->
setQuantity(2
);
static::
assertSame(2,
$lineItem->
getQuantity());
static::
assertSame(6,
$child1->
getQuantity());
static::
assertSame(4,
$child2->
getQuantity());
static::
assertSame(2,
$child3->
getQuantity());
static::
assertSame(10,
$child4->
getQuantity());
static::
assertSame(20,
$child5->
getQuantity());