class CRMCoreRelationshipUITestCase in CRM Core 8.2
Same name and namespace in other branches
- 8.3 modules/crm_core_relationship_ui/crm_core_relationship_ui.test \CRMCoreRelationshipUITestCase
- 8 modules/crm_core_relationship_ui/crm_core_relationship_ui.test \CRMCoreRelationshipUITestCase
- 7 modules/crm_core_relationship_ui/crm_core_relationship_ui.test \CRMCoreRelationshipUITestCase
Hierarchy
- class \CRMCoreRelationshipUITestCase extends \DrupalWebTestCase
Expanded class hierarchy of CRMCoreRelationshipUITestCase
File
- modules/
crm_core_relationship_ui/ crm_core_relationship_ui.test, line 3
View source
class CRMCoreRelationshipUITestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('Relationship UI'),
'description' => t('Test create/edit/delete relations.'),
'group' => t('CRM Core'),
);
}
/**
* Enable dependencies.
*/
public function setUp() {
parent::setUp(array(
'ctools',
'entity',
'views',
'image',
'name',
'crm_core',
'addressfield',
'email',
'link',
'cck_phone',
'field_group',
'name',
'crm_core_contact',
'crm_core_relationship',
'crm_core_relationship_ui',
));
cache_clear_all();
}
public function testRelationshipOperations() {
$user = $this
->drupalCreateUser(array(
'administer crm_core_contact entities',
'view any crm_core_contact entity',
'create relation entities of any contact relationship',
'view relation entities of any contact relationship',
'edit relation entities of any contact relationship',
));
$this
->drupalLogin($user);
// Create organization and individual contacts.
$individual_contact = CRMCoreContactUITestCase::individualContactValues();
$this
->drupalPost('crm-core/contact/add/individual', $individual_contact, crm_core_contact_save_contact_button_name('individual'));
$organization_contact = CRMCoreContactUITestCase::organizationContactValues();
$this
->drupalPost('crm-core/contact/add/organization', $organization_contact, crm_core_contact_save_contact_button_name('organization'));
// Ensure Relationships tab on contact view page.
$this
->drupalGet('crm-core/contact/1');
$this
->assertLink(t('Relationships'));
$this
->drupalGet('crm-core/contact/1/relationships');
$this
->assertNoRaw('<div class="messages error">', t('No errors on Relationships page.'));
// Assert link "Add Relationship".
$this
->assertLink(t('Add a relationship'));
// Assert standard relationship types.
$this
->drupalGet('crm-core/contact/1/relationships/add');
$this
->assertLink(t('Employee of'));
$this
->assertLink(t('Friend of'));
$this
->assertLink(t('Member of'));
// Create relationship "Employer of"
$values = array(
// 'source_contact' => CRMCoreContactUITestCase::getIndividualContactTitle($individual_contact) . ' [cid:1]',
'destination_contact' => CRMCoreContactUITestCase::getOrganizationContactTitle($organization_contact) . ' [cid:2]',
);
$this
->drupalPost('crm-core/contact/1/relationships/add/crm_employee/0', $values, t('Save Relationship'));
// Go to relationships list of the individual and ensure that
// Organization link is there.
$this
->drupalGet('crm-core/contact/1/relationships');
$this
->assertLink(CRMCoreContactUITestCase::getOrganizationContactTitle($organization_contact));
// Go to relationships list of the individual and ensure that
// Organization link is there.
$this
->drupalGet('crm-core/contact/2/relationships');
$this
->assertLink(CRMCoreContactUITestCase::getIndividualContactTitle($individual_contact));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CRMCoreRelationshipUITestCase:: |
public static | function | ||
CRMCoreRelationshipUITestCase:: |
public | function | Enable dependencies. | |
CRMCoreRelationshipUITestCase:: |
public | function |