You are here

protected function UcAddressesTestCase::deleteAddress in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 tests/UcAddressesTestCase.test \UcAddressesTestCase::deleteAddress()

Delete an address of an user.

@todo Assert text

Parameters

object $account: The user whose address must be deleted

int $aid: The ID of the address to delete

boolean $may_delete: If expected if the user may delete the address. Defaults to TRUE.

Return value

void

1 call to UcAddressesTestCase::deleteAddress()
UcAddressesTestCase::doCrudTests in tests/UcAddressesTestCase.test
Test if user can view, edit or delete the address.

File

tests/UcAddressesTestCase.test, line 200
Contains base class for Ubercart Addresses tests.

Class

UcAddressesTestCase
Base class for Ubercart Addresses tests.

Code

protected function deleteAddress($account, $aid, $may_delete = TRUE) {
  if ($may_delete) {
    $this
      ->drupalPost($this
      ->constructAddressUrl($account, $aid) . 'delete', array(), t('Delete address'));
    $this
      ->assertText(t('The address has been deleted.'), t('Deleting address succesful'));
  }
  else {
    $this
      ->drupalGet($this
      ->constructAddressUrl($account, $aid) . 'delete');
    $this
      ->assertResponse(403);
  }
}