/** * @When I delete the account of :email user */ public function iDeleteAccount($email) { $user = $this->userRepository->findOneByEmail($email); $this->sharedStorage->set('deleted_user', $user); $this->customerShowPage->open(['id' => $user->getCustomer()->getId()]); $this->customerShowPage->deleteAccount(); }
function it_ensures_customer_is_not_deleted_again(CustomerShowPage $customerShowPage, SharedStorageInterface $sharedStorage, CustomerInterface $customer) { $sharedStorage->get('customer')->willReturn($customer); $customer->getId()->willReturn(1); $customerShowPage->open(['id' => 1])->shouldBeCalled(); $customerShowPage->deleteAccount()->willThrow(new ElementNotFoundException('Element not found.')); $this->iShouldNotBeAbleToDeleteCustomerAgain(); }
function it_does_not_allow_deleting_my_own_account(SharedStorageInterface $sharedStorage, UserInterface $admin, CustomerShowPage $customerShowPage) { $sharedStorage->get('admin')->willReturn($admin); $admin->getId()->willReturn(1); $customerShowPage->open(['id' => 1])->shouldBeCalled(); $this->iTryDeletingMyOwnAccount(); $customerShowPage->deleteAccount()->willThrow(new ElementNotFoundException('Element not found.')); $this->iShouldNotBeAbleToDeleteMyOwnAccount(); }