deleteAccount() public method

Deletes the user on whose show page we are currently on.
public deleteAccount ( )
Example #1
0
 /**
  * @Then I should not be able to delete it again
  */
 public function iShouldNotBeAbleToDeleteCustomerAgain()
 {
     $customer = $this->sharedStorage->get('customer');
     $this->customerShowPage->open(['id' => $customer->getId()]);
     try {
         $this->customerShowPage->deleteAccount();
     } catch (ElementNotFoundException $exception) {
         return;
     }
     throw new \DomainException('Delete account should throw an exception!');
 }
Example #2
0
 /**
  * @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(ShowPageInterface $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();
 }
Example #4
0
 /**
  * @Then I should not be able to do it
  */
 public function iShouldNotBeAbleToDeleteMyOwnAccount()
 {
     try {
         $this->customerShowPage->deleteAccount();
     } catch (ElementNotFoundException $exception) {
         return;
     }
     throw new \DomainException('Delete account should throw an exception!');
 }
Example #5
0
 function it_does_not_allow_deleting_my_own_account(SharedStorageInterface $sharedStorage, UserInterface $admin, ShowPageInterface $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();
 }