Extracted text and test files from source code

This commit is contained in:
Manuel Cillero 2017-08-29 09:49:41 +02:00
parent 676a7ea81c
commit e7e66a9245
134 changed files with 0 additions and 14081 deletions

View file

@ -1,48 +0,0 @@
Storm module for Drupal 6.x
INSTALLATION:
1) Copy this 'storm' directory into the modules directory of your Drupal installation.
(Multisite installations may wish to use a different directory - see http://drupal.org/node/53705)
2) Enable Storm (and whatever submodules of Storm that you wish), by visiting http://example.com/admin/build/modules. You will (almost) always need 'Storm', 'Storm Attribute' and 'Storm Organization'.
3) To enable the pdf invoice feature, you must separately install the tcpdf library (http://www.tcpdf.org). The install directory can be set at /admin/settings/storm/invoice. If you do not install the tcpdf library, Storm will still work, but you will not be able to view pdf versions of invoices.
CONFIGURATION:
- Set up permissions: Initially, it is recommended that you allow full access for your administrative role, and allow more once you are familiar with the system.
- There are a number of settings forms linked from http://example.com/admin/settings/storm. After installation, you should visit these pages and
- Storm Attribute: This module gives additional settings for allowed field values, and values you can search for on the lists. In later versions of Storm, this may become part of the standard settings forms.
DISABLING / UNINSTALL:
1) Visit http://example.com/admin/build/modules in your web-browser and deselect the modules that you wish to disable. To uninstall, select the uninstall tab and follow the on screen instructions.
2) Warnings may appear on disabling stating that nodes have not been deleted. This is because several of the Storm modules use the existing Drupal node system to store information. Therefore, on disabling the module, these nodes are not deleted. It is suggested that you may wish to delete these manually by visiting http://example.com/admin/content/node and filtering by the stated content type.
HELP:
- It is understandable that Storm may appear intimidating at first glance due to the number of modules in the package. Do not be afraid!
- You may find this blog entry useful: http://cocoate.com/2009/06/29/project-management-drupal-and-storm
- For general support, you can ask questions on the issues queue on Drupal.org: http://drupal.org/project/issues/storm
FEEDBACK:
- Please feedback on your experiences to make Storm better. This can be done by creating an issue at http://drupal.org/project/issues/storm.
- Were you just trying Storm?
- Did you end up using Storm?
- What did you find difficult?
- What was the make or break factor for you?
- Another way to help others is to blog about how your installation went. This will allow you to post screenshots too.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View file

@ -1,75 +0,0 @@
<?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".'));
}
}

View file

@ -1,192 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk dok module
*/
class StormdokTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Dok Functionality'),
'description' => t('Test the functionality of the SuiteDesk Dok module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormdok', 'stormperson');
}
public function testStormdokAccess() {
$this->drupalGet('doks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Doks list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('doks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Doks list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm dok: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('doks');
$this->assertText(t('Doks'), t('Make sure the correct page has been displayed by checking that the title is "Doks".'));
}
public function testStormdokCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm dok: add', 'Storm dok: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$dok = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormdok', $dok, t('Save'));
$this->assertText(t('Dok @title has been created.', array('@title' => $dok['title'])));;
}
public function testStormdokList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view all', 'Storm dok: edit all', 'Storm dok: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view of user organization', 'Storm dok: edit of user organization', 'Storm dok: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view own', 'Storm dok: edit own', 'Storm dok: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm dok: access', 'Storm dok: add', 'Storm dok: view all', 'Storm dok: edit own', 'Storm dok: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create doks
$dok1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormdok', $dok1, t('Save'));
$dok1 = node_load(array('title' => $dok1['title']));
$this->drupalLogin($userOwn);
$dok2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormdok', $dok2, t('Save'));
$dok2 = node_load(array('title' => $dok2['title']));
$this->drupalLogin($userViewAllEditOwn);
$dok3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormdok', $dok3, t('Save'));
$dok3 = node_load(array('title' => $dok3['title']));
// Test for 'Storm dok: view all'
$this->drupalLogin($userAll);
$this->drupalGet('doks');
$this->assertLink($dok1->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertLink($dok3->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon appears on the list');
// Test for 'Storm dok: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('doks');
$this->assertLink($dok1->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok1->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertNoLink($dok3->title, 'The Dok does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon does not appear on the list');
// Test for 'Storm dok: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('doks');
$this->assertNoLink($dok1->title, 'The Dok does not appear on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/delete', 'The Dok delete icon does not appear on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon appears on the list');
$this->assertNoLink($dok3->title, 'The Dok does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon does not appear on the list');
// Test for 'Storm dok: view all', 'Storm dok: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('doks');
$this->assertLink($dok1->title, 0, 'The Dok appears on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok1->nid .'/delete', 'The Dok edit icon does not appear on the list');
$this->assertLink($dok2->title, 0, 'The Dok appears on the list');
$this->assertNoRaw('node/'. $dok2->nid .'/edit', 'The Dok edit icon does not appear on the list');
$this->assertNoRaw('node/'. $dok2->nid .'/delete', 'The Dok delete icon does not appear on the list');
$this->assertLink($dok3->title, 0, 'The Dok appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/edit', 'The Dok edit icon appears on the list');
$this->assertRaw('node/'. $dok3->nid .'/delete', 'The Dok delete icon appears on the list');
}
}

View file

@ -1,192 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk event module
*/
class StormeventTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk event Functionality'),
'description' => t('Test the functionality of the SuiteDesk event module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormevent', 'stormperson');
}
public function testStormeventAccess() {
$this->drupalGet('events');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk events list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('events');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk events list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm event: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('events');
$this->assertText(t('events'), t('Make sure the correct page has been displayed by checking that the title is "events".'));
}
public function testStormeventCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm event: add', 'Storm event: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$event = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormevent', $event, t('Save'));
$this->assertText(t('event @title has been created.', array('@title' => $event['title'])));;
}
public function testStormeventList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view all', 'Storm event: edit all', 'Storm event: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view of user organization', 'Storm event: edit of user organization', 'Storm event: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view own', 'Storm event: edit own', 'Storm event: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm event: access', 'Storm event: add', 'Storm event: view all', 'Storm event: edit own', 'Storm event: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create events
$event1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormevent', $event1, t('Save'));
$event1 = node_load(array('title' => $event1['title']));
$this->drupalLogin($userOwn);
$event2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormevent', $event2, t('Save'));
$event2 = node_load(array('title' => $event2['title']));
$this->drupalLogin($userViewAllEditOwn);
$event3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormevent', $event3, t('Save'));
$event3 = node_load(array('title' => $event3['title']));
// Test for 'Storm event: view all'
$this->drupalLogin($userAll);
$this->drupalGet('events');
$this->assertLink($event1->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event1->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event1->nid .'/delete', 'The event delete icon appears on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event2->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event2->nid .'/delete', 'The event delete icon appears on the list');
$this->assertLink($event3->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event3->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event3->nid .'/delete', 'The event delete icon appears on the list');
// Test for 'Storm event: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('events');
$this->assertLink($event1->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event1->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event1->nid .'/delete', 'The event delete icon appears on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event2->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event2->nid .'/delete', 'The event delete icon appears on the list');
$this->assertNoLink($event3->title, 'The event does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/delete', 'The event delete icon does not appear on the list');
// Test for 'Storm event: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('events');
$this->assertNoLink($event1->title, 'The event does not appear on the list');
$this->assertNoRaw('node/'. $event1->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event1->nid .'/delete', 'The event delete icon does not appear on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event2->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event2->nid .'/delete', 'The event delete icon appears on the list');
$this->assertNoLink($event3->title, 'The event does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event3->nid .'/delete', 'The event delete icon does not appear on the list');
// Test for 'Storm event: view all', 'Storm event: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('events');
$this->assertLink($event1->title, 0, 'The event appears on the list');
$this->assertNoRaw('node/'. $event1->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event1->nid .'/delete', 'The event edit icon does not appear on the list');
$this->assertLink($event2->title, 0, 'The event appears on the list');
$this->assertNoRaw('node/'. $event2->nid .'/edit', 'The event edit icon does not appear on the list');
$this->assertNoRaw('node/'. $event2->nid .'/delete', 'The event delete icon does not appear on the list');
$this->assertLink($event3->title, 0, 'The event appears on the list');
$this->assertRaw('node/'. $event3->nid .'/edit', 'The event edit icon appears on the list');
$this->assertRaw('node/'. $event3->nid .'/delete', 'The event delete icon appears on the list');
}
}

View file

@ -1,191 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk expense module
*/
class StormexpenseTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Expense Functionality'),
'description' => t('Test the functionality of the SuiteDesk Expense module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormexpense', 'stormperson');
}
public function testStormexpenseAccess() {
$this->drupalGet('expenses');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Expense list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('expenses');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Expense list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm expense: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('expenses');
$this->assertText(t('Expenses'), t('Make sure the correct page has been displayed by checking that the title is "Expenses".'));
}
public function testStormexpenseCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: add', 'Storm expense: view all', 'Storm project: view all', 'Storm task: view all'));
$this->drupalLogin($user);
// Create a team
$org = array(
'title' => $this->randomName(32),
);
$expense = array(
'organization_nid' => '1',
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormexpense', $expense, t('Save'));
$this->assertText(t('Expense @title has been created.', array('@title' => $expense['title'])));
}
public function testStormexpenseReports() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm expense: access'));
$this->drupalLogin($user);
// Create a team
$this->drupalGet('expenses/report/std/en');
}
public function testStormexpenseList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view all', 'Storm expense: edit all', 'Storm expense: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view of user organization', 'Storm expense: edit of user organization', 'Storm expense: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view own', 'Storm expense: edit own', 'Storm expense: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm expense: access', 'Storm expense: add', 'Storm expense: view all', 'Storm expense: edit own', 'Storm expense: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create expenses
$exp1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormexpense', $exp1, t('Save'));
$exp1 = node_load(array('title' => $exp1['title']));
$this->drupalLogin($userOwn);
$exp2 = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormexpense', $exp2, t('Save'));
$exp2 = node_load(array('title' => $exp2['title']));
$this->drupalLogin($userViewAllEditOwn);
$exp3 = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormexpense', $exp3, t('Save'));
$exp3 = node_load(array('title' => $exp3['title']));
// Test for 'Storm expense: view all'
$this->drupalLogin($userAll);
$this->drupalGet('expenses');
$this->assertLink($exp1->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertLink($exp3->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon appears on the list');
// Test for 'Storm expense: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('expenses');
$this->assertLink($exp1->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertNoLink($exp3->title, 'The Expense does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon does not appear on the list');
// Test for 'Storm expense: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('expenses');
$this->assertNoLink($exp1->title, 'The Expense does not appear on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon does not appear on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon appears on the list');
$this->assertNoLink($exp3->title, 'The Expense does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon does not appear on the list');
// Test for 'Storm expense: view all', 'Storm expense: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('expenses');
$this->assertLink($exp1->title, 0, 'The Expense appears on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp1->nid .'/delete', 'The Expense edit icon does not appear on the list');
$this->assertLink($exp2->title, 0, 'The Expense appears on the list');
$this->assertNoRaw('node/'. $exp2->nid .'/edit', 'The Expense edit icon does not appear on the list');
$this->assertNoRaw('node/'. $exp2->nid .'/delete', 'The Expense edit icon does not appear on the list');
$this->assertLink($exp3->title, 0, 'The Expense appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/edit', 'The Expense edit icon appears on the list');
$this->assertRaw('node/'. $exp3->nid .'/delete', 'The Expense edit icon appears on the list');
}
}

View file

@ -1,225 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Invoice module.
*/
class StorminvoiceTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Invoice Functionality'),
'description' => t('Test the functionality of the SuiteDesk Invoice module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'storminvoice', 'stormperson');
}
public function testStorminvoiceAccess() {
$this->drupalGet('invoices');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Invoices list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('invoices');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Invoices list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm invoice: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('invoices');
$this->assertText(t('Invoices'), t('Make sure the correct page has been displayed by checking that the title is "Invoices".'));
}
public function testStorminvoiceCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: add', 'Storm invoice: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$inv = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
'items_0_description' => $this->randomName(32),
'items_0_amount' => '.28',
'items_0_tax1app' => '1',
'items_0_tax1percent' => '5',
'items_0_tax2app' => '2',
'items_0_tax2percent' => '7.5',
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/storminvoice', $inv, t('Save'));
$this->assertText(t('Invoice @title has been created.', array('@title' => $inv['title'])));
}
public function testStorminvoiceList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view all', 'Storm invoice: edit all', 'Storm invoice: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view of user organization', 'Storm invoice: edit of user organization', 'Storm invoice: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view own', 'Storm invoice: edit own', 'Storm invoice: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm invoice: access', 'Storm invoice: add', 'Storm invoice: view all', 'Storm invoice: edit own', 'Storm invoice: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create invoices
$inv1 = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'items_0_description' => $this->randomName(32),
'items_0_amount' => '100.0',
'items_0_tax1app' => '1',
'items_0_tax1percent' => '20',
'items_0_tax2app' => '2',
'items_0_tax2percent' => '10',
);
// tax1: 20; tax2: 12; total: 132
$this->drupalPost('node/add/storminvoice', $inv1, t('Save'));
$inv1 = node_load(array('title' => $inv1['title']));
$this->drupalLogin($userOwn);
$inv2 = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'items_0_description' => $this->randomName(32),
'items_0_amount' => '200',
'items_0_tax1app' => '1',
'items_0_tax1percent' => '20',
'items_0_tax2app' => '0',
'items_0_tax2percent' => '10',
);
// tax1: 40; tax2: 0; total: 240
$this->drupalPost('node/add/storminvoice', $inv2, t('Save'));
$inv2 = node_load(array('title' => $inv2['title']));
$this->drupalLogin($userViewAllEditOwn);
$inv3 = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
'items_0_description' => $this->randomName(32),
'items_0_amount' => '42,42',
'items_0_tax1app' => '0',
'items_0_tax1percent' => '5',
'items_0_tax2app' => '0',
'items_0_tax2percent' => '7.5',
);
// tax1: 0, tax2: 0; total: 42.42
$this->drupalPost('node/add/storminvoice', $inv3, t('Save'));
$inv3 = node_load(array('title' => $inv3['title']));
// Test for 'Storm invoice: view all'
$this->drupalLogin($userAll);
$this->drupalGet('invoices');
$this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertLink($inv3->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertRaw('342.42', 'Total amount is correct.');
$this->assertRaw('60.00', 'Total Tax1 is correct.');
$this->assertRaw('12.00', 'Total Tax2 is correct.');
$this->assertRaw('414.42', 'Total sum correct.');
// Test for 'Storm invoice: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('invoices');
$this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertNoLink($inv3->title, 'The Invoice does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertRaw('300.00', 'Total amount is correct.');
$this->assertRaw('60.00', 'Total Tax1 is correct.');
$this->assertRaw('12.00', 'Total Tax2 is correct.');
$this->assertRaw('372.00', 'Total sum correct.');
// Test for 'Storm invoice: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('invoices');
$this->assertNoLink($inv1->title, 'The Invoice does not appear on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertNoLink($inv3->title, 'The Invoice does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertRaw('200.00', 'Total amount is correct.');
$this->assertRaw('40.00', 'Total Tax1 is correct.');
$this->assertRaw('0.00', 'Total Tax2 is correct.');
$this->assertRaw('240.00', 'Total sum correct.');
// Test for 'Storm invoice: view all', 'Storm invoice: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('invoices');
$this->assertLink($inv1->title, 0, 'The Invoice appears on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv1->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertLink($inv2->title, 0, 'The Invoice appears on the list');
$this->assertNoRaw('node/'. $inv2->nid .'/edit', 'The Invoice edit icon does not appear on the list');
$this->assertNoRaw('node/'. $inv2->nid .'/delete', 'The Invoice edit icon does not appear on the list');
$this->assertLink($inv3->title, 0, 'The Invoice appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/edit', 'The Invoice edit icon appears on the list');
$this->assertRaw('node/'. $inv3->nid .'/delete', 'The Invoice edit icon appears on the list');
$this->assertRaw('342.42', 'Total amount is correct.');
$this->assertRaw('60.00', 'Total Tax1 is correct.');
$this->assertRaw('12.00', 'Total Tax2 is correct.');
$this->assertRaw('414.42', 'Total sum correct.');
}
}

View file

@ -1,192 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk note module
*/
class StormnoteTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Note Functionality'),
'description' => t('Test the functionality of the SuiteDesk Note module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormnote', 'stormperson');
}
public function testStormnoteAccess() {
$this->drupalGet('notes');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Notes list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('notes');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Notes list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm note: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('notes');
$this->assertText(t('Notes'), t('Make sure the correct page has been displayed by checking that the title is "Notes".'));
}
public function testStormnoteCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm note: add', 'Storm note: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$note = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormnote', $note, t('Save'));
$this->assertText(t('Note @title has been created.', array('@title' => $note['title'])));;
}
public function testStormnoteList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view all', 'Storm note: edit all', 'Storm note: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view of user organization', 'Storm note: edit of user organization', 'Storm note: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view own', 'Storm note: edit own', 'Storm note: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm note: access', 'Storm note: add', 'Storm note: view all', 'Storm note: edit own', 'Storm note: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create notes
$note1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormnote', $note1, t('Save'));
$note1 = node_load(array('title' => $note1['title']));
$this->drupalLogin($userOwn);
$note2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormnote', $note2, t('Save'));
$note2 = node_load(array('title' => $note2['title']));
$this->drupalLogin($userViewAllEditOwn);
$note3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormnote', $note3, t('Save'));
$note3 = node_load(array('title' => $note3['title']));
// Test for 'Storm note: view all'
$this->drupalLogin($userAll);
$this->drupalGet('notes');
$this->assertLink($note1->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note1->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note1->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note2->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note2->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertLink($note3->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note3->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note3->nid .'/delete', 'The Note delete icon appears on the list');
// Test for 'Storm note: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('notes');
$this->assertLink($note1->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note1->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note1->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note2->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note2->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertNoLink($note3->title, 'The Note does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/delete', 'The Note delete icon does not appear on the list');
// Test for 'Storm note: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('notes');
$this->assertNoLink($note1->title, 'The Note does not appear on the list');
$this->assertNoRaw('node/'. $note1->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note1->nid .'/delete', 'The Note delete icon does not appear on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note2->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note2->nid .'/delete', 'The Note delete icon appears on the list');
$this->assertNoLink($note3->title, 'The Note does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note3->nid .'/delete', 'The Note delete icon does not appear on the list');
// Test for 'Storm note: view all', 'Storm note: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('notes');
$this->assertLink($note1->title, 0, 'The Note appears on the list');
$this->assertNoRaw('node/'. $note1->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note1->nid .'/delete', 'The Note edit icon does not appear on the list');
$this->assertLink($note2->title, 0, 'The Note appears on the list');
$this->assertNoRaw('node/'. $note2->nid .'/edit', 'The Note edit icon does not appear on the list');
$this->assertNoRaw('node/'. $note2->nid .'/delete', 'The Note delete icon does not appear on the list');
$this->assertLink($note3->title, 0, 'The Note appears on the list');
$this->assertRaw('node/'. $note3->nid .'/edit', 'The Note edit icon appears on the list');
$this->assertRaw('node/'. $note3->nid .'/delete', 'The Note delete icon appears on the list');
}
}

View file

@ -1,156 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk organization module
*/
class StormorganizationTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'SuiteDesk Organization functionality',
'description' => 'Test the functionality of the SuiteDesk Organization module',
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormperson');
$privileged_user = $this->drupalCreateUser(array('Storm organization: add'));
$this->drupalLogin($privileged_user);
}
public function testStormorganizationAccess() {
$this->drupalGet('organizations');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Organizations list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('organizations');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Organizations list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm organization: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('organizations');
$this->assertText(t('Organizations'), t('Make sure the correct page has been displayed by checking that the title is "Organizations".'));
}
public function testStormorganizationCreate() {
$edit = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $edit, t('Save'));
$this->assertText(t('Organization @title has been created.', array('@title' => $edit['title'])));
}
public function testStormorganizationList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view all', 'Storm organization: edit all', 'Storm organization: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view belonged', 'Storm organization: edit belonged'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view own', 'Storm organization: edit own', 'Storm organization: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: access', 'Storm organization: view all', 'Storm organization: edit own', 'Storm organization: delete own'));
$this->drupalLogin($userAll);
// Create organization
$organization1 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $organization1, t('Save'));
$organization1 = node_load(array('title' => $organization1['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $organization1->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create organization
$this->drupalLogin($userOwn);
$organization2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $organization2, t('Save'));
$organization2 = node_load(array('title' => $organization2['title']));
$this->drupalLogin($userViewAllEditOwn);
$organization3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $organization3, t('Save'));
$organization3 = node_load(array('title' => $organization3['title']));
// Test for 'Storm organization: view all'
$this->drupalLogin($userAll);
$this->drupalGet('organizations');
$this->assertLink($organization1->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon appears on the list');
$this->assertLink($organization2->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon appears on the list');
$this->assertLink($organization3->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon appears on the list');
// Test for 'Storm organization: view belonged'
$this->drupalLogin($userOrg);
$this->drupalGet('organizations');
$this->assertLink($organization1->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertNoLink($organization2->title, 'The Organization appears on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertNoLink($organization3->title, 'The Organization does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon does not appear on the list');
// Test for 'Storm organization: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('organizations');
$this->assertNoLink($organization1->title, 'The Organization does not appear on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertLink($organization2->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon appears on the list');
$this->assertNoLink($organization3->title, 'The Organization does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon does not appear on the list');
// Test for 'Storm organization: view all', 'Storm organization: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('organizations');
$this->assertLink($organization1->title, 0, 'The Organization appears on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization1->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertLink($organization2->title, 0, 'The Organization appears on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/edit', 'The Organization edit icon does not appear on the list');
$this->assertNoRaw('node/'. $organization2->nid .'/delete', 'The Organization edit icon does not appear on the list');
$this->assertLink($organization3->title, 0, 'The Organization appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/edit', 'The Organization edit icon appears on the list');
$this->assertRaw('node/'. $organization3->nid .'/delete', 'The Organization edit icon appears on the list');
}
}

View file

@ -1,224 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Person module.
*/
class StormpersonTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'SuiteDesk Person functionality',
'description' => 'Test the functionality of the SuiteDesk Person module',
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormperson');
$privileged_user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: add'));
$this->drupalLogin($privileged_user);
}
public function testStormpersonAccess() {
$this->drupalGet('people');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk People list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('people');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk People list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm person: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('people');
$this->assertText(t('People'), t('Make sure the correct page has been displayed by checking that the title is "People".'));
}
public function testStormpersonCreate() {
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$person = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormperson', $person, t('Save'));
$this->assertText(t('Person @title has been created.', array('@title' => $person['title'])));
}
public function testStormpersonList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view all', 'Storm person: edit all', 'Storm person: delete all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view of user organization', 'Storm person: edit of user organization', 'Storm person: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view own', 'Storm person: edit own', 'Storm person: delete own'));
$userLinked = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view when linked to own user account', 'Storm person: edit when linked to own user account', 'Storm person: delete when linked to own user account'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm person: access', 'Storm person: add', 'Storm person: view all', 'Storm person: edit own', 'Storm person: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create persons
$person1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormperson', $person1, t('Save'));
$person1 = node_load(array('title' => $person1['title']));
$person4 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'user_name' => $userLinked->name,
);
$this->drupalPost('node/add/stormperson', $person4, t('Save'));
$person4 = node_load(array('title' => $person4['title']));
$this->drupalLogin($userOwn);
$person2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormperson', $person2, t('Save'));
$person2 = node_load(array('title' => $person2['title']));
$this->drupalLogin($userViewAllEditOwn);
$person3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormperson', $person3, t('Save'));
$person3 = node_load(array('title' => $person3['title']));
// Test for 'Storm person: view all'
$this->drupalLogin($userAll);
$this->drupalGet('people');
$this->assertLink($person1->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person1->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person1->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person2->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person2->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person3->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person3->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person3->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person4->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person4->nid .'/delete', 'The Person edit icon appears on the list');
// Test for 'Storm person: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('people');
$this->assertLink($person1->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person1->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person1->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person2->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person2->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertNoLink($person3->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person4->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person4->nid .'/delete', 'The Person edit icon appears on the list');
// Test for 'Storm person: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('people');
$this->assertNoLink($person1->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person2->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person2->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertNoLink($person3->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertNoLink($person4->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person4->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person4->nid .'/delete', 'The Person edit icon does not appear on the list');
// Test for 'Storm person: view all', 'Storm invoice: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('people');
$this->assertLink($person1->title, 0, 'The Person appears on the list');
$this->assertNoRaw('node/'. $person1->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person2->title, 0, 'The Person appears on the list');
$this->assertNoRaw('node/'. $person2->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person2->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person3->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person3->nid .'/edit', 'The Person edit icon appears on the list');
$this->assertRaw('node/'. $person3->nid .'/delete', 'The Person edit icon appears on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertNoRaw('node/'. $person4->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person4->nid .'/delete', 'The Person edit icon does not appear on the list');
// Test for 'Storm person: view when linked to own user account'
$this->drupalLogin($userLinked);
$this->drupalGet('people');
$this->assertNoLink($person1->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person1->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertNoLink($person2->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person2->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person2->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertNoLink($person3->title, 'The Person does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertNoRaw('node/'. $person3->nid .'/delete', 'The Person edit icon does not appear on the list');
$this->assertLink($person4->title, 0, 'The Person appears on the list');
$this->assertRaw('node/'. $person4->nid .'/edit', 'The Person edit icon does not appear on the list');
$this->assertRaw('node/'. $person4->nid .'/delete', 'The Person edit icon does not appear on the list');
}
}

View file

@ -1,376 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Project module
*/
class StormprojectTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Project Functionality'),
'description' => t('Test the functionality of the SuiteDesk Project module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormperson', 'stormteam');
}
public function testStormprojectAccess() {
$this->drupalGet('projects');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Projects list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('projects');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Projects list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm project: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('projects');
$this->assertText(t('Projects'), t('Make sure the correct page has been displayed by checking that the title is "Projects".'));
}
public function testStormprojectCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->assertText(t('Project @title has been created.', array('@title' => $prj['title'])));;
}
public function testStormprojectList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit all', 'Storm project: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view of user organization', 'Storm project: edit of user organization', 'Storm project: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view own', 'Storm project: edit own', 'Storm project: delete own'));
$userManager = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if project manager', 'Storm project: edit if project manager', 'Storm project: delete if project manager'));
$userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
$userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit own', 'Storm project: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userManager->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$manager = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssigned->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPerson = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssignedTeam->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPersonTeam = node_load(array('title' => $personOrg['title']));
$team = array(
'title' => $this->randomName(32),
'members_array_1' => $assignedPersonTeam->nid,
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$team = node_load(array('title' => $team['title']));
// Create project
$project1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormproject', $project1, t('Save'));
$project1 = node_load(array('title' => $project1['title']));
$projectManager = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'manager_nid' => $manager->nid,
);
$this->drupalPost('node/add/stormproject', $projectManager, t('Save'));
$projectManager = node_load(array('title' => $projectManager['title']));
$projectAssigned = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $assignedPerson->nid,
);
$this->drupalPost('node/add/stormproject', $projectAssigned, t('Save'));
$projectAssigned = node_load(array('title' => $projectAssigned['title']));
$projectAssignedTeam = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $projectAssignedTeam, t('Save'));
$projectAssignedTeam = node_load(array('title' => $projectAssignedTeam['title']));
$this->drupalLogin($userOwn);
$project2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormproject', $project2, t('Save'));
$project2 = node_load(array('title' => $project2['title']));
$this->drupalLogin($userViewAllEditOwn);
$project3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormproject', $project3, t('Save'));
$project3 = node_load(array('title' => $project3['title']));
// Test for 'Storm project: view all'
$this->drupalLogin($userAll);
$this->drupalGet('projects');
$this->assertLink($project1->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project1->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project1->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($project3->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project3->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project3->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
// Test for 'Storm project: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('projects');
$this->assertLink($project1->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project1->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project1->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($project3->title, 0, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
// Test for 'Storm project: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view all', 'Storm project: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('projects');
$this->assertLink($project1->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($project2->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($project3->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $project3->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $project3->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view if project manager'
$this->drupalLogin($userManager);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view if assigned to project'
$this->drupalLogin($userAssigned);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
// Test for 'Storm project: view if assigned to project' (using team)
$this->drupalLogin($userAssignedTeam);
$this->drupalGet('projects');
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
}
}

View file

@ -1,338 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Task module
*/
class StormtaskTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Task Functionality'),
'description' => t('Test the functionality of the SuiteDesk Task module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormperson', 'stormteam');
}
public function testStormtaskAccess() {
$this->drupalGet('tasks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tasks list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('tasks');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tasks list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm task: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('tasks');
$this->assertText(t('Tasks'), t('Make sure the correct page has been displayed by checking that the title is "Tasks".'));
}
public function testStormtaskCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->assertText(t('Task @title has been created.', array('@title' => $task['title'])));;
}
public function testStormtaskList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view all', 'Storm task: edit all', 'Storm task: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all', 'Storm project: add', 'Storm project: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view of user organization', 'Storm task: edit of user organization', 'Storm task: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view own', 'Storm task: edit own', 'Storm task: delete own', 'Storm project: view all'));
$userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view if assigned to task', 'Storm task: edit if assigned to task', 'Storm task: delete if assigned to task'));
$userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view if assigned to task', 'Storm task: edit if assigned to task', 'Storm task: delete if assigned to task'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm task: access', 'Storm task: add', 'Storm task: view all', 'Storm task: edit own', 'Storm task: delete own', 'Storm project: view all'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssigned->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPerson = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssignedTeam->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPersonTeam = node_load(array('title' => $personOrg['title']));
$team = array(
'title' => $this->randomName(32),
'members_array_1' => $assignedPersonTeam->nid,
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$team = node_load(array('title' => $team['title']));
// Create project foreach organization
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectTeam = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg2 = node_load(array('title' => $prj['title']));
// Create tasks
$task1 = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormtask', $task1, t('Save'), array('query' => 'organization_nid='.$org->nid));
$task1 = node_load(array('title' => $task1['title']));
$taskAssigned = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $assignedPerson->nid,
);
$this->drupalPost('node/add/stormtask', $taskAssigned, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectOrg->nid));
$taskAssigned = node_load(array('title' => $taskAssigned['title']));
$taskAssignedTeam = array(
'organization_nid' => $org->nid,
'project_nid' => $projectTeam->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormtask', $taskAssignedTeam, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectTeam->nid));
$taskAssignedTeam = node_load(array('title' => $taskAssignedTeam['title']));
$this->drupalLogin($userOwn);
$task2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
);
$this->drupalPost('node/add/stormtask', $task2, t('Save'), array('query' => 'organization_nid='.$org->nid));
$task2 = node_load(array('title' => $task2['title']));
$this->drupalLogin($userViewAllEditOwn);
$task3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
'project_nid' => $projectOrg2->nid,
);
$this->drupalPost('node/add/stormtask', $task3, t('Save'), array('query' => 'organization_nid='.$org2->nid));
$task3 = node_load(array('title' => $task3['title']));
// Test for 'Storm task: view all'
$this->drupalLogin($userAll);
$this->drupalGet('tasks');
$this->assertLink($task1->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task1->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task1->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task2->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task2->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($task3->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task3->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task3->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon appears on the list');
// Test for 'Storm task: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('tasks');
$this->assertLink($task1->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task1->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task1->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task2->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task2->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon appears on the list');
// Test for 'Storm task: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('tasks');
$this->assertNoLink($task1->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task2->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task2->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($taskAssigned->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($taskAssignedTeam->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon does not appear on the list');
// Test for 'Storm task: view all', 'Storm task: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('tasks');
$this->assertLink($task1->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task edit icon does not appear on the list');
$this->assertLink($task2->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $task2->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($task3->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $task3->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $task3->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon does not appear on the list');
// Test for 'Storm task: view if assigned to task'
$this->drupalLogin($userAssigned);
$this->drupalGet('tasks');
$this->assertNoLink($task1->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task2->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssigned->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon appears on the list');
$this->assertNoLink($taskAssignedTeam->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon does not appear on the list');
// Test for 'Storm task: view if assigned to task' (using team)
$this->drupalLogin($userAssignedTeam);
$this->drupalGet('tasks');
$this->assertNoLink($task1->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task1->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task2->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task2->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($task3->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $task3->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertNoLink($taskAssigned->title, 'The Task does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/edit', 'The Task edit icon does not appear on the list');
$this->assertNoRaw('node/'. $taskAssigned->nid .'/delete', 'The Task delete icon does not appear on the list');
$this->assertLink($taskAssignedTeam->title, 0, 'The Task appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/edit', 'The Task edit icon appears on the list');
$this->assertRaw('node/'. $taskAssignedTeam->nid .'/delete', 'The Task delete icon appears on the list');
}
}

View file

@ -1,157 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Team module.
*/
class StormteamTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Team Functionality'),
'description' => t('Test the functionality of the SuiteDesk Team module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormperson', 'stormteam');
}
public function testStormteamCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm team: add', 'Storm team: view all', 'Storm person: add', 'Storm person: view all'));
$this->drupalLogin($user);
// Create a team
$team = array(
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$this->assertText(t('Team @title has been created.', array('@title' => $team['title'])));;
}
public function testStormteamList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view all', 'Storm team: edit all', 'Storm team: delete all', 'Storm person: add', 'Storm person: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view belonged', 'Storm team: edit belonged', 'Storm team: delete belonged'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view own', 'Storm team: edit own', 'Storm team: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm team: access', 'Storm team: add', 'Storm team: view all', 'Storm team: edit own', 'Storm team: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$person = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $person, t('Save'));
$person = node_load(array('title' => $person['title']));
// Create teams
$team1 = array(
'title' => $this->randomName(32),
'members_array_1' => $person->nid,
);
$this->drupalPost('node/add/stormteam', $team1, t('Save'));
$team1 = node_load(array('title' => $team1['title']));
$this->drupalLogin($userOwn);
$team2 = array(
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormteam', $team2, t('Save'));
$team2 = node_load(array('title' => $team2['title']));
$this->drupalLogin($userViewAllEditOwn);
$team3 = array(
'title' => $this->randomName(32),
);
$this->drupalPost('node/add/stormteam', $team3, t('Save'));
$team3 = node_load(array('title' => $team3['title']));
// Test for 'Storm team: view all'
$this->drupalLogin($userAll);
$this->drupalGet('teams');
$this->assertLink($team1->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team1->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team1->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertLink($team2->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team2->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team2->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertLink($team3->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team3->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team3->nid .'/delete', 'The Team delete icon appears on the list');
// Test for 'Storm team: view belonged'
$this->drupalLogin($userOrg);
$this->drupalGet('teams');
$this->assertLink($team1->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team1->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team1->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertNoLink($team2->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team2->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team2->nid .'/delete', 'The Team delete icon does not appear on the list');
$this->assertNoLink($team3->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/delete', 'The Team delete icon does not appear on the list');
// Test for 'Storm team: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('teams');
$this->assertNoLink($team1->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team1->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team1->nid .'/delete', 'The Team delete icon does not appear on the list');
$this->assertLink($team2->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team2->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team2->nid .'/delete', 'The Team delete icon appears on the list');
$this->assertNoLink($team3->title, 'The Team does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team3->nid .'/delete', 'The Team delete icon does not appear on the list');
// Test for 'Storm team: view all', 'Storm team: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('teams');
$this->assertLink($team1->title, 0, 'The Team appears on the list');
$this->assertNoRaw('node/'. $team1->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team1->nid .'/delete', 'The Team edit icon does not appear on the list');
$this->assertLink($team2->title, 0, 'The Team appears on the list');
$this->assertNoRaw('node/'. $team2->nid .'/edit', 'The Team edit icon does not appear on the list');
$this->assertNoRaw('node/'. $team2->nid .'/delete', 'The Team delete icon does not appear on the list');
$this->assertLink($team3->title, 0, 'The Team appears on the list');
$this->assertRaw('node/'. $team3->nid .'/edit', 'The Team edit icon appears on the list');
$this->assertRaw('node/'. $team3->nid .'/delete', 'The Team delete icon appears on the list');
}
}

View file

@ -1,344 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Ticket module.
*/
class StormticketTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Ticket Functionality'),
'description' => t('Test the functionality of the SuiteDesk Ticket module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormperson', 'stormteam');
}
public function testStormticketAccess() {
$this->drupalGet('tickets');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tickets list for anonymous user'));
$basic_user = $this->drupalCreateUser();
$this->drupalLogin($basic_user);
$this->drupalGet('tickets');
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Tickets list for basic user'));
$privileged_user = $this->drupalCreateUser(array('Storm ticket: access'));
$this->drupalLogin($privileged_user);
$this->drupalGet('tickets');
$this->assertText(t('Tickets'), t('Make sure the correct page has been displayed by checking that the title is "Tickets".'));
}
public function testStormticketCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm ticket: add', 'Storm ticket: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$ticket = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormticket', $ticket, t('Save'));
$this->assertText(t('Ticket @title has been created.', array('@title' => $ticket['title'])));;
}
public function testStormticketList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view all', 'Storm ticket: edit all', 'Storm ticket: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all', 'Storm project: add', 'Storm project: view all'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view of user organization', 'Storm ticket: edit of user organization', 'Storm ticket: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view own', 'Storm ticket: edit own', 'Storm ticket: delete own', 'Storm project: view all'));
$userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view if assigned to ticket', 'Storm ticket: edit if assigned to ticket', 'Storm ticket: delete if assigned to ticket'));
$userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view if assigned to ticket', 'Storm ticket: edit if assigned to ticket', 'Storm ticket: delete if assigned to ticket'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm ticket: access', 'Storm ticket: add', 'Storm ticket: view all', 'Storm ticket: edit own', 'Storm ticket: delete own', 'Storm project: view all'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssigned->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPerson = node_load(array('title' => $personOrg['title']));
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userAssignedTeam->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
$assignedPersonTeam = node_load(array('title' => $personOrg['title']));
$team = array(
'title' => $this->randomName(32),
'members_array_1' => $assignedPersonTeam->nid,
);
$this->drupalPost('node/add/stormteam', $team, t('Save'));
$team = node_load(array('title' => $team['title']));
// Create project foreach organization
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectTeam = node_load(array('title' => $prj['title']));
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => $org2->nid,
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$projectOrg2 = node_load(array('title' => $prj['title']));
// Create tickets
$ticket1 = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormticket', $ticket1, t('Save'), array('query' => 'organization_nid='.$org->nid));
$ticket1 = node_load(array('title' => $ticket1['title']));
$ticketAssigned = array(
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $assignedPerson->nid,
);
$this->drupalPost('node/add/stormticket', $ticketAssigned, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectOrg->nid));
$ticketAssigned = node_load(array('title' => $ticketAssigned['title']));
$ticketAssignedTeam = array(
'organization_nid' => $org->nid,
'project_nid' => $projectTeam->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'assigned_nid' => $team->nid,
);
$this->drupalPost('node/add/stormticket', $ticketAssignedTeam, t('Save'), array('query' => 'organization_nid='.$org->nid.'&project_nid='.$projectTeam->nid));
$ticketAssignedTeam = node_load(array('title' => $ticketAssignedTeam['title']));
$this->drupalLogin($userOwn);
$ticket2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'project_nid' => $projectOrg->nid,
);
$this->drupalPost('node/add/stormticket', $ticket2, t('Save'), array('query' => 'organization_nid='.$org->nid));
$ticket2 = node_load(array('title' => $ticket2['title']));
$this->drupalLogin($userViewAllEditOwn);
$ticket3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
'project_nid' => $projectOrg2->nid,
);
$this->drupalPost('node/add/stormticket', $ticket3, t('Save'), array('query' => 'organization_nid='.$org2->nid));
$ticket3 = node_load(array('title' => $ticket3['title']));
// Test for 'Storm ticket: view all'
$this->drupalLogin($userAll);
$this->drupalGet('tickets');
$this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticket3->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon appears on the list');
// Test for 'Storm ticket: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('tickets');
$this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon appears on the list');
// Test for 'Storm ticket: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('tickets');
$this->assertNoLink($ticket1->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticketAssigned->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticketAssignedTeam->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon does not appear on the list');
// Test for 'Storm ticket: view all', 'Storm ticket: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('tickets');
$this->assertLink($ticket1->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket edit icon does not appear on the list');
$this->assertLink($ticket2->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticket3->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon does not appear on the list');
// Test for 'Storm ticket: view if assigned to ticket'
$this->drupalLogin($userAssigned);
$this->drupalGet('tickets');
$this->assertNoLink($ticket1->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket2->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssigned->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon appears on the list');
$this->assertNoLink($ticketAssignedTeam->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon does not appear on the list');
// Test for 'Storm ticket: view if assigned to ticket' (using team)
$this->drupalLogin($userAssignedTeam);
$this->drupalGet('tickets');
$this->assertNoLink($ticket1->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket1->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket2->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket2->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticket3->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticket3->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertNoLink($ticketAssigned->title, 'The Ticket does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/edit', 'The Ticket edit icon does not appear on the list');
$this->assertNoRaw('node/'. $ticketAssigned->nid .'/delete', 'The Ticket delete icon does not appear on the list');
$this->assertLink($ticketAssignedTeam->title, 0, 'The Ticket appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/edit', 'The Ticket edit icon appears on the list');
$this->assertRaw('node/'. $ticketAssignedTeam->nid .'/delete', 'The Ticket delete icon appears on the list');
}
}

View file

@ -1,182 +0,0 @@
<?php
/**
* @file
* Test definitions for the SuiteDesk Timetracking module.
*/
class StormtimetrackingTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('SuiteDesk Timetracking Functionality'),
'description' => t('Test the functionality of the SuiteDesk Timetracking module'),
'group' => 'Storm',
);
}
public function setUp() {
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormtask', 'stormticket', 'stormtimetracking', 'stormperson');
}
public function testStormtimetrackingCreate() {
// Create and login user
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all', 'Storm task: add', 'Storm task: view all', 'Storm ticket: add', 'Storm ticket: view all', 'Storm timetracking: add', 'Storm timetracking: view all'));
$this->drupalLogin($user);
// Create organization and invoice
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$prj = array(
'title' => $this->randomName(32),
'organization_nid' => '1',
);
$task = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$ticket = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$timetracking = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
$this->drupalPost('node/add/stormtask', $task, t('Save'));
$this->drupalPost('node/add/stormticket', $ticket, t('Save'));
$this->drupalPost('node/add/stormtimetracking', $timetracking, t('Save'));
$this->assertText(t('Timetracking @title has been created.', array('@title' => $timetracking['title'])));;
}
public function testStormtimetrackingList() {
// Create and login user
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view all', 'Storm timetracking: edit all', 'Storm timetracking: delete all', 'Storm person: add'));
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view of user organization', 'Storm timetracking: edit of user organization', 'Storm timetracking: delete of user organization'));
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view own', 'Storm timetracking: edit own', 'Storm timetracking: delete own'));
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm timetracking: access', 'Storm timetracking: add', 'Storm timetracking: view all', 'Storm timetracking: edit own', 'Storm timetracking: delete own'));
$this->drupalLogin($userAll);
// Create organization
$org = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
$org = node_load(array('title' => $org['title']));
// Create organization
$org2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
$org2 = node_load(array('title' => $org2['title']));
// Create stormperson with organization to userOrg
$personOrg = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
'user_name' => $userOrg->name,
);
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
// Create timetrackings
$timetracking1 = array(
'organization_nid' => $org->nid,
'title' => $this->randomName(32),
'body' => $this->randomName(64),
);
$this->drupalPost('node/add/stormtimetracking', $timetracking1, t('Save'));
$timetracking1 = node_load(array('title' => $timetracking1['title']));
$this->drupalLogin($userOwn);
$timetracking2 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org->nid,
);
$this->drupalPost('node/add/stormtimetracking', $timetracking2, t('Save'));
$timetracking2 = node_load(array('title' => $timetracking2['title']));
$this->drupalLogin($userViewAllEditOwn);
$timetracking3 = array(
'title' => $this->randomName(32),
'body' => $this->randomName(64),
'organization_nid' => $org2->nid,
);
$this->drupalPost('node/add/stormtimetracking', $timetracking3, t('Save'));
$timetracking3 = node_load(array('title' => $timetracking3['title']));
// Test for 'Storm timetracking: view all'
$this->drupalLogin($userAll);
$this->drupalGet('timetrackings');
$this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertLink($timetracking3->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon appears on the list');
// Test for 'Storm timetracking: view of user organization'
$this->drupalLogin($userOrg);
$this->drupalGet('timetrackings');
$this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertNoLink($timetracking3->title, 'The Timetracking does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
// Test for 'Storm timetracking: view own'
$this->drupalLogin($userOwn);
$this->drupalGet('timetrackings');
$this->assertNoLink($timetracking1->title, 'The Timetracking does not appear on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon appears on the list');
$this->assertNoLink($timetracking3->title, 'The Timetracking does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
// Test for 'Storm timetracking: view all', 'Storm timetracking: edit own'
$this->drupalLogin($userViewAllEditOwn);
$this->drupalGet('timetrackings');
$this->assertLink($timetracking1->title, 0, 'The Timetracking appears on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking1->nid .'/delete', 'The Timetracking edit icon does not appear on the list');
$this->assertLink($timetracking2->title, 0, 'The Timetracking appears on the list');
$this->assertNoRaw('node/'. $timetracking2->nid .'/edit', 'The Timetracking edit icon does not appear on the list');
$this->assertNoRaw('node/'. $timetracking2->nid .'/delete', 'The Timetracking delete icon does not appear on the list');
$this->assertLink($timetracking3->title, 0, 'The Timetracking appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/edit', 'The Timetracking edit icon appears on the list');
$this->assertRaw('node/'. $timetracking3->nid .'/delete', 'The Timetracking delete icon appears on the list');
}
}