/** * @When /^I try to delete the ("[^"]+" variant of product "[^"]+")$/ */ public function iTryToDeleteTheVariantOfProduct(ProductVariantInterface $productVariant) { try { $this->productVariantRepository->remove($productVariant); } catch (DBALException $exception) { $this->sharedStorage->set('last_exception', $exception); } }
function it_tries_to_delete_a_product_variant_that_should_not_be_deleted_from_the_repository(SharedStorageInterface $sharedStorage, ProductVariantRepositoryInterface $productVariantRepository, ProductVariantInterface $productVariant) { $productVariantRepository->remove($productVariant)->willThrow(DBALException::class); $sharedStorage->set('last_exception', Argument::type(DBALException::class))->shouldBeCalled(); $this->iTryToDeleteTheVariantOfProduct($productVariant); }