heartbeat.api.test in Heartbeat 6.4
File
tests/heartbeat.api.test
View source
<?php
require_once dirname(__FILE__) . '/heartbeatwebtestcase.inc';
class HeartbeatAPITest extends HeartbeatWebTestCase {
function setUp() {
parent::setUp('heartbeat', 'heartbeattest');
}
function getInfo() {
return array(
'name' => t('Heartbeat API'),
'description' => t('Tests for heartbeat API.'),
'group' => t('Heartbeat'),
);
}
function testHeartbeatAPILog() {
$this
->drupalLogin($this
->drupalCreateUser($this->testRoles));
$page_node = $this
->drupalCreateNode(array(
'type' => 'page',
'title' => 'MyPageTitle',
));
$count_logs = db_result(db_query("SELECT COUNT(uaid) FROM {heartbeat_activity}"));
$this
->assertEqual(1, $count_logs, t('Number of activity messages ( ' . $count_logs . ') matches the number of logs.'), t('Heartbeat'));
$this
->drupalGet('heartbeat/publicheartbeat');
$this
->assertText('MyPageTitle', t('The page title is displayed in the public heartbeat stream.'), t('Heartbeat'));
$this
->drupalGet('heartbeat/privateheartbeat');
$this
->assertText('MyPageTitle', t('The page title is displayed in the private heartbeat stream.'), t('Heartbeat'));
$page_node2 = $this
->drupalCreateNode(array(
'type' => 'page',
'title' => 'MySecondPage',
));
$count_logs = db_result(db_query("SELECT COUNT(uaid) FROM {heartbeat_activity}"));
$this
->assertEqual(2, $count_logs, t('Number of activity messages ( ' . $count_logs . ') matches the number of logs.'), t('Heartbeat'));
}
}