*/
require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Contact_ProfileChecksumTest
+ */
class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase {
protected function setUp() {
'update_value' => substr(sha1(rand()), 0, 7),
'element_name' => 'city-Primary',
),
- 'state_province' => array(
- 'type' => 'Contact',
- 'label' => 'State',
- 'location' => 0,
- 'default_value' => '1004',
- 'update_value' => '1031',
- 'update_value_label' => 'NY',
- 'element_name' => 'state_province-Primary',
- 'html_type' => 'select',
- ),
'country' => array(
'type' => 'Contact',
'label' => 'Country',
'element_name' => 'country-Primary',
'html_type' => 'select',
),
+ 'state_province' => array(
+ 'type' => 'Contact',
+ 'label' => 'State',
+ 'location' => 0,
+ 'default_value' => '1004',
+ 'update_value' => '1031',
+ 'update_value_label' => 'NY',
+ 'element_name' => 'state_province-Primary',
+ 'html_type' => 'select',
+ ),
);
// Create a contact.
$profileId = $this->_testCreateContactProfile($fields, $profileName);
// Check for profile create/edit permissions.
- $permission = array('edit-1-profile-edit', 'edit-1-profile-create', 'edit-1-access-all-custom-data');
+ $permission = array('edit-1-profile-edit', 'edit-1-profile-create', 'edit-1-access-all-custom-data', 'edit-1-edit-all-contacts');
$this->changePermissions($permission);
// Get checksum of the newly created contact.
foreach ($fields as $field) {
$this->assertTrue($this->isElementPresent($field['element_name']), "Missing Field: {$field['label']}.");
if (isset($field['html_type']) && $field['html_type'] == 'select') {
+ $this->waitForVisible($field['element_name']);
$this->select($field['element_name'], "value={$field['update_value']}");
}
else {
$this->assertStringsPresent($checkFieldValues);
}
+ /**
+ * @param $fields
+ * @param string $profileName
+ *
+ * @return null
+ */
function _testCreateContactProfile($fields, $profileName) {
// Add new profile.
$this->openCiviPage("admin/uf/group", "reset=1");
// Name of the profile.
$this->type('title', $profileName);
+ $this->click('uf_group_type_Profile');
$this->click('_qf_Group_next-top');
$this->waitForPageToLoad($this->getTimeoutMsec());
$profileId = $this->urlArg('gid');