6 declare(strict_types=1);
12 use PHPUnit\Framework\TestCase;
20 private $stockRegistry;
25 private $getDefaultSourceItemBySku;
45 $stockItem = $this->stockRegistry->getStockItemBySku(
'SKU-1');
47 $this->stockRegistry->updateStockItemBySku(
'SKU-1',
$stockItem);
49 $defaultSourceItem = $this->getDefaultSourceItemBySku->execute(
'SKU-1');
52 $defaultSourceItem->getQuantity(),
53 'Quantity is not updated in default source when legacy stock is updated and product was' 54 .
'previously assigned to default source' 68 $stockItem = $this->stockRegistry->getStockItemBySku(
'SKU-2');
70 $this->stockRegistry->updateStockItemBySku(
'SKU-2',
$stockItem);
72 $defaultSourceItem = $this->getDefaultSourceItemBySku->execute(
'SKU-2');
75 $defaultSourceItem->getQuantity(),
76 'Quantity is not updated in default source when legacy stock is updated' 80 $stockItem = $this->stockRegistry->getStockItemBySku(
'SKU-3');
82 $this->stockRegistry->updateStockItemBySku(
'SKU-3',
$stockItem);
84 $defaultSourceItem = $this->getDefaultSourceItemBySku->execute(
'SKU-3');
87 $defaultSourceItem->getQuantity(),
88 'Quantity is not updated in default source when legacy stock is updated and product was not ' 89 .
'previously assigned to default source' 103 $stockItem = $this->stockRegistry->getStockItemBySku(
'SKU-3');
106 $this->stockRegistry->updateStockItemBySku(
'SKU-3',
$stockItem);
108 $defaultSourceItem = $this->getDefaultSourceItemBySku->execute(
'SKU-3');
111 'Product is assigned to default source on legacy stock item save even if it should not be' 115 $stockItem = $this->stockRegistry->getStockItemBySku(
'SKU-5');
118 $this->stockRegistry->updateStockItemBySku(
'SKU-5',
$stockItem);
120 $defaultSourceItem = $this->getDefaultSourceItemBySku->execute(
'SKU-5');
123 'Product is not assigned to default source on legacy stock item save even if it should be'
testSaveLegacyStockItemWithoutDefaultSourceAssignment()
testSaveLegacyStockItemNotAssignedToDefaultSource()
testSaveLegacyStockItemAssignedToDefaultSource()
static getObjectManager()