protected function UcAddressesTestCase::UcAddressesCreateUser in Ubercart Addresses 7
Same name and namespace in other branches
- 6.2 tests/UcAddressesTestCase.test \UcAddressesTestCase::UcAddressesCreateUser()
Creates a single user and registers which permissions this user should get.
Parameters
string $name: The user's username.
array $permissions: (optional) The user's permissions.
boolean $view_own_def: (optional) If the user is supposed to see his own default addresses. Default to false.
boolean $view_own: (optional) If the user is supposed to see all of his own addresses. Default to false.
boolean $edit_own: (optional) If the user is supposed to edit all of his own addresses. Default to false.
boolean $delete_own: (optional) If the user is supposed to delete all of his own addresses. Default to false.
boolean $view_all_def: (optional) If the user is supposed to see his all default addresses. Default to false.
boolean $view_all: (optional) If the user is supposed to see all addresses. Default to false.
boolean $edit_all: (optional) If the user is supposed to edit all addresses. Default to false.
boolean $delete_all: (optional) If the user is supposed to delete all addresses. Default to false.
Return value
void
2 calls to UcAddressesTestCase::UcAddressesCreateUser()
- UcAddressesFeedsTest::test in tests/
uc_addresses.feeds.test - Test address creation.
- UcAddressesViewsTestCase::UcAddressesCreateUsers in tests/
uc_addresses.views.test - Create users, each with different uc_addresses permissions.
File
- tests/
UcAddressesTestCase.test, line 510 - Contains base class for Ubercart Addresses tests.
Class
- UcAddressesTestCase
- Base class for Ubercart Addresses tests.
Code
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) {
$account = $this
->drupalCreateUser($permissions);
$account->name = $name;
user_save($account);
$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;
}