$ids =
new IdsCollection();
$p1 =
(new SalesChannelProductEntity())->
assign(['id' =>
$ids->
get('product-1'
)]);
$p2 =
(new SalesChannelProductEntity())->
assign(['id' =>
$ids->
get('product-2'
)]);
$stock1 =
new StockData($ids->
get('product-1'
), 10, false, 5, null, null
);
$stock1->
addArrayExtension('extra',
['arbitrary-data1' => 'foo'
]);
$stock2 =
new StockData($ids->
get('product-2'
), 12, true
);
$stockStorage->
expects(static::
once()) ->
method('load'
) ->
willReturn(new StockDataCollection([$stock1,
$stock2]));
$event =
new SalesChannelEntityLoadedEvent( $this->
createMock(SalesChannelProductDefinition::
class),
[$p1,
$p2],
$this->
createMock(SalesChannelContext::
class) );
$subscriber->
salesChannelLoaded($event);
static::
assertEquals(10,
$p1->
getStock());
static::
assertFalse($p1->
getAvailable());