class UcAddressesViewsTestCase in Ubercart Addresses 7
Same name and namespace in other branches
- 6.2 tests/uc_addresses.views.test \UcAddressesViewsTestCase
Test cases for Views integration.
Hierarchy
- class \DrupalTestCase
- class \DrupalWebTestCase
- class \UcAddressesTestCase
- class \UcAddressesViewsTestCase
- class \UcAddressesTestCase
- class \DrupalWebTestCase
Expanded class hierarchy of UcAddressesViewsTestCase
File
- tests/
uc_addresses.views.test, line 11 - Test cases for Views integration.
View source
class UcAddressesViewsTestCase extends UcAddressesTestCase {
/**
* Array of accounts.
*
* @var array
* @access protected
*/
protected $accounts = array();
/**
* Describes this test.
*
* @return array
*/
public static function getInfo() {
return array(
'name' => 'Ubercart Addresses Views tests',
'description' => 'Test the Ubercart Addresses Views integration.',
'group' => 'Ubercart Addresses',
'dependencies' => array(
'ctools',
'token',
'uc_store',
'views',
),
);
}
/**
* Setup.
*/
public function setUp() {
parent::setUp();
module_enable(array(
'views',
));
// Create a number of users with two addresses each.
$this
->UcAddressesCreateUsers();
foreach ($this->accounts as $account) {
$this
->UcAddressesCreateAddresses($account);
}
// Create addresses for the basic user too.
$this
->UcAddressesCreateAddresses($this->basicUser);
}
/**
* Create users, each with different uc_addresses permissions.
*/
protected function UcAddressesCreateUsers() {
$this->accounts = array();
$this->accounts['customerBasic'] = $this
->UcAddressesCreateUser('customerBasic');
$this->accounts['customerViewDef'] = $this
->UcAddressesCreateUser('customerViewDef', array(
'view own default addresses',
), TRUE);
$this->accounts['customerView'] = $this
->UcAddressesCreateUser('customerView', array(
'view own addresses',
), TRUE, TRUE);
$this->accounts['customerEdit'] = $this
->UcAddressesCreateUser('customerEdit', array(
'add/edit own addresses',
), TRUE, TRUE, TRUE);
$this->accounts['customerDelete'] = $this
->UcAddressesCreateUser('customerDelete', array(
'add/edit own addresses',
'delete own addresses',
), TRUE, TRUE, TRUE, TRUE);
$this->accounts['adminViewDef'] = $this
->UcAddressesCreateUser('adminViewDef', array(
'view all default addresses',
), TRUE, FALSE, FALSE, FALSE, TRUE);
$this->accounts['adminView'] = $this
->UcAddressesCreateUser('adminView', array(
'view all addresses',
), TRUE, TRUE, FALSE, FALSE, TRUE, TRUE);
$this->accounts['adminEdit'] = $this
->UcAddressesCreateUser('adminEdit', array(
'add/edit all addresses',
), TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE);
$this->accounts['adminAll'] = $this
->UcAddressesCreateUser('adminAll', array(
'add/edit all addresses',
'delete all addresses',
), TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
}
/**
* Tests if the address access filters work as expected.
*/
public function testAccessFilters() {
// Setup View.
$this
->createAccessFiltersView();
$this
->doAccessFilterTests($this->accounts['customerBasic']);
$this
->doAccessFilterTests($this->accounts['customerViewDef']);
$this
->doAccessFilterTests($this->accounts['customerView']);
$this
->doAccessFilterTests($this->accounts['customerEdit']);
$this
->doAccessFilterTests($this->accounts['customerDelete']);
$this
->doAccessFilterTests($this->accounts['adminViewDef']);
$this
->doAccessFilterTests($this->accounts['adminView']);
$this
->doAccessFilterTests($this->accounts['adminEdit']);
$this
->doAccessFilterTests($this->accounts['adminAll']);
}
/**
* Tests if the address access filters work for one particular
* account.
*
* @param object $account
* The account to check access for.
*
* @return void
*/
protected function doAccessFilterTests($account) {
$this
->drupalLogin($account);
// Test view access.
$this
->drupalGet('uc_addresses/view');
// View own default addresses.
$text = $account->uid . '_default';
if ($account->uc_addresses_permissions['view_own_def']) {
$this
->assertText($text, 'User sees own default address.');
}
else {
$this
->assertNoText($text);
}
// View own addresses.
$text = $account->uid . '_other';
if ($account->uc_addresses_permissions['view_own']) {
$this
->assertText($text);
}
else {
$this
->assertNoText($text);
}
// View all default addresses.
$text = $this->basicUser->uid . '_default';
if ($account->uc_addresses_permissions['view_all_def']) {
$this
->assertText($text);
}
else {
$this
->assertNoText($text);
}
// View all addresses.
$text = $this->basicUser->uid . '_other';
if ($account->uc_addresses_permissions['view_all']) {
$this
->assertText($text);
}
else {
$this
->assertNoText($text);
}
// Test edit access.
$this
->drupalGet('uc_addresses/edit');
// Edit own address.
$text = $account->uid . '_other';
if ($account->uc_addresses_permissions['edit_own']) {
$this
->assertText($text);
}
else {
$this
->assertNoText($text);
}
// Edit all addresses.
$text = $this->basicUser->uid . '_other';
if ($account->uc_addresses_permissions['edit_all']) {
$this
->assertText($text);
}
else {
$this
->assertNoText($text);
}
// Test delete access.
$this
->drupalGet('uc_addresses/delete');
// Delete own address.
$text = $account->uid . '_other';
if ($account->uc_addresses_permissions['delete_own']) {
$this
->assertText($text);
}
else {
$this
->assertNoText($text);
}
// Delete all addresses.
$text = $this->basicUser->uid . '_other';
if ($account->uc_addresses_permissions['delete_all']) {
$this
->assertText($text);
}
else {
$this
->assertNoText($text);
}
}
/**
* Tests if the view, edit and delete links are only
* displayed for users that are allowed to perform these tasks.
*/
public function testActionLinks() {
// Setup View.
$this
->createActionLinksView();
$this
->doActionLinksTests($this->accounts['customerBasic']);
$this
->doActionLinksTests($this->accounts['customerViewDef']);
$this
->doActionLinksTests($this->accounts['customerView']);
$this
->doActionLinksTests($this->accounts['customerEdit']);
$this
->doActionLinksTests($this->accounts['customerDelete']);
$this
->doActionLinksTests($this->accounts['adminViewDef']);
$this
->doActionLinksTests($this->accounts['adminView']);
$this
->doActionLinksTests($this->accounts['adminEdit']);
$this
->doActionLinksTests($this->accounts['adminAll']);
}
/**
* Tests if the right actions links are displayed for one particular
* account.
*
* @param object $account
* The account to check access for.
*
* @return void
*/
protected function doActionLinksTests($account) {
$this
->drupalLogin($account);
// Test view access.
$this
->drupalGet('uc_addresses/action-links');
// Get own addresses uri's.
$own_address_default_uri = UcAddressesAddressBook::get($account->uid)
->getDefaultAddress()
->uri();
$own_address_other_uri = UcAddressesAddressBook::get($account->uid)
->getAddressByName($account->uid . '_other')
->uri();
// Get addresses of other user.
$other_user_address_default_uri = UcAddressesAddressBook::get($this->basicUser->uid)
->getDefaultAddress()
->uri();
$other_user_address_other_uri = UcAddressesAddressBook::get($this->basicUser->uid)
->getAddressByName($this->basicUser->uid . '_other')
->uri();
// View own default addresses.
if ($account->uc_addresses_permissions['view_own_def']) {
$this
->assertRaw($own_address_default_uri['path'], 'User can see own default address.');
}
else {
$this
->assertNoRaw($own_address_default_uri['path']);
}
// View own addresses.
if ($account->uc_addresses_permissions['view_own']) {
$this
->assertRaw($own_address_other_uri['path'], 'User can see own addresses.');
}
else {
$this
->assertNoRaw($own_address_other_uri['path']);
}
// View all default addresses.
if ($account->uc_addresses_permissions['view_all_def']) {
$this
->assertRaw($other_user_address_default_uri['path'], 'User can see all default addresses.');
}
else {
$this
->assertNoRaw($other_user_address_default_uri['path']);
}
// View all addresses.
if ($account->uc_addresses_permissions['view_all']) {
$this
->assertRaw($other_user_address_other_uri['path'], 'User can see all addresses.');
}
else {
$this
->assertNoRaw($other_user_address_other_uri['path']);
}
// Edit own addresses.
if ($account->uc_addresses_permissions['edit_own']) {
$this
->assertRaw($own_address_other_uri['path'] . '/edit', 'User can edit own addresses.');
}
else {
$this
->assertNoRaw($own_address_other_uri['path'] . '/edit');
}
// Edit all addresses.
if ($account->uc_addresses_permissions['edit_all']) {
$this
->assertRaw($other_user_address_other_uri['path'] . '/edit', 'User can edit all addresses.');
}
else {
$this
->assertNoRaw($other_user_address_other_uri['path'] . '/edit');
}
// Delete own addresses.
if ($account->uc_addresses_permissions['delete_own']) {
$this
->assertRaw($own_address_other_uri['path'] . '/delete', 'User can delete own addresses.');
}
else {
$this
->assertNoRaw($own_address_other_uri['path'] . '/delete');
}
// Delete all addresses.
if ($account->uc_addresses_permissions['delete_all']) {
$this
->assertRaw($other_user_address_other_uri['path'] . '/delete', 'User can delete all addresses.');
}
else {
$this
->assertNoRaw($other_user_address_other_uri['path'] . '/delete');
}
}
/**
* Tests if the display access plugin works as expected.
*/
public function testDisplayAccessPlugin() {
// Setup View.
$this
->createDisplayAccessView();
// Test display access.
$this
->doDisplayAccessTests('uc_addresses_display_access');
}
/**
* Tests if the argument validator plugins work as expected.
*/
public function testArgumentValidatorPlugins() {
// Setup View.
$this
->createArgumentValidatorView();
// Test display access.
$this
->doDisplayAccessTests('uc_addresses_argument_validator');
}
/**
* Tests for each user if he/she should have access to pages:
* - representing a listing of his/her own addresses;
* - representing a View of his/her own default billing address;
* - representing a View of his/her own non-default address;
* - representing a listing of addresses of an other user;
* - representing a View a default billing address of an other user;
* - representing a View a non-default address of an other user;
*
* This method is used by the display access plugin test and the
* argument validator plugin test as they are basically equal
* in functionality.
*
* @param string $user_path
* The path to embed in user/[uid]/[user_path]_[access_type].
*
* @return void
*/
public function doDisplayAccessTests($user_path) {
// Define types of access.
$access_types = array(
'view',
'edit',
'delete',
);
// Get addresses for basic user.
$other_user_address_default = UcAddressesAddressBook::get($this->basicUser->uid)
->getDefaultAddress();
$other_user_address_other = UcAddressesAddressBook::get($this->basicUser->uid)
->getAddressByName($this->basicUser->uid . '_other');
foreach ($this->accounts as $account) {
$this
->drupalLogin($account);
$addressBook = UcAddressesAddressBook::get($account->uid);
$default_address = $addressBook
->getDefaultAddress();
$other_address = $addressBook
->getAddressByName($account->uid . '_other');
// Test access per access type.
foreach ($access_types as $access_type) {
// Test for access for any own addresses.
$base_own_path = 'user/' . $account->uid . '/' . $user_path . '_' . $access_type;
$this
->drupalGet($base_own_path);
if ($access_type == 'view') {
// Take "view own default" permission.
$this
->assertAddressAccessResponse($account, $access_type, $account, TRUE);
}
else {
$this
->assertAddressAccessResponse($account, $access_type, $account);
}
// Test access for own default address.
$this
->drupalGet($base_own_path . '/' . $default_address
->getId());
$this
->assertAddressAccessResponse($account, $access_type, $account, TRUE);
// Test access for own non-default address.
$this
->drupalGet($base_own_path . '/' . $other_address
->getId());
$this
->assertAddressAccessResponse($account, $access_type, $account);
// Test for access for any addresses of an other user.
$base_other_path = 'user/' . $this->basicUser->uid . '/' . $user_path . '_' . $access_type;
$this
->drupalGet($base_other_path);
if ($access_type == 'view') {
// Take "view all default" permission.
$this
->assertAddressAccessResponse($account, $access_type, $this->basicUser, TRUE);
}
else {
$this
->assertAddressAccessResponse($account, $access_type, $this->basicUser);
}
// Test access for default address of an other user.
$this
->drupalGet($base_other_path . '/' . $other_user_address_default
->getId());
$this
->assertAddressAccessResponse($account, $access_type, $this->basicUser, TRUE);
// Test access for non-default address of an other user.
$this
->drupalGet($base_other_path . '/' . $other_user_address_other
->getId());
$this
->assertAddressAccessResponse($account, $access_type, $this->basicUser);
}
}
}
/**
* Pass if the user with access get's a 200 and 403 if the user should
* not have access.
*
* @param object $account
* The current logged in user.
* @param string $access_type
* The permission to check: view, edit or delete.
* @param string $owner
* The address owner.
* @param boolean $is_default_address
* (optional) If access is checked for a default address or not.
*/
protected function assertAddressAccessResponse($account, $access_type, $owner, $is_default_address = FALSE) {
// Prepare assert message.
$access_own = $account->uc_addresses_permissions[$access_type . '_own'];
$access_all = $account->uc_addresses_permissions[$access_type . '_all'];
switch ($access_type) {
case 'view':
if ($is_default_address) {
$access_own = $account->uc_addresses_permissions['view_own_def'];
$access_all = $account->uc_addresses_permissions['view_all_def'];
}
break;
case 'delete':
if ($is_default_address) {
$access_own = FALSE;
$access_all = FALSE;
}
break;
}
$message_vars = array(
'!name' => check_plain($account->name),
'!access_type' => $access_type,
'!access_own' => $access_own ? '' : 'NOT ',
'!access_all' => $access_all ? '' : 'NOT ',
'!default' => $is_default_address ? ' default' : '',
);
if ($account->uid == $owner->uid) {
$message = strtr('User !name may !access_own!access_type own!default addresses.', $message_vars);
$this
->assertResponse($access_own ? 200 : 403, $message);
}
else {
$message = strtr('User !name may !access_all!access_type all!default addresses.', $message_vars);
$this
->assertResponse($access_all ? 200 : 403, $message);
}
}
/**
* Tests if the row plugin works as expected.
*/
function testAddressRowStyle() {
// Setup View.
$view = $this
->createAddressRowStyleView();
// Test Views page for each type of user.
foreach ($this->accounts as $account) {
$this
->drupalLogin($account);
$addressBook = UcAddressesAddressBook::get($account->uid);
$default_address = $addressBook
->getDefaultAddress();
$other_address = $addressBook
->getAddressByName($account->uid . '_other');
// Go to Views page with the user's default address.
$this
->drupalGet('uc_addresses/address-row-style/' . $default_address
->getId());
$this
->assertAddressLabel($default_address);
// Assert that the "default" label is presented.
$this
->assertText(t('Default billing address'));
// Assert view, edit and delete links.
if ($account->uc_addresses_permissions['view_own_def']) {
$this
->assertLink(t('View address'));
}
else {
$this
->assertNoLink(t('View address'));
}
if ($account->uc_addresses_permissions['edit_own']) {
$this
->assertLink(t('Edit address'));
}
else {
$this
->assertNoLink(t('Edit address'));
}
$this
->assertNoLink(t('Delete address'));
// Go to Views page with the user's other address.
$this
->drupalGet('uc_addresses/address-row-style/' . $other_address
->getId());
$this
->assertAddressLabel($other_address);
// Assert that the "default" label is NOT presented.
$this
->assertNoText(t('Default billing address'));
// Assert view, edit and delete links.
if ($account->uc_addresses_permissions['view_own']) {
$this
->assertLink(t('View address'));
}
else {
$this
->assertNoLink(t('View address'));
}
if ($account->uc_addresses_permissions['edit_own']) {
$this
->assertLink(t('Edit address'));
}
else {
$this
->assertNoLink(t('Edit address'));
}
if ($account->uc_addresses_permissions['delete_own']) {
$this
->assertLink(t('Delete address'));
}
else {
$this
->assertNoLink(t('Delete address'));
}
}
// Login as an user that may view, edit and delete all addresses.
$account = $this->accounts['adminAll'];
$this
->drupalLogin($account);
$addressBook = UcAddressesAddressBook::get($account->uid);
$default_address = $addressBook
->getDefaultAddress();
$other_address = $addressBook
->getAddressByName($account->uid . '_other');
// Turn off all options of the address row style.
$display = $view->display['default'];
$display->display_options['row_options']['view_link'] = 0;
$display->display_options['row_options']['edit_link'] = 0;
$display->display_options['row_options']['delete_link'] = 0;
$display->display_options['row_options']['default_flags'] = 0;
// Save View.
$view
->save();
// Go to Views page with the user's default address again and
// ensure various elements are gone now.
$this
->drupalGet('uc_addresses/address-row-style/' . $default_address
->getId());
$this
->assertAddressLabel($default_address);
$this
->assertNoText(t('Default billing address'));
$this
->assertNoLink(t('View address'));
$this
->assertNoLink(t('Edit address'));
$this
->assertNoLink(t('Delete address'));
// Do the same for the user's other address.
$this
->drupalGet('uc_addresses/address-row-style/' . $other_address
->getId());
$this
->assertAddressLabel($other_address);
$this
->assertNoText(t('Default billing address'));
$this
->assertNoLink(t('View address'));
$this
->assertNoLink(t('Edit address'));
$this
->assertNoLink(t('Delete address'));
}
/**
* Creates a View for access filters test.
*
* @return object
* The created View.
*/
protected function createAccessFiltersView() {
$view = new view();
$view->name = 'uc_addresses_access_filters';
$view->description = 'Used to test if address access filters work as expected.';
$view->tag = 'default';
$view->base_table = 'uc_addresses';
$view->human_name = 'uc_addresses_access_filters';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
/* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Ubercart Addresses: Address ID */
$handler->display->display_options['fields']['aid']['id'] = 'aid';
$handler->display->display_options['fields']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['aid']['field'] = 'aid';
/* Field: Ubercart Addresses: Address name */
$handler->display->display_options['fields']['address_name']['id'] = 'address_name';
$handler->display->display_options['fields']['address_name']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['address_name']['field'] = 'address_name';
/* Display: uc_addresses_view_access */
$handler = $view
->new_display('page', 'uc_addresses_view_access', 'page_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Ubercart Addresses: Access */
$handler->display->display_options['filters']['access_view']['id'] = 'access_view';
$handler->display->display_options['filters']['access_view']['table'] = 'uc_addresses';
$handler->display->display_options['filters']['access_view']['field'] = 'access_view';
$handler->display->display_options['filters']['access_view']['value'] = '1';
$handler->display->display_options['path'] = 'uc_addresses/view';
/* Display: uc_addresses_edit_access */
$handler = $view
->new_display('page', 'uc_addresses_edit_access', 'page_2');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Ubercart Addresses: Edit access */
$handler->display->display_options['filters']['access_edit']['id'] = 'access_edit';
$handler->display->display_options['filters']['access_edit']['table'] = 'uc_addresses';
$handler->display->display_options['filters']['access_edit']['field'] = 'access_edit';
$handler->display->display_options['filters']['access_edit']['value'] = '1';
$handler->display->display_options['path'] = 'uc_addresses/edit';
/* Display: uc_addresses_delete_access */
$handler = $view
->new_display('page', 'uc_addresses_delete_access', 'page_3');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Ubercart Addresses: Delete access */
$handler->display->display_options['filters']['access_delete']['id'] = 'access_delete';
$handler->display->display_options['filters']['access_delete']['table'] = 'uc_addresses';
$handler->display->display_options['filters']['access_delete']['field'] = 'access_delete';
$handler->display->display_options['filters']['access_delete']['value'] = '1';
$handler->display->display_options['path'] = 'uc_addresses/delete';
// Save View.
$view
->save();
return $view;
}
/**
* Creates a View for Action links test.
*
* @return object
* The created View.
*/
protected function createActionLinksView() {
$view = new view();
$view->name = 'uc_addresses_action_links';
$view->description = 'Used to test if address action links work as expected.';
$view->tag = 'default';
$view->base_table = 'uc_addresses';
$view->human_name = 'uc_addresses_action_links';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
/* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Ubercart Addresses: Address ID */
$handler->display->display_options['fields']['aid']['id'] = 'aid';
$handler->display->display_options['fields']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['aid']['field'] = 'aid';
/* Field: Ubercart Addresses: Address name */
$handler->display->display_options['fields']['address_name']['id'] = 'address_name';
$handler->display->display_options['fields']['address_name']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['address_name']['field'] = 'address_name';
/* Field: Ubercart Addresses: Link */
$handler->display->display_options['fields']['view']['id'] = 'view';
$handler->display->display_options['fields']['view']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['view']['field'] = 'view';
/* Field: Ubercart Addresses: Edit link */
$handler->display->display_options['fields']['edit']['id'] = 'edit';
$handler->display->display_options['fields']['edit']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['edit']['field'] = 'edit';
/* Field: Ubercart Addresses: Delete link */
$handler->display->display_options['fields']['delete']['id'] = 'delete';
$handler->display->display_options['fields']['delete']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['delete']['field'] = 'delete';
/* Display: Page */
$handler = $view
->new_display('page', 'Page', 'page_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'uc_addresses/action-links';
// Save View.
$view
->save();
return $view;
}
/**
* Creates a View for Display access test.
*
* @return object
* The created View.
*/
protected function createDisplayAccessView() {
$view = new view();
$view->name = 'uc_addresses_display_access';
$view->description = 'Used to test if display access restrictions work as expected.';
$view->tag = 'default';
$view->base_table = 'uc_addresses';
$view->human_name = 'uc_addresses_display_access';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
/* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Ubercart Addresses: Address ID */
$handler->display->display_options['fields']['aid']['id'] = 'aid';
$handler->display->display_options['fields']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['aid']['field'] = 'aid';
/* Field: Ubercart Addresses: Address name */
$handler->display->display_options['fields']['address_name']['id'] = 'address_name';
$handler->display->display_options['fields']['address_name']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['address_name']['field'] = 'address_name';
/* Contextual filter: Ubercart Addresses: User ID */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['uid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['uid']['validate']['type'] = 'user';
/* Contextual filter: Ubercart Addresses: Address ID */
$handler->display->display_options['arguments']['aid']['id'] = 'aid';
$handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['aid']['field'] = 'aid';
$handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
/* Display: uc_addresses_view_access */
$handler = $view
->new_display('page', 'uc_addresses_view_access', 'uc_addresses_view_access');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['access'] = FALSE;
$handler->display->display_options['access']['type'] = 'uc_addresses_views_access';
$handler->display->display_options['access']['uid_argument'] = 'uid';
$handler->display->display_options['access']['aid_argument'] = 'aid';
$handler->display->display_options['path'] = 'user/%/uc_addresses_display_access_view';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'AddressBookView';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
/* Display: uc_addresses_edit_access */
$handler = $view
->new_display('page', 'uc_addresses_edit_access', 'uc_addresses_edit_access');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['access'] = FALSE;
$handler->display->display_options['access']['type'] = 'uc_addresses_views_access';
$handler->display->display_options['access']['uid_argument'] = 'uid';
$handler->display->display_options['access']['aid_argument'] = 'aid';
$handler->display->display_options['access']['access_type'] = 'edit';
$handler->display->display_options['path'] = 'user/%/uc_addresses_display_access_edit';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'AddressBookEdit';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
/* Display: uc_addresses_delete_access */
$handler = $view
->new_display('page', 'uc_addresses_delete_access', 'uc_addresses_delete_access');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['access'] = FALSE;
$handler->display->display_options['access']['type'] = 'uc_addresses_views_access';
$handler->display->display_options['access']['uid_argument'] = 'uid';
$handler->display->display_options['access']['aid_argument'] = 'aid';
$handler->display->display_options['access']['access_type'] = 'delete';
$handler->display->display_options['path'] = 'user/%/uc_addresses_display_access_delete';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'AddressBookDelete';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
// Save View.
$view
->save();
return $view;
}
/**
* Creates a View for Argument validator test.
*
* @return object
* The created View.
*/
public function createArgumentValidatorView() {
$view = new view();
$view->name = 'uc_addresses_argument_validator';
$view->description = 'Used to test if display access restrictions work as expected.';
$view->tag = 'default';
$view->base_table = 'uc_addresses';
$view->human_name = 'uc_addresses_argument_validator';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
/* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Ubercart Addresses: Address ID */
$handler->display->display_options['fields']['aid']['id'] = 'aid';
$handler->display->display_options['fields']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['aid']['field'] = 'aid';
/* Field: Ubercart Addresses: Address name */
$handler->display->display_options['fields']['address_name']['id'] = 'address_name';
$handler->display->display_options['fields']['address_name']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['address_name']['field'] = 'address_name';
/* Display: uc_addresses_view_access */
$handler = $view
->new_display('page', 'uc_addresses_view_access', 'uc_addresses_view_access');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Ubercart Addresses: User ID */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['uid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['uid']['validate']['type'] = 'uc_addresses_user_address_access';
$handler->display->display_options['arguments']['uid']['validate']['fail'] = 'access denied';
/* Contextual filter: Ubercart Addresses: Address ID */
$handler->display->display_options['arguments']['aid']['id'] = 'aid';
$handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['aid']['field'] = 'aid';
$handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['aid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['aid']['validate']['type'] = 'uc_addresses_address_access';
$handler->display->display_options['arguments']['aid']['validate']['fail'] = 'access denied';
$handler->display->display_options['path'] = 'user/%/uc_addresses_argument_validator_view';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'AddressBookView';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
/* Display: uc_addresses_edit_access */
$handler = $view
->new_display('page', 'uc_addresses_edit_access', 'uc_addresses_edit_access');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Ubercart Addresses: User ID */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['uid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['uid']['validate']['type'] = 'uc_addresses_user_address_access';
$handler->display->display_options['arguments']['uid']['validate_options']['access_type'] = 'edit';
$handler->display->display_options['arguments']['uid']['validate']['fail'] = 'access denied';
/* Contextual filter: Ubercart Addresses: Address ID */
$handler->display->display_options['arguments']['aid']['id'] = 'aid';
$handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['aid']['field'] = 'aid';
$handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['aid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['aid']['validate']['type'] = 'uc_addresses_address_access';
$handler->display->display_options['arguments']['aid']['validate_options']['access_type'] = 'edit';
$handler->display->display_options['arguments']['aid']['validate']['fail'] = 'access denied';
$handler->display->display_options['path'] = 'user/%/uc_addresses_argument_validator_edit';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'AddressBookEdit';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
/* Display: uc_addresses_delete_access */
$handler = $view
->new_display('page', 'uc_addresses_delete_access', 'uc_addresses_delete_access');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Ubercart Addresses: User ID */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['uid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['uid']['validate']['type'] = 'uc_addresses_user_address_access';
$handler->display->display_options['arguments']['uid']['validate_options']['access_type'] = 'delete';
$handler->display->display_options['arguments']['uid']['validate']['fail'] = 'access denied';
/* Contextual filter: Ubercart Addresses: Address ID */
$handler->display->display_options['arguments']['aid']['id'] = 'aid';
$handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['aid']['field'] = 'aid';
$handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['aid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['aid']['validate']['type'] = 'uc_addresses_address_access';
$handler->display->display_options['arguments']['aid']['validate_options']['access_type'] = 'delete';
$handler->display->display_options['arguments']['aid']['validate']['fail'] = 'access denied';
$handler->display->display_options['path'] = 'user/%/uc_addresses_argument_validator_delete';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'AddressBookDelete';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
// Save View.
$view
->save();
return $view;
}
/**
* Creates a View for address row style View.
*/
public function createAddressRowStyleView() {
$view = new view();
$view->name = 'uc_addresses_address_row_style';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'uc_addresses';
$view->human_name = 'uc_addresses_address_row_style';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
/* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'uc_addresses';
$handler->display->display_options['row_options']['view_link'] = 1;
$handler->display->display_options['row_options']['edit_link'] = 1;
$handler->display->display_options['row_options']['delete_link'] = 1;
$handler->display->display_options['row_options']['default_flags'] = 1;
/* Field: Ubercart Addresses: Address ID */
$handler->display->display_options['fields']['aid']['id'] = 'aid';
$handler->display->display_options['fields']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['fields']['aid']['field'] = 'aid';
/* Contextual filter: Ubercart Addresses: Address ID */
$handler->display->display_options['arguments']['aid']['id'] = 'aid';
$handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
$handler->display->display_options['arguments']['aid']['field'] = 'aid';
$handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
/* Display: Page */
$handler = $view
->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'uc_addresses/address-row-style/%';
// Save View.
$view
->save();
return $view;
}
/**
* Tests if the default view works as expected.
*/
public function testDefaultView() {
// Enable the default view.
$view = views_get_view('uc_addresses_address_book');
$view->disabled = FALSE;
$view
->save();
// Get addresses for basic user.
$other_user_address_default = UcAddressesAddressBook::get($this->basicUser->uid)
->getDefaultAddress();
$other_user_address_other = UcAddressesAddressBook::get($this->basicUser->uid)
->getAddressByName($this->basicUser->uid . '_other');
foreach ($this->accounts as $account) {
$this
->drupalLogin($account);
$addressBook = UcAddressesAddressBook::get($account->uid);
$default_address = $addressBook
->getDefaultAddress();
$other_address = $addressBook
->getAddressByName($account->uid . '_other');
// Test if the user can view his/her own address book if he/she
// has access.
$this
->viewAddressBook($account, $account->uc_addresses_permissions['view_own_def']);
// Test if the user's default address is displayed when the user
// may view his/her own default addresses.
if ($account->uc_addresses_permissions['view_own_def']) {
$this
->assertAddressLabel($default_address);
// Ensure the View is used to display the address book.
$this
->assertRaw('view-uc-addresses-address-book');
}
else {
$this
->assertNoAddressLabel($default_address);
}
// Test if the user's other address is displayed when the user
// may view all of his/her own addresses.
if ($account->uc_addresses_permissions['view_own']) {
$this
->assertAddressLabel($other_address);
}
else {
$this
->assertNoAddressLabel($other_address);
}
// Test if the user can view other address books if he/she is allowed
// to view them.
$this
->viewAddressBook($this->basicUser, $account->uc_addresses_permissions['view_all_def']);
// Test if the other user's default address is displayed when
// the user may view all default addresses.
if ($account->uc_addresses_permissions['view_all_def']) {
$this
->assertAddressLabel($other_user_address_default);
}
else {
$this
->assertNoAddressLabel($other_user_address_default);
}
// Test if the other user's other address is displayed when
// the user may view all addresses.
if ($account->uc_addresses_permissions['view_all']) {
$this
->assertAddressLabel($other_user_address_other);
}
else {
$this
->assertNoAddressLabel($other_user_address_other);
}
}
}
}
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:: |
public | property | Current results of this test case. | |
DrupalTestCase:: |
protected | property | Flag to indicate whether the test has been set up. | |
DrupalTestCase:: |
protected | property | ||
DrupalTestCase:: |
protected | property | ||
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:: |
public | property | Whether to cache the installation part of the setUp() method. | |
DrupalTestCase:: |
public | property | Whether to cache the modules installation part of the setUp() method. | |
DrupalTestCase:: |
protected | property | URL to the verbose output file directory. | |
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. | 1 |
DrupalTestCase:: |
public | function | Handle errors during test runs. | 1 |
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 | Returns the database connection to the site running Simpletest. | |
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 a 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 cookies of the page currently loaded in the internal browser. | |
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 shutdown handlers array, before it was cleaned for testing purposes. | |
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. | 20 |
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 doesn't exist or its value doesn't match, by 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 | Asserts themed output. | |
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 | Changes the database connection to the prefixed one. | |
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 | Copy the setup cache from/to another table and files directory. | |
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 | Creates a role with specified permissions. | |
DrupalWebTestCase:: |
protected | function | Create a user with a given set of permissions. | |
DrupalWebTestCase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Retrieve a Drupal path or an absolute path and JSON decode the result. | |
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 | Execute an Ajax submission. | |
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 | Returns the cache key used for the setup caching. | |
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 | Copies the cached tables and files for a cached installation setup. | |
DrupalWebTestCase:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
DrupalWebTestCase:: |
protected | function | Preload the registry from the testing site. | |
DrupalWebTestCase:: |
protected | function | Generates a database prefix for running tests. | |
DrupalWebTestCase:: |
protected | function | Prepares the current environment for running the test. | |
DrupalWebTestCase:: |
protected | function | Recursively copy one directory to another. | |
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. | 1 |
DrupalWebTestCase:: |
protected | function | Reset all data structures after having enabled new modules. | |
DrupalWebTestCase:: |
protected | function | Store the installation setup to a cache. | |
DrupalWebTestCase:: |
protected | function | Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix. | 6 |
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:: |
1 | |
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:: |
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. | |
UcAddressesViewsTestCase:: |
protected | property | Array of accounts. | |
UcAddressesViewsTestCase:: |
protected | function | Pass if the user with access get's a 200 and 403 if the user should not have access. | |
UcAddressesViewsTestCase:: |
protected | function | Creates a View for access filters test. | |
UcAddressesViewsTestCase:: |
protected | function | Creates a View for Action links test. | |
UcAddressesViewsTestCase:: |
public | function | Creates a View for address row style View. | |
UcAddressesViewsTestCase:: |
public | function | Creates a View for Argument validator test. | |
UcAddressesViewsTestCase:: |
protected | function | Creates a View for Display access test. | |
UcAddressesViewsTestCase:: |
protected | function | Tests if the address access filters work for one particular account. | |
UcAddressesViewsTestCase:: |
protected | function | Tests if the right actions links are displayed for one particular account. | |
UcAddressesViewsTestCase:: |
public | function | Tests for each user if he/she should have access to pages: | |
UcAddressesViewsTestCase:: |
public static | function | Describes this test. | |
UcAddressesViewsTestCase:: |
public | function |
Setup. Overrides UcAddressesTestCase:: |
|
UcAddressesViewsTestCase:: |
public | function | Tests if the address access filters work as expected. | |
UcAddressesViewsTestCase:: |
public | function | Tests if the view, edit and delete links are only displayed for users that are allowed to perform these tasks. | |
UcAddressesViewsTestCase:: |
function | Tests if the row plugin works as expected. | ||
UcAddressesViewsTestCase:: |
public | function | Tests if the argument validator plugins work as expected. | |
UcAddressesViewsTestCase:: |
public | function | Tests if the default view works as expected. | |
UcAddressesViewsTestCase:: |
public | function | Tests if the display access plugin works as expected. | |
UcAddressesViewsTestCase:: |
protected | function | Create users, each with different uc_addresses permissions. |