You are here

protected function UcAddressesTestCase::UcAddressesGetAddressBook in Ubercart Addresses 7

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

Returns an empty address book to be used in tests.

Parameters

int $uid: User ID of the owner of the address book.

Return value

UcAddressesAddressBook An instance of UcAddressesAddressBook, emptied.

7 calls to UcAddressesTestCase::UcAddressesGetAddressBook()
UcAddressesApiTestCase::testAddressBookCrud in tests/uc_addresses.api.test
Tests if addresses can be added, saved and deleted.
UcAddressesApiTestCase::testAddressNames in tests/uc_addresses.api.test
Tests unique address names.
UcAddressesApiTestCase::testAddressOutput in tests/uc_addresses.api.test
Tests if address objects can be converted to a string.
UcAddressesApiTestCase::testDefaultAddresses in tests/uc_addresses.api.test
Tests default addresses.
UcAddressesApiTestCase::testMultipleAddressBooks in tests/uc_addresses.api.test
Tests if address loading works as expected across multiple address books.

... See full list

File

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

Class

UcAddressesTestCase
Base class for Ubercart Addresses tests.

Code

protected function UcAddressesGetAddressBook($uid) {
  $addressBook = UcAddressesAddressBook::get($uid);

  // Ensure we have the right address book in front of us!
  $this
    ->assertEqual($addressBook
    ->getUserId(), $uid, format_string('Address book is of user %uid.', array(
    '%uid' => $uid,
  )));

  // Clear address book cache to clear up leftover addresses
  // from previous tests.
  $addressBook
    ->reset();
  return $addressBook;
}