function NotificationsUserTestCase::testNotificationDelivery in Notifications 7
File
- notifications_user/notifications_user.test, line 51
Class
- NotificationsUserTestCase
- Notifications User test case suite.
Code
function testNotificationDelivery() {
$this
->drupalLogin($this->subscriber);
$query = array(
$this->publisher->uid,
);
$this
->drupalGet('notifications/subscribe/user_content', array(
'query' => $query,
));
$edit = array();
$edit['send_method'] = 'simple';
$this
->drupalPost(NULL, $edit, t('Create subscription'));
$this
->drupalGet('user/' . $this->subscriber->uid . '/notifications');
$this
->assertText('You have 1 active subscriptions.', t('Subscription addition has been verified.'));
$this
->drupalCreateNode(array(
'type' => 'simple',
'title' => t('First published node'),
'uid' => $this->publisher->uid,
));
$this
->drupalGet('user/' . $this->subscriber->uid . '/messages');
$this
->assertText(t('First published node'), t('Notification has been received by the subscriber'));
$draft = $this
->drupalCreateNode(array(
'type' => 'simple',
'title' => t('Second unpublished node'),
'uid' => $this->publisher->uid,
'status' => 0,
));
$this
->drupalGet('user/' . $this->subscriber->uid . '/messages');
$this
->assertNoText(t('Second unpublished node'), t('Notification has not been received by the subscriber'));
$draft->title = t('Second published node');
$draft->notifications_status = TRUE;
$draft->notifications_content_disable = FALSE;
$draft->status = NODE_PUBLISHED;
node_save($draft);
$this
->drupalGet('user/' . $this->subscriber->uid . '/messages');
$this
->assertText(t('Second published node'), t('Notification has been received by the subscriber'));
$this
->drupalCreateNode(array(
'type' => 'simple',
'title' => t('Third published node'),
'uid' => $this->publisher->uid,
'status' => NODE_PUBLISHED,
'notifications_content_disable' => TRUE,
));
$this
->drupalGet('user/' . $this->subscriber->uid . '/messages');
$this
->assertNoText(t('Third published node'), t('Notification has not been received by the subscriber'));
$this
->drupalLogout();
}