deleteAccount() public method

Deletes the user on whose show page we are currently on.
public deleteAccount ( )
Ejemplo n.º 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!');
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 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!');
 }
Ejemplo n.º 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();
 }