You are here

function HeartbeatFunctionalTest::testPollActivity in Heartbeat 6.4

Function to test the heartbeat poll for activity function

We're invoking the ajax menu callback with GET parameters and test the result as a normal page.

File

tests/heartbeat.functional.test, line 105

Class

HeartbeatFunctionalTest

Code

function testPollActivity() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser($this->testRoles));

  // Create page so heartbeattest.module can log activity through hook_nodeapi.
  $page_node = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'title' => 'MyPageTitle',
  ));

  // We cheat by resetting the most recent displayed uaid,
  // to make sure there is a newer message found.
  $options = array(
    'query' => 'stream=publicheartbeat&latestUaid=0&uaids=',
  );
  $this
    ->drupalGet('heartbeat/js/poll', $options);
  $this
    ->assertText('MyPageTitle', t('The page title is displayed in the public heartbeat stream ajax response.'), t('Heartbeat'));
}