| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* Include configuration
protected $loggedInAs = NULL;
/**
- * Constructor
+ * Constructor.
*
* Because we are overriding the parent class constructor, we
* need to show the same arguments as exist in the constructor of
}
}
+ /**
+ * @return string
+ */
protected function prepareTestSession() {
$result = parent::prepareTestSession();
}
/**
- * Authenticate as drupal user
+ * Authenticate as drupal user.
* @param $user : (str) the key 'user' or 'admin', or a literal username
* @param $pass : (str) if $user is a literal username and not 'user' or 'admin', supply the password
*/
}
/**
- * Click on a link or button
+ * Click on a link or button.
* Wait for the page to load
* Wait for an element to be present
+ * @param $element
+ * @param string $waitFor
+ * @param bool $waitForPageLoad
*/
public function clickLink($element, $waitFor = 'civicrm-footer', $waitForPageLoad = TRUE) {
$this->click($element);
}
/**
- * Click a link or button and wait for an ajax dialog to load
+ * Click a link or button and wait for an ajax dialog to load.
* @param string $element
* @param string $waitFor
*/
}
/**
- * Click a link or button and wait for ajax content to load or refresh
+ * Click a link or button and wait for ajax content to load or refresh.
* @param string $element
* @param string $waitFor
*/
}
/**
- * Wait for all ajax snippets to finish loading
+ * Wait for all ajax snippets to finish loading.
*/
public function waitForAjaxContent() {
$this->waitForElementNotPresent('css=.blockOverlay');
}
/**
- * Call the API on the local server
+ * Call the API on the local server.
* (kind of defeats the point of a webtest - see CRM-11889)
+ * @param $entity
+ * @param $action
+ * @param $params
+ * @return array|int
*/
public function webtest_civicrm_api($entity, $action, $params) {
if (!isset($params['version'])) {
}
/**
- * Call the API on the remote server
+ * Call the API on the remote server.
* Experimental - currently only works if permissions on remote site allow anon user to access ajax api
* @see CRM-11889
+ * @param $entity
+ * @param $action
+ * @param array $params
+ * @return mixed
*/
public function rest_civicrm_api($entity, $action, $params = array()) {
$params += array(
}
/**
- * Ensures the required CiviCRM components are enabled
+ * Ensures the required CiviCRM components are enabled.
+ * @param $components
*/
public function enableComponents($components) {
$this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
}
/**
- * Add a contact with the given first and last names and either a given email
+ * Add a contact with the given first and last names and either a given email.
* (when specified), a random email (when true) or no email (when unspecified or null).
*
* @param string $fname
}
/**
+ * @param $sortName
+ * @param string $fieldName
*/
public function webtestFillAutocomplete($sortName, $fieldName = 'contact_id') {
$this->select2($fieldName, $sortName);
}
/**
+ * @param $sortName
*/
public function webtestOrganisationAutocomplete($sortName) {
$this->clickAt("//*[@id='contact_id']/../div/a");
$mon = date('n', $timeStamp) - 1;
$day = date('j', $timeStamp);
- $this->click("{$dateElement}_display");
+ $this->click("xpath=//input[starts-with(@id, '{$dateElement}_display_')]");
$this->waitForElementPresent("css=div#ui-datepicker-div.ui-datepicker div.ui-datepicker-header div.ui-datepicker-title select.ui-datepicker-month");
$this->select("css=div#ui-datepicker-div.ui-datepicker div.ui-datepicker-header div.ui-datepicker-title select.ui-datepicker-month", "value=$mon");
$this->select("css=div#ui-datepicker-div div.ui-datepicker-header div.ui-datepicker-title select.ui-datepicker-year", "value=$year");
}
/**
- * Types text into a ckEditor rich text field in a form
+ * Types text into a ckEditor rich text field in a form.
*
* @param string $fieldName
* Form field name (as assigned by PHP buildForm class).
* @param string $editor
* Which text editor (valid values are 'CKEditor', 'TinyMCE').
*
- * @return void
+ * @param bool $compressed
+ * @throws \PHPUnit_Framework_AssertionFailedError
*/
public function fillRichTextField($fieldName, $text = 'Typing this text into editor.', $editor = 'CKEditor', $compressed = FALSE) {
// make sure cursor focuses on the field
}
/**
- * Types option label and name into a table of multiple choice options
+ * Types option label and name into a table of multiple choice options.
* (for price set fields of type select, radio, or checkbox)
* TODO: extend for custom field multiple choice table input
*
}
/**
- * Use a contact EntityRef field to add a new contact
+ * Use a contact EntityRef field to add a new contact.
* @param string $field
* Selector.
* @param string $contactType
/**
* @deprecated in favor of createDialogContact
+ * @param string $fname
+ * @param string $lname
+ * @param string $email
+ * @param int $type
+ * @param string $selectId
+ * @param int $row
+ * @param string $prefix
*/
- function webtestNewDialogContact(
+ public function webtestNewDialogContact(
$fname = 'Anthony', $lname = 'Anderson', $email = 'anthony@anderson.biz',
$type = 4, $selectId = 's2id_contact_id', $row = 1, $prefix = '') {
// 4 - Individual profile
}
/**
- * Generic function to check that strings are present in the page
+ * Generic function to check that strings are present in the page.
*
* @strings array array of strings or a single string
*
}
/**
- * Returns a single argument from the url query
+ * Returns a single argument from the url query.
+ * @param $arg
+ * @param null $url
+ * @return null
*/
public function urlArg($arg, $url = NULL) {
$elements = $this->parseURL($url);
* @throws PHPUnit_Framework_AssertionFailedError
* @return int
*/
-
public function webtestAddPaymentProcessor($processorName = 'Test Processor', $processorType = 'Dummy', $processorSettings = NULL, $financialAccount = 'Deposit Bank Account') {
if (!$processorName) {
$this->fail("webTestAddPaymentProcessor requires $processorName.");
if (!$filePath) {
$filePath = '/tmp/testfile_' . substr(sha1(rand()), 0, 7) . '.txt';
$fp = @fopen($filePath, 'w');
- fputs($fp, 'Test file created by selenium test.');
+ fwrite($fp, 'Test file created by selenium test.');
@fclose($fp);
}
* @param string $financialType
* @param bool $fixedAmount
* @param bool $membershipsRequired
- * @internal param \can $User define pageTitle, hash and rand values for later data verification
*
* @return null
* of newly created online contribution page.
*/
- function webtestAddContributionPage(
+ public function webtestAddContributionPage(
$hash = NULL,
$rand = NULL,
$pageTitle = NULL,
/**
* @return bool
*/
- static
- public function checkDoLocalDBTest() {
+ public static function checkDoLocalDBTest() {
if (defined('CIVICRM_WEBTEST_LOCAL_DB') &&
CIVICRM_WEBTEST_LOCAL_DB
) {
}
/**
- * Generic function to compare expected values after an api call to retrieved
+ * Generic function to compare expected values after an api call to retrieved.
* DB values.
*
* @param string $daoName
* @param array $match
* Associative array of field name => expected value. Empty if asserting
* that a DELETE occurred
- * @param boolean $delete
+ * @param bool $delete
* are we checking that a DELETE action occurred?
*/
public function assertDBState($daoName, $id, $match, $delete = FALSE) {
}
/**
- * Compare all values in a single retrieved DB record to an array of expected values
+ * Compare all values in a single retrieved DB record to an array of expected values.
* @param string $daoName
* @param array $searchParams
* @param $expectedValues
}
/**
- * Add new Financial Account
+ * Add new Financial Account.
+ * @param $financialAccountTitle
+ * @param bool $financialAccountDescription
+ * @param bool $accountingCode
+ * @param bool $firstName
+ * @param bool $financialAccountType
+ * @param bool $taxDeductible
+ * @param bool $isActive
+ * @param bool $isTax
+ * @param bool $taxRate
+ * @param bool $isDefault
*/
- function _testAddFinancialAccount(
+ public function _testAddFinancialAccount(
$financialAccountTitle,
$financialAccountDescription = FALSE,
$accountingCode = FALSE,
}
/**
- * Edit Financial Account
+ * Edit Financial Account.
+ * @param $editfinancialAccount
+ * @param bool $financialAccountTitle
+ * @param bool $financialAccountDescription
+ * @param bool $accountingCode
+ * @param bool $firstName
+ * @param bool $financialAccountType
+ * @param bool $taxDeductible
+ * @param bool $isActive
+ * @param bool $isTax
+ * @param bool $taxRate
+ * @param bool $isDefault
*/
- function _testEditFinancialAccount(
+ public function _testEditFinancialAccount(
$editfinancialAccount,
$financialAccountTitle = FALSE,
$financialAccountDescription = FALSE,
}
/**
- * Delete Financial Account
+ * Delete Financial Account.
+ * @param $financialAccountTitle
*/
public function _testDeleteFinancialAccount($financialAccountTitle) {
$this->click("xpath=//table/tbody//tr/td[1]/div[text()='{$financialAccountTitle}']/../../td[9]/span/a[text()='Delete']");
}
/**
- * Verify data after ADD and EDIT
+ * Verify data after ADD and EDIT.
+ * @param $verifyData
*/
public function _assertFinancialAccount($verifyData) {
foreach ($verifyData as $key => $expectedValue) {
}
/**
- * Give the specified permissions
+ * Give the specified permissions.
* Note: this function logs in as 'admin' (logging out if necessary)
+ * @param $permission
*/
public function changePermissions($permission) {
$this->webtestLogin('admin');
}
/**
- * Ensure we have a default mailbox set up for CiviMail
+ * Ensure we have a default mailbox set up for CiviMail.
*/
public function setupDefaultMailbox() {
$this->openCiviPage('admin/mailSettings', 'action=update&id=1&reset=1');
}
/**
- * Type and select first occurance of autocomplete
+ * Type and select first occurance of autocomplete.
+ * @param $fieldName
+ * @param $label
+ * @param bool $multiple
+ * @param bool $xpath
*/
public function select2($fieldName, $label, $multiple = FALSE, $xpath = FALSE) {
// In the case of chainSelect, wait for options to load
}
/**
- * Select multiple options
+ * Select multiple options.
+ * @param $fieldid
+ * @param $params
*/
public function multiselect2($fieldid, $params) {
// In the case of chainSelect, wait for options to load
/**
* Check for unobtrusive status message as set by CRM.status
+ * @param null $text
*/
public function checkCRMStatus($text = NULL) {
$this->waitForElementPresent("css=.crm-status-box-outer.status-success");
/**
* Check for obtrusive status message as set by CRM.alert
+ * @param $text
+ * @param string $type
*/
public function checkCRMAlert($text, $type = 'success') {
$this->waitForElementPresent("css=div.ui-notify-message.$type");
}
/**
- * Attempt to get information about what went wrong if we encounter an error when loading a page
+ * Attempt to get information about what went wrong if we encounter an error when loading a page.
*/
public function checkForErrorsOnPage() {
foreach (array('Access denied', 'Page not found') as $err) {
$this->fail($msg);
}
}
+
}