$productId =
$this->
createProduct([ 'stock' =>
$initialStock,
]);
$orderId =
$this->
orderProduct($productId,
$orderQuantity);
$product =
$this->productRepository->
search(new Criteria([$productId]),
$context)->
first();
static::
assertInstanceOf(ProductEntity::
class,
$product);
$this->
assertStock($initialStock -
$orderQuantity,
$product);
$this->
transitionOrder($orderId, StateMachineTransitionActions::ACTION_CANCEL
);
$product =
$this->productRepository->
search(new Criteria([$productId]),
$context)->
first();
static::
assertInstanceOf(ProductEntity::
class,
$product);
$this->
assertStock($initialStock,
$product);
} public function testStockNotReduceDuplicatedWhenReOpenOrder(): void
{ $id =
$this->
createProduct();