View source
<?php
require_once dirname(__FILE__) . '/heartbeatwebtestcase.inc';
class HeartbeatAdminTools extends HeartbeatWebTestCase {
function setUp() {
parent::setUp('heartbeat', 'heartbeattest');
}
function getInfo() {
return array(
'name' => t('Heartbeat administration tools'),
'description' => t('Test heartbeat administration tools.'),
'group' => t('Heartbeat'),
);
}
function testImport() {
$this
->drupalLogin($this
->drupalCreateUser($this->testRoles));
$this
->drupalGet('admin/build/heartbeat');
$this
->assertText('heartbeattest_add_node', t('The test message template we are using is imported and available.'), t('Heartbeat'));
$this
->drupalGet('admin/build/heartbeat/stream/privateheartbeat');
$type = heartbeat_stream_load('privateheartbeat');
$this
->assertEqual(15, $type['settings']['page_items_max'], t('Items per page default value is correct'), t('Heartbeat'));
$this
->assertEqual(1, $type['settings']['page_pager_ajax'], t('Ajax default setting for pages is correct'), t('Heartbeat'));
$edit = array(
'page_items_max' => 2,
'page_show_pager' => FALSE,
'page_pager_ajax' => FALSE,
);
$this
->drupalPost('admin/build/heartbeat/stream/privateheartbeat', $edit, t('Submit'));
$type = heartbeat_stream_load('privateheartbeat');
$this
->assertEqual($edit['page_items_max'], $type['settings']['page_items_max'], t('Items per page is set correctly'), t('Heartbeat'));
$this
->assertEqual($edit['page_show_pager'], $type['settings']['page_show_pager'], t('Show pager is set correctly'), t('Heartbeat'));
$this
->assertEqual($edit['page_pager_ajax'], $type['settings']['page_pager_ajax'], t('Ajax setting is set correctly'), t('Heartbeat'));
$this
->drupalGet('admin/build/heartbeat/stream/privateheartbeat');
$this
->drupalPost('admin/build/heartbeat/stream/privateheartbeat/clone', array(
'stream_name' => 'My Personal Activity',
), t('Clone stream'));
$this
->drupalGet('admin/build/heartbeat/streams');
$this
->assertText('My Personal Activity', t('The stream is cloned.'), t('Heartbeat'));
$edit2 = array(
'page_items_max' => 20,
'page_show_pager' => TRUE,
'page_pager_ajax' => TRUE,
);
$this
->drupalPost('admin/build/heartbeat/stream/mypersonalactivity', $edit2, t('Submit'));
$type2 = heartbeat_stream_load('mypersonalactivity');
$this
->assertEqual($edit2['page_items_max'], $type2['settings']['page_items_max'], t('Items per page is set correctly'), t('Heartbeat'));
$this
->assertEqual($edit2['page_show_pager'], $type2['settings']['page_show_pager'], t('Show pager is set correctly'), t('Heartbeat'));
$this
->assertEqual($edit2['page_pager_ajax'], $type2['settings']['page_pager_ajax'], t('Ajax setting is set correctly'), t('Heartbeat'));
$this
->drupalGet('admin/build/heartbeat/stream/privateheartbeat');
$type = heartbeat_stream_load('privateheartbeat');
$this
->assertEqual($edit['page_items_max'], $type['settings']['page_items_max'], t('Items per page is set correctly'), t('Heartbeat'));
$this
->assertEqual($edit['page_show_pager'], $type['settings']['page_show_pager'], t('Show pager is set correctly'), t('Heartbeat'));
}
}