Skip to content

Commit

Permalink
Issue #777168 by Berdir, effulgentsia: Fixed Notice: Undefined proper…
Browse files Browse the repository at this point in the history
…ty: stdClass:: in profile_user_presave().
  • Loading branch information
webchick committed Nov 12, 2011
1 parent d1e35f3 commit 775d4d3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/profile/profile.module
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function profile_block_view($delta = '') {
* Implements hook_user_presave().
*/
function profile_user_presave(&$edit, $account, $category) {
if ($account->uid) {
if (!empty($account->uid)) {
profile_save_profile($edit, $account, $category);
}
}
Expand Down
40 changes: 40 additions & 0 deletions modules/profile/profile.test
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,46 @@ class ProfileTestBrowsing extends ProfileTestCase {
}
}

/**
* Test profile integration with user CRUD operations.
*/
class ProfileCrudTestCase extends ProfileTestCase {
public static function getInfo() {
return array(
'name' => 'Profile CRUD tests',
'description' => 'Test profile integration with user create, read, update, delete.',
'group' => 'Profile',
);
}

/**
* Test profile integration with user CRUD operations.
*/
public function testUserCRUD() {
// @todo Add profile fields in addition to base user properties.
$edit = array(
'name' => 'Test user',
'mail' => 'test@example.com',
);

// Create.
// @todo Add assertions.
$account = user_save(NULL, $edit);

// Read.
// @todo Add assertions.
$account = user_load($account->uid);

// Update.
// @todo Add assertions.
$account = user_save($account, $edit);

// Delete.
// @todo Add assertions.
user_delete($account->uid);
}
}

/**
* TODO:
* - Test field visibility
Expand Down

0 comments on commit 775d4d3

Please sign in to comment.