View source
<?php
class BlockRefreshSettingsTestCase extends DrupalWebTestCase {
protected $privileged_user;
public static function getInfo() {
return array(
'name' => 'Block Refresh Block config settings form',
'description' => 'Ensure block refresh settings appear on the block config page.',
'group' => 'Block Refresh',
);
}
public function setUp() {
parent::setUp(array(
'block_refresh',
'block_refresh_demo',
));
$this->privileged_user = $this
->drupalCreateUser(array(
'administer blocks',
));
$this
->drupalLogin($this->privileged_user);
$this->regions = array();
$this->regions[] = 'header';
$this->regions[] = 'sidebar_first';
$this->regions[] = 'content';
$this->regions[] = 'sidebar_second';
$this->regions[] = 'footer';
}
public function testBlockRefreshConfigureForm() {
$configure_path = 'admin/structure/block/manage/block_refresh_demo/block_refresh_demo/configure';
$this
->drupalGet($configure_path);
$this
->assertText('Block refresh settings');
$this
->assertText('Enable block to be refreshed automatically');
$this
->assertFieldById('edit-block-refresh-auto');
$this
->assertText('Block refresh timer');
$this
->assertFieldById('edit-block-refresh-timer');
$this
->assertText('Enable block to be refreshed manually');
$this
->assertFieldById('edit-block-refresh-manual');
$this
->assertText('Enable block to be refreshed on page load');
$this
->assertFieldById('edit-block-refresh-init');
$this
->assertText('Send page path arguments to block');
$this
->assertFieldById('edit-block-refresh-arguments');
$this
->assertText('Enable block to be used in Panels');
$this
->assertFieldById('edit-block-refresh-panels');
$this
->assertText('Bypass Drupal page cache');
$this
->assertFieldById('edit-block-refresh-bypass-page-cache');
$this
->assertText('External cache max age');
$this
->assertFieldById('edit-block-refresh-bypass-external-cache');
$edit_auto = array(
'block_refresh_auto' => '0',
);
$this
->drupalPost($configure_path, $edit_auto, t('Save block'));
$settings = variable_get('block_refresh_settings');
}
}