use Shopware\Core\Framework\Struct\ArrayStruct;
/**
* @internal
*
* @covers \Shopware\Core\Content\Product\Stock\StockData
*/
class StockDataTest extends TestCase
{ public function testAccessors(): void
{ $stock =
new StockData('12345', 10, true, 2, 5, true
);
$stock->
addArrayExtension('extraData',
['foo' => 'bar'
]);
static::
assertEquals('12345',
$stock->productId
);
static::
assertEquals(10,
$stock->stock
);
static::
assertTrue($stock->available
);
static::
assertEquals(2,
$stock->minPurchase
);
static::
assertEquals(5,
$stock->maxPurchase
);
static::
assertTrue($stock->isCloseout
);
static::
assertInstanceOf(ArrayStruct::
class,
$stock->
getExtension('extraData'
));
static::
assertEquals(['foo' => 'bar'
],
$stock->
getExtension('extraData'
)->
all());
}