75 lines
3.6 KiB
Text
75 lines
3.6 KiB
Text
<?php
|
|
/**
|
|
* @file
|
|
* Tests for the SuiteDesk module
|
|
*/
|
|
class StormTestCase extends DrupalWebTestCase {
|
|
public static function getInfo() {
|
|
return array(
|
|
'name' => 'SuiteDesk functionality',
|
|
'description' => 'Test the functionality of the SuiteDesk base module',
|
|
'group' => 'Storm',
|
|
);
|
|
}
|
|
|
|
public function setUp() {
|
|
parent::setUp('dashboard');
|
|
}
|
|
|
|
public function testStormAccess() {
|
|
$this->drupalGet('dashboard');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk dashboard for anonymous user'));
|
|
|
|
$basic_user = $this->drupalCreateUser();
|
|
$this->drupalLogin($basic_user);
|
|
$this->drupalGet('dashboard');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk dashboard for basic user'));
|
|
|
|
$privileged_user = $this->drupalCreateUser(array('Storm: access dashboard'));
|
|
$this->drupalLogin($privileged_user);
|
|
$this->drupalGet('dashboard');
|
|
$this->assertText(t('SuiteDesk dashboard'), t('Make sure the correct page has been displayed by checking that the title is "SuiteDesk dashboard".'));
|
|
}
|
|
|
|
public function testStormAccessSettings() {
|
|
$this->drupalGet('admin/settings/storm');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for anonymous user'));
|
|
$this->drupalGet('admin/settings/suitedesk/suitedesk');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for anonymous user'));
|
|
|
|
$basic_user = $this->drupalCreateUser();
|
|
$this->drupalLogin($basic_user);
|
|
$this->drupalGet('admin/settings/storm');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for basic user'));
|
|
$this->drupalGet('admin/settings/suitedesk/suitedesk');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk settings page for basic user'));
|
|
|
|
$privileged_user = $this->drupalCreateUser(array('Storm: access administration pages'));
|
|
$this->drupalLogin($privileged_user);
|
|
$this->drupalGet('admin/settings/storm');
|
|
$this->assertText(t('SuiteDesk'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "SuiteDesk".'));
|
|
$this->drupalGet('admin/settings/suitedesk/suitedesk');
|
|
$this->assertText(t('SuiteDesk'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "SuiteDesk".'));
|
|
}
|
|
|
|
public function testStormAttributesAccess() {
|
|
$this->drupalGet('attributes');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes list for anonymous user'));
|
|
$this->drupalGet('attributes/add');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes form for anonymous user'));
|
|
|
|
$basic_user = $this->drupalCreateUser();
|
|
$this->drupalLogin($basic_user);
|
|
$this->drupalGet('attributes');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes list for basic user'));
|
|
$this->drupalGet('attributes/add');
|
|
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Attributes form for basic user'));
|
|
|
|
$privileged_user = $this->drupalCreateUser(array('Storm: access administration pages'));
|
|
$this->drupalLogin($privileged_user);
|
|
$this->drupalGet('attributes');
|
|
$this->assertText(t('Attributes'), t('Make sure the correct page has been displayed by checking that the title is "Attributes".'));
|
|
$this->drupalGet('attributes/add');
|
|
$this->assertText(t('Add a new attribute'), t('Make sure the correct page has been displayed by checking that the title is "Add a new attribute".'));
|
|
}
|
|
}
|