abstract class UcAddressesTestCase in Ubercart Addresses 6.2
Same name and namespace in other branches
- 7 tests/UcAddressesTestCase.test \UcAddressesTestCase
Base class for Ubercart Addresses tests.
Hierarchy
- class \DrupalTestCase
- class \DrupalWebTestCase
- class \UcAddressesTestCase
- class \DrupalWebTestCase
Expanded class hierarchy of UcAddressesTestCase
File
- tests/
UcAddressesTestCase.test, line 11 - Contains base class for Ubercart Addresses tests.
View source
abstract class UcAddressesTestCase extends DrupalWebTestCase {
// -----------------------------------------------------------------------------
// PROPERTIES
// -----------------------------------------------------------------------------
// Users
/**
* An account with no privileges, will be used to create addresses for by other users.
*/
protected $basicUser;
/**
* Customer who may view, edit and delete own addresses.
*/
protected $customer;
/**
* Admin user that has all the privileges of uc_addresses.
*/
protected $adminUser;
// -----------------------------------------------------------------------------
// CONSTRUCT
// -----------------------------------------------------------------------------
/**
* Install users and modules needed for all tests.
*
* @return void
*/
public function setUp() {
// Setup modules
parent::setUp('ctools', 'token', 'uc_store', 'uc_addresses');
// Setup users
$this->basicUser = $this
->drupalCreateUser();
$this->customer = $this
->drupalCreateUser(array(
'add/edit own addresses',
'delete own addresses',
));
$this->adminUser = $this
->drupalCreateUser(array(
'add/edit all addresses',
'delete all addresses',
));
}
// -----------------------------------------------------------------------------
// ADDRESS BOOK CRUD
// -----------------------------------------------------------------------------
/**
* View the address book of an user.
*
* @param object $account
* The user to view the address book for.
* @param boolean $may_view
* (optional) If expected if the user may view the address.
*
* @return void
*/
protected function viewAddressBook($account, $may_view = NULL) {
// Go to the address book
$this
->drupalGet($this
->constructAddressUrl($account));
// Test response code
if (!is_null($may_view)) {
$this
->assertResponse($may_view ? 200 : 403);
}
}
/**
* View a single address of an user.
*
* @param object $account
* The user to view an address for
* @param int $aid
* The ID of the address to view
* @param boolean $may_view
* (optional) If expected if the user may view the address.
*
* @return void
*/
protected function viewAddress($account, $aid, $may_view = NULL) {
// Go to the view address page
$this
->drupalGet($this
->constructAddressUrl($account, $aid));
// Test response code
if (!is_null($may_view)) {
$this
->assertResponse($may_view ? 200 : 403);
}
}
/**
* Create a new address for an user.
*
* @param object $account
* The user to create an address for.
* @param boolean $may_edit
* If expected if the user may edit the address.
* Defaults to TRUE.
* @param array $values
* (optional) The values for the address to set.
* If not given, default values will be used for the address.
*
* @return int
* The address ID for the created address if creating was succesful.
* NULL Otherwise.
*/
protected function createAddress($account, $may_edit = TRUE, $values = array()) {
if ($may_edit) {
$values = self::getEditAddressValues(array(
'address',
), $values, 'address_form');
$this
->drupalPost($this
->constructAddressUrl($account) . 'add', $values['form_values'], t('Save address'));
$this
->assertText(t('The address is saved.'), t('The address was saved.'));
// Lookup address to find out ID.
$query = "SELECT aid FROM {uc_addresses}\n WHERE uid=%d\n ORDER BY aid DESC\n ";
$aid = db_result(db_query($query, $account->uid));
// Ensure any given values exists based on whether they should be displayed.
$this
->viewAddress($account, $aid);
$values['values']['aid'] = $aid;
$this
->doAddressValuesDisplayedTests($values['values'], 'address_view');
$this
->assertTrue(self::checkAddressValuesInDatabase($values['values']), t('The address %aid is correctly saved to the database.', array(
'%aid' => $aid,
)));
return $aid;
}
else {
$this
->drupalGet($this
->constructAddressUrl($account) . 'add');
$this
->assertResponse(403);
}
return NULL;
}
/**
* Edit an address of an user.
*
* @param object $account
* The user whose address must be edited
* @param int $aid
* The ID of the address to edit
* @param boolean $may_edit
* If expected if the user may edit the address.
* Defaults to TRUE
* @param array $values
* (optional) The values for the address to set
* If not given, default values will be used for the address.
*
* @return void
*/
protected function editAddress($account, $aid, $may_edit = TRUE, $values = array()) {
if ($may_edit) {
$values = self::getEditAddressValues(array(
'address',
), $values, 'address_form');
$this
->drupalPost($this
->constructAddressUrl($account, $aid) . 'edit', $values['form_values'], t('Save address'));
$this
->assertText(t('The address is saved.'), t('The address was saved.'));
// Ensure any given values exists based on whether they should be displayed.
$this
->viewAddress($account, $aid);
$values['values']['aid'] = $aid;
$this
->doAddressValuesDisplayedTests($values['values'], 'address_view');
$this
->assertTrue(self::checkAddressValuesInDatabase($values['values']), t('The address %aid is correctly saved to the database.', array(
'%aid' => $aid,
)));
}
else {
$this
->drupalGet($this
->constructAddressUrl($account, $aid) . 'edit');
$this
->assertResponse(403);
}
}
/**
* Delete an address of an user.
*
* @param object $account
* The user whose address must be deleted
* @param int $aid
* The ID of the address to delete
* @param boolean $may_delete
* If expected if the user may delete the address.
* Defaults to TRUE.
*
* @return void
* @todo Assert text
*/
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);
}
}
/**
* Test if user can view, edit or delete the address.
*
* @param object $account
* The account to view the address for.
* @param int $aid
* The ID of the address to do crud tests for.
* @param boolean $may_view
* If the address may be viewed by the currently logged in user.
* @param boolean $may_edit
* If the address may be viewed by the currently logged in user.
* @param boolean $may_delete
* If the address may be viewed by the currently logged in user.
* @param array $values
* (optional) Values to fill in when editing the address.
*
* @return void
*/
protected function doCrudTests($account, $aid, $may_view = TRUE, $may_edit = TRUE, $may_delete = TRUE, $values = array()) {
// View this address
$this
->viewAddress($account, $aid, $may_view);
// Edit this address
$this
->editAddress($account, $aid, $may_edit, $values);
// Delete this address
$this
->deleteAddress($account, $aid, $may_delete);
}
/**
* Test if these address values are displayed on the page.
*
* @param array $values
* The values that should exist
* @param string $context
* (optional) The context in which the address is displayed.
* @param string $output
* (optional) The output to test.
* Defaults to the output in the browser
*
* @return void
*/
protected function doAddressValuesDisplayedTests($values, $context = 'default', $output = NULL) {
$address = UcAddressesAddressBook::newAddress();
$handlers = uc_addresses_get_address_field_handler_instances($address, $context);
foreach ($handlers as $fieldname => $handler) {
if (!isset($values[$fieldname])) {
continue;
}
// Check if field is used in the context and if it is enabled.
if ($handler
->checkContext() && $handler
->isFieldEnabled()) {
$value = $handler
->outputValue($values[$fieldname]);
if (drupal_strlen($value) > 0) {
if ($output) {
$this
->assertTrue(strpos($output, $value) !== FALSE, t('Value %value found for field %field on the page.', array(
'%value' => $value,
'%field' => $fieldname,
)));
}
else {
$this
->assertText($value, t('Value %value found for field %field on the page.', array(
'%value' => $value,
'%field' => $fieldname,
)));
}
}
}
}
}
/**
* Test if these address values appear in the database.
*
* @param array $values
* The address values to check for.
*
* @static
* @return boolean
*/
public static function checkAddressValuesInDatabase($values) {
$schema_values = array();
// Only check real schema fields.
foreach ($values as $fieldname => $value) {
if (UcAddressesSchemaAddress::schemaFieldExists($fieldname)) {
$schema_values[$fieldname] = $value;
}
}
$query = "SELECT COUNT(aid) FROM {uc_addresses} WHERE ";
$query .= implode(" = '%s' AND ", array_keys($schema_values)) . " = '%s'";
$result = db_result(db_query($query, $schema_values));
return $result ? TRUE : FALSE;
}
// -----------------------------------------------------------------------------
// HELPER FUNCTIONS
// -----------------------------------------------------------------------------
/**
* Constructs the url for the address book.
*
* If any paths change in the future we only need to change it here.
*
* @param object $account
* The user whose address must be deleted
* @param int $aid
* (optional) The ID of the address to delete
* Defaults to NULL
*
* @return string
*/
protected function constructAddressUrl($account, $aid = NULL) {
$url = 'user/' . $account->uid . '/addresses/';
if ($aid) {
$url .= $aid . '/';
}
return $url;
}
/**
* Generates an array of values to post into an address form
*
* @param array $parents
* The parent form elements.
* @param array $values
* (Some of) the values to use in the address form.
* @param string $context
* The context of the address form.
* This is to determine which address fields should be available.
* @param string $prefix
* Optionally prefixes every field name
*
* @return array
* An array with for each field a value.
*
* @todo Think of which values go in the values array.
*/
public static function getEditAddressValues($parents = array(), $values = array(), $context = 'default', $prefix = '') {
// Initialize values array.
$form_values = array();
// Calculate parent string if needed.
$parent_string = '';
if (count($parents) > 0) {
foreach ($parents as $parent) {
if ($parent_string) {
$parent_string = $parent_string . '[' . $parent . ']';
}
else {
$parent_string = $parent;
}
}
}
$address = UcAddressesAddressBook::newAddress();
$handlers = uc_addresses_get_address_field_handler_instances($address, $context);
foreach ($handlers as $fieldname => $handler) {
if ($handler instanceof UcAddressesDefaultAddressFieldHandler) {
// Bypass fill in values for marking it as the default.
continue;
}
if (isset($values[$fieldname])) {
// The value is already set. Do not override it.
continue;
}
if (array_key_exists($fieldname, $values) && is_null($values[$fieldname])) {
// Fields that are set to NULL should be skipped.
unset($values[$fieldname]);
continue;
}
// Check if the field is enabled an that it is used in the context.
if ($handler
->isFieldEnabled() && $handler
->checkContext()) {
// Fill in a value.
$values[$fieldname] = self::generateAddressFieldValue($fieldname, $values);
}
}
// Prefix values and add parents.
foreach ($values as $fieldname => $value) {
// Set in parents if needed.
$formfieldname = $prefix . $fieldname;
if ($parent_string) {
$formfieldname = $parent_string . '[' . $formfieldname . ']';
}
$form_values[$formfieldname] = $value;
}
return array(
'form_values' => $form_values,
'values' => $values,
);
}
/**
* Generates a value for an address field.
*
* @param string $fieldname
* The field to generate a value for
* @param array $values
* The field values already generated
*
* @return string
* The generated value
*/
public static function generateAddressFieldValue($fieldname, &$values) {
switch ($fieldname) {
case 'address_name':
// By default an empty address name is returned to avoid name collisions
// when that aspect is not tested.
return '';
case 'default_shipping':
case 'default_billing':
// Don't make addresses the default if this aspect is not tested.
return 0;
case 'postal_code':
// A numeric code for postal codes.
return mt_rand(10000, 99999);
case 'country':
// The default country in Ubercart.
$country_id = uc_store_default_country();
// This can be a cached old value, ensure the country exist.
$result = db_result(db_query("SELECT COUNT(*) FROM {uc_countries} WHERE country_id = %d AND version > 0", $country_id));
if ($result == 0) {
$country_id = db_result(db_query_range("SELECT country_id FROM {uc_countries} WHERE version > 0 ORDER BY country_name", 0, 1));
}
return $country_id;
case 'zone':
// Random zone based on the defined country.
if (isset($values['country'])) {
$country_id = $values['country'];
}
else {
$country_id = self::generateAddressFieldValue('country', $values);
}
return db_result(db_query("SELECT zone_id FROM {uc_zones} WHERE zone_country_id = %d ORDER BY rand()", $country_id));
default:
// In all other cases it is assummed that it's a textfield that needs to be filled in.
return self::randomString(12);
}
}
/**
* Returns an empty address book to be used in tests.
*
* @param int $uid
* User ID of the owner of the address book.
*
* @return UcAddressesAddressBook
* An instance of UcAddressesAddressBook, emptied.
*/
protected function UcAddressesGetAddressBook($uid) {
$addressBook = UcAddressesAddressBook::get($uid);
// Ensure we have the right address book in front of us!
$this
->assertEqual($addressBook
->getUserId(), $uid, t('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;
}
/**
* Creates a single user and registers which permissions this user should get.
*
* @param string $name
* The user's username.
* @param array $permissions
* (optional) The user's permissions.
* @param boolean $view_own_def
* (optional) If the user is supposed to see his own default addresses.
* Default to false.
* @param boolean $view_own
* (optional) If the user is supposed to see all of his own addresses.
* Default to false.
* @param boolean $edit_own
* (optional) If the user is supposed to edit all of his own addresses.
* Default to false.
* @param boolean $delete_own
* (optional) If the user is supposed to delete all of his own addresses.
* Default to false.
* @param boolean $view_all_def
* (optional) If the user is supposed to see his all default addresses.
* Default to false.
* @param boolean $view_all
* (optional) If the user is supposed to see all addresses.
* Default to false.
* @param boolean $edit_all
* (optional) If the user is supposed to edit all addresses.
* Default to false.
* @param boolean $delete_all
* (optional) If the user is supposed to delete all addresses.
* Default to false.
*
* @return void
*/
protected function UcAddressesCreateUser($name, $permissions = array(), $view_own_def = FALSE, $view_own = FALSE, $edit_own = FALSE, $delete_own = FALSE, $view_all_def = FALSE, $view_all = FALSE, $edit_all = FALSE, $delete_all = FALSE) {
if (count($permissions) < 1) {
$permissions = array(
'access content',
);
}
$account = $this
->drupalCreateUser($permissions);
$account->name = $name;
$edit = array(
'name' => $name,
);
user_save($account, $edit);
$account->uc_addresses_permissions = array(
'view_own_def' => $view_own_def,
'view_own' => $view_own,
'edit_own' => $edit_own,
'delete_own' => $delete_own,
'view_all_def' => $view_all_def,
'view_all' => $view_all,
'edit_all' => $edit_all,
'delete_all' => $delete_all,
);
return $account;
}
/**
* Create 2 addresses for each passed user:
* - one default address.
* - one other address.
*
* @param object $account
* The account to create addresses for.
*
* @return void
*/
protected function UcAddressesCreateAddresses($account) {
$addressBook = UcAddressesAddressBook::get($account->uid);
// Clear address book cache to clear up leftover addresses
// from previous tests.
$addressBook
->reset();
// Create default address.
$address = $addressBook
->addAddress();
$address
->setField('last_name', self::randomName());
$address
->setField('city', self::randomName());
$address
->setField('country', 840);
$address
->setField('zone', 1);
$address
->setAsDefault();
$address
->setName($account->uid . '_default');
// Create other address.
$address = $addressBook
->addAddress();
$address
->setField('last_name', self::randomName());
$address
->setField('city', self::randomName());
$address
->setField('country', 840);
$address
->setField('zone', 1);
$address
->setName($account->uid . '_other');
// Save all addresses.
$addressBook
->save();
}
// -----------------------------------------------------------------------------
// ASSERTS
// -----------------------------------------------------------------------------
/**
* Pass if an address label is found on the page.
*
* @param UcAddressesAddress $address
* The address to find on the page.
* @param string $message
* Message to display.
*
* @return
* TRUE if the assertion succeeded, FALSE otherwise.
*/
protected function assertAddressLabel(UcAddressesAddress $address, $message = '') {
$message = $message ? $message : t('Address %id found.', array(
'%id' => $address
->getId(),
));
$this
->assertRaw(uc_addresses_format_address($address), $message, 'uc_addresses');
}
/**
* Pass if an address label is NOT found on the page.
*
* @param UcAddressesAddress $address
* The address that should NOT be found on the page.
* @param string $message
* Message to display.
*
* @return
* TRUE if the assertion succeeded, FALSE otherwise.
*/
protected function assertNoAddressLabel(UcAddressesAddress $address, $message = '') {
$message = $message ? $message : t('Address %id found.', array(
'%id' => $address
->getId(),
));
$this
->assertNoRaw(uc_addresses_format_address($address), $message, 'uc_addresses');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalTestCase:: |
protected | property | Assertions thrown in that test case. | |
DrupalTestCase:: |
protected | property | The database prefix of this test run. | |
DrupalTestCase:: |
protected | property | The original file directory, before it was changed for testing purposes. | |
DrupalTestCase:: |
protected | property | The original database prefix, before it was changed for testing purposes. | |
DrupalTestCase:: |
public | property | Current results of this test case. | |
DrupalTestCase:: |
protected | property | This class is skipped when looking for the source of an assertion. | |
DrupalTestCase:: |
protected | property | The test run ID. | |
DrupalTestCase:: |
protected | property | Time limit for the test. | |
DrupalTestCase:: |
protected | function | Internal helper: stores the assert. | |
DrupalTestCase:: |
protected | function | Check to see if two values are equal. | |
DrupalTestCase:: |
protected | function | Check to see if a value is false (an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
protected | function | Check to see if two values are identical. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not equal. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not identical. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not false (not an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
public static | function | Delete an assertion record by message ID. | |
DrupalTestCase:: |
protected | function | Fire an error assertion. | |
DrupalTestCase:: |
public | function | Handle errors during test runs. | |
DrupalTestCase:: |
protected | function | Handle exceptions. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always negative. | |
DrupalTestCase:: |
public static | function | Converts a list of possible parameters into a stack of permutations. | |
DrupalTestCase:: |
protected | function | Cycles through backtrace until the first non-assertion method is found. | |
DrupalTestCase:: |
public static | function | Store an assertion from outside the testing context. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always positive. | |
DrupalTestCase:: |
public static | function | Generates a random string containing letters and numbers. | |
DrupalTestCase:: |
public static | function | Generates a random string of ASCII characters of codes 32 to 126. | |
DrupalTestCase:: |
public | function | Run all tests in this class. | |
DrupalTestCase:: |
protected | function | Logs verbose message in a text file. | |
DrupalWebTestCase:: |
protected | property | Additional cURL options. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The current cookie file used by cURL. | |
DrupalWebTestCase:: |
protected | property | The handle of the current cURL connection. | |
DrupalWebTestCase:: |
protected | property | The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The parsed version of the page. | |
DrupalWebTestCase:: |
protected | property | Whether the files were copied to the test files directory. | |
DrupalWebTestCase:: |
protected | property | The headers of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | HTTP authentication credentials (<username>:<password>). | |
DrupalWebTestCase:: |
protected | property | HTTP authentication method | |
DrupalWebTestCase:: |
protected | property | The current user logged in using the internal browser. | |
DrupalWebTestCase:: |
protected | property | The original user, before it was changed to a clean uid = 1 for testing purposes. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser (plain text version). | |
DrupalWebTestCase:: |
protected | property | The profile to install as a basis for testing. | |
DrupalWebTestCase:: |
protected | property | The number of redirects followed during the handling of a request. | |
DrupalWebTestCase:: |
protected | property | The current session ID, if available. | |
DrupalWebTestCase:: |
protected | property | The current session name, if available. | |
DrupalWebTestCase:: |
protected | property | The URL currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists with the given name or id. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given id and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is found, and optional with the specified index. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is found. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the given value. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the pattern in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the string in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name or id. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given id and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist in the current page by the given XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is not found. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is not found. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the perl regex pattern is not present in raw content. | |
DrupalWebTestCase:: |
protected | function | Pass if the raw text is NOT found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
DrupalWebTestCase:: |
protected | function | Asserts the page did not return the specified response code. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is NOT found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is not the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found MORE THAN ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the Perl regex pattern is found in the raw content. | |
DrupalWebTestCase:: |
protected | function | Pass if the raw text IS found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
DrupalWebTestCase:: |
protected | function | Asserts the page responds with the specified response code. | |
DrupalWebTestCase:: |
protected | function | Pass if the text IS found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
DrupalWebTestCase:: |
protected | function | Helper for assertText and assertNoText. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found ONLY ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
DrupalWebTestCase:: |
protected | function | Pass if the internal browser's URL matches the given path. | |
DrupalWebTestCase:: |
protected | function | Builds an XPath query. | |
DrupalWebTestCase:: |
protected | function | Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive. | |
DrupalWebTestCase:: |
protected | function | Check to make sure that the array of permissions are valid. | |
DrupalWebTestCase:: |
protected | function | Follows a link by name. | |
DrupalWebTestCase:: |
protected | function | Helper function: construct an XPath for the given set of attributes and value. | |
DrupalWebTestCase:: |
protected | function | Runs cron in the Drupal installed by Simpletest. | |
DrupalWebTestCase:: |
protected | function | Close the cURL handler and unset the handler. | |
DrupalWebTestCase:: |
protected | function | Initializes and executes a cURL request. | |
DrupalWebTestCase:: |
protected | function | Reads headers and registers errors received from the tested site. | |
DrupalWebTestCase:: |
protected | function | Initializes the cURL connection. | |
DrupalWebTestCase:: |
protected | function | Compare two files based on size and file name. | |
DrupalWebTestCase:: |
protected | function | Creates a custom content type based on default settings. | |
DrupalWebTestCase:: |
protected | function | Creates a node based on default settings. | |
DrupalWebTestCase:: |
protected | function | Internal helper function; Create a role with specified permissions. | |
DrupalWebTestCase:: |
protected | function | Create a user with a given set of permissions. The permissions correspond to the names given on the privileges page. | |
DrupalWebTestCase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Gets the current raw HTML of requested page. | |
DrupalWebTestCase:: |
protected | function | Gets the value of an HTTP response header. If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default. However, if TRUE is passed as the second argument, all requests will be processed… | |
DrupalWebTestCase:: |
protected | function | Gets the HTTP response headers of the requested page. Normally we are only interested in the headers returned by the last request. However, if a page is redirected or HTTP authentication is in use, multiple requests will be required to retrieve the… | |
DrupalWebTestCase:: |
protected | function | Gets an array containing all e-mails sent during this test case. | |
DrupalWebTestCase:: |
function | Get a node from the database based on its title. | ||
DrupalWebTestCase:: |
protected | function | Gets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Get a list files that can be used in tests. | |
DrupalWebTestCase:: |
protected | function | Generate a token for the currently logged in user. | |
DrupalWebTestCase:: |
protected | function | Retrieves only the headers for a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Log in a user with the internal browser. | |
DrupalWebTestCase:: |
protected | function | ||
DrupalWebTestCase:: |
protected | function | Execute a POST request on a Drupal page. It will be done as usual POST request with SimpleBrowser. | |
DrupalWebTestCase:: |
protected | function | Sets the raw HTML content. This can be useful when a page has been fetched outside of the internal browser and assertions need to be made on the returned page. | |
DrupalWebTestCase:: |
protected | function | Sets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Takes a path and returns an absolute path. | |
DrupalWebTestCase:: |
protected | function | Get all option elements, including nested options, in a select. | |
DrupalWebTestCase:: |
protected | function | Get the selected value from a select field. | |
DrupalWebTestCase:: |
protected | function | Get the current url from the cURL handler. | |
DrupalWebTestCase:: |
protected | function | Handle form input related to drupalPost(). Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type. | |
DrupalWebTestCase:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
DrupalWebTestCase:: |
protected | function | Refresh the in-memory set of variables. Useful after a page request is made that changes a variable in a different thread. | |
DrupalWebTestCase:: |
protected | function | Reset all data structures after having enabled new modules. | |
DrupalWebTestCase:: |
protected | function | Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix. | |
DrupalWebTestCase:: |
protected | function | Outputs to verbose the most recent $count emails sent. | |
DrupalWebTestCase:: |
protected | function | Perform an xpath search on the contents of the internal browser. The search is relative to the root element (HTML tag normally) of the page. | |
DrupalWebTestCase:: |
function |
Constructor for DrupalWebTestCase. Overrides DrupalTestCase:: |
||
UcAddressesTestCase:: |
protected | property | Admin user that has all the privileges of uc_addresses. | |
UcAddressesTestCase:: |
protected | property | An account with no privileges, will be used to create addresses for by other users. | |
UcAddressesTestCase:: |
protected | property | Customer who may view, edit and delete own addresses. | |
UcAddressesTestCase:: |
protected | function | Pass if an address label is found on the page. | |
UcAddressesTestCase:: |
protected | function | Pass if an address label is NOT found on the page. | |
UcAddressesTestCase:: |
public static | function | Test if these address values appear in the database. | |
UcAddressesTestCase:: |
protected | function | Constructs the url for the address book. | |
UcAddressesTestCase:: |
protected | function | Create a new address for an user. | |
UcAddressesTestCase:: |
protected | function | Delete an address of an user. | |
UcAddressesTestCase:: |
protected | function | Test if these address values are displayed on the page. | |
UcAddressesTestCase:: |
protected | function | Test if user can view, edit or delete the address. | |
UcAddressesTestCase:: |
protected | function | Edit an address of an user. | |
UcAddressesTestCase:: |
public static | function | Generates a value for an address field. | |
UcAddressesTestCase:: |
public static | function | Generates an array of values to post into an address form | |
UcAddressesTestCase:: |
public | function |
Install users and modules needed for all tests. Overrides DrupalWebTestCase:: |
2 |
UcAddressesTestCase:: |
protected | function | Create 2 addresses for each passed user: | |
UcAddressesTestCase:: |
protected | function | Creates a single user and registers which permissions this user should get. | |
UcAddressesTestCase:: |
protected | function | Returns an empty address book to be used in tests. | |
UcAddressesTestCase:: |
protected | function | View a single address of an user. | |
UcAddressesTestCase:: |
protected | function | View the address book of an user. |