public function SecureSiteFunctionUserLoadUnitTest::testSecureSiteUserLoadUID in Secure Site 7.2
Same name and namespace in other branches
- 6.2 securesite.test \SecureSiteFunctionUserLoadUnitTest::testSecureSiteUserLoadUID()
Load user without password.
File
- ./
securesite.test, line 477 - Tests for Secure Site module.
Class
- SecureSiteFunctionUserLoadUnitTest
- Unit tests for user_load().
Code
public function testSecureSiteUserLoadUID() {
// Added by sime in D7 upgrade.
// @todo Coder module instructs that we should convert "user_load" to "user_load_multiple" if "$this->user->uid" is other than a uid. To return a single user object, wrap "user_load_multiple" with "array_shift" or equivalent. Example: array_shift(user_load_multiple(array(), $this->user->uid)) -- HOWEVER I'm not sure how to do this yet since this is not appararently returning anything.
// @todo Look at how user tests work in D7.
// Old test
// user_load($this->user->uid);
// $command = "$this->stored_passwords $this->name_arg $this->pass_arg $this->realm_arg";
// $this->assertTrue(exec($command) == $this->user->name . " not found in $this->realm.", t('Loading user without password.'));
// New test
$accounts = user_load_multiple(array(), array(
'uid' => $this->user->uid,
));
// $new_user = reset($accounts); // Needed?
$command = "{$this->stored_passwords} {$this->name_arg} {$this->pass_arg} {$this->realm_arg}";
$this
->assertTrue(exec($command) == $this->user->name . " not found in {$this->realm}.", t('Loading user without password.'));
}