function PrivatemsgGroupsTestCase::testDeleteUser in Privatemsg 7.2
Verify that deleting a user does not leave stale data behind.
File
- privatemsg_groups/
privatemsg_groups.test, line 345 - This file contains tests for the privatemsg groups module
Class
- PrivatemsgGroupsTestCase
- Test cases for the privatemsg_groups module.
Code
function testDeleteUser() {
// Send a message to group 1.
$this
->drupalLogin($this->group1_manager);
$edit = array(
'recipient' => $this->group1->title . '[group]',
'subject' => $this
->randomName(10),
'body[value]' => $this
->randomName(50),
);
$this
->drupalPost('messages/new', $edit, t('Send message'));
$this
->assertText(t('A message has been sent to @group (group).', array(
'@group' => $this->group1->title,
)));
$this
->drupalLogin($this->user1);
$this
->drupalGet('messages');
$this
->assertText($edit['subject'], t('Message sent to group is visible.'));
// Delete user and make sure that no recipient entries of him are left in
// table.
user_delete($this->user1->uid);
$this
->assertFalse(db_query_range("SELECT 1 FROM {pm_index} WHERE recipient = :recipient AND type IN ('user', 'hidden')", 0, 1, array(
':recipient' => $this->user1->uid,
))
->fetchField());
}