* @param $entity
* @param $action
* @param array $params
+ * @param $expectedError
* @dataProvider badDataProvider
*/
public function testBad($entity, $action, $params, $expectedError) {
/**
* 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(
$financialAccountTitle,
}
}
+ /**
+ * Override to run the test and assert its state.
+ * @return mixed
+ * @throws \Exception
+ * @throws \PHPUnit_Framework_IncompleteTest
+ * @throws \PHPUnit_Framework_SkippedTest
+ */
protected function runTest() {
try {
return parent::runTest();
*
* @param array $params
* Parameters.
+ * @return array
*/
public function activityTypeCreate($params) {
- $result = $this->callAPISuccess('ActivityType', 'create', $params);
- return $result;
- }
+ return $this->callAPISuccess('ActivityType', 'create', $params);
+ }
/**
* Delete activity type
*
* @param int $activityTypeId
* Id of the activity type.
+ * @return array
*/
public function activityTypeDelete($activityTypeId) {
$params['activity_type_id'] = $activityTypeId;
- $result = $this->callAPISuccess('ActivityType', 'delete', $params);
- return $result;
- }
+ return $this->callAPISuccess('ActivityType', 'delete', $params);
+ }
/**
* Create custom group
return TRUE;
}
}
+ return FALSE;
}
/**
* (eg "MyFirstTest::testFoo").
*/
class EnvTests extends \PHPUnit_Framework_TestSuite {
+ /**
+ * @return \EnvTests
+ */
public static function suite() {
require_once 'CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();
'subject' => 'this case should fail',
'scheduled_date_time' => date('Ymd'),
);
- $result = $this->callAPIFailure('activity', 'create', $params);
+ $this->callAPIFailure('activity', 'create', $params);
}
+ /**
+ *
+ */
public function testActionScheduleWithScheduledDatesCreate() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
- $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$scheduledStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
$mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value');
$activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', "Meeting", 'name');
$this->assertEquals(0, $get['count'], 'ActivityContact not successfully deleted');
}
+ /**
+ *
+ */
public function testGetActivitiesByContact() {
- $result = $this->callAPISuccess('ActivityContact', 'Get', array('contact_id' => $this->_contactID));
+ $this->callAPISuccess('ActivityContact', 'Get', array('contact_id' => $this->_contactID));
}
- public function testGetPartitipantsByActivity() {
- $result = $this->callAPISuccess('ActivityContact', 'Get', array('activity_id' => $this->_activityID));
+ public function testGetParticipantsByActivity() {
+ $this->callAPISuccess('ActivityContact', 'Get', array('activity_id' => $this->_activityID));
}
/**
class api_v3_AttachmentTest extends CiviUnitTestCase {
protected static $filePrefix = NULL;
+ /**
+ * @return string
+ */
public static function getFilePrefix() {
if (!self::$filePrefix) {
self::$filePrefix = "test_" . CRM_Utils_String::createRandom(5, CRM_Utils_String::ALPHANUMERIC) . '_';
\Civi\Core\Container::singleton(TRUE);
}
+ /**
+ * @return array
+ */
public function okCreateProvider() {
$cases = array(); // array($entityClass, $createParams, $expectedContent)
return $cases;
}
+ /**
+ * @return array
+ */
public function badCreateProvider() {
$cases = array(); // array($entityClass, $createParams, $expectedError)
return $cases;
}
+ /**
+ * @return array
+ */
public function badUpdateProvider() {
$cases = array(); // array($entityClass, $createParams, $updateParams, $expectedError)
return $cases;
}
+ /**
+ * @return array
+ */
public function okGetProvider() {
$cases = array(); // array($getParams, $expectedNames)
return $cases;
}
+ /**
+ * @return array
+ */
public function badGetProvider() {
$cases = array(); // array($getParams, $expectedNames)
$this->assertAttachmentExistence(FALSE, $createResults['delme']['second']);
}
+ /**
+ * @param $exists
+ * @param array $apiResult
+ */
protected function assertAttachmentExistence($exists, $apiResult) {
$fileId = $apiResult['id'];
$this->assertTrue(is_numeric($fileId));
));
}
+ /**
+ * @param $name
+ * @return string
+ */
protected function tmpFile($name) {
$tmpDir = sys_get_temp_dir();
$this->assertTrue($tmpDir && is_dir($tmpDir), 'Tmp dir must exist: ' . $tmpDir);
));
}
+ /**
+ * @return array
+ */
public function groupPctProvider() {
$cases = array(); // array(int $totalSize, int $groupPct, int $expectedCountA, $expectedCountB, $expectedCountC)
$cases[] = array(400, 7, 28, 28, 344);
$this->assertEquals($expectedCountC, $countC, "check mailing recipients C in line " . __LINE__);
}
+ /**
+ * @param $expectedA
+ * @param $expectedB
+ * @param $expectedC
+ */
protected function assertJobCounts($expectedA, $expectedB, $expectedC) {
$this->assertDBQuery($expectedA, 'SELECT count(*) FROM civicrm_mailing_job WHERE mailing_id = %1', array(
1 => array(
}
/**
- * @param array $params
* @param int $financialTypeId
+ * @return int
*/
public function _getFinancialAccountId($financialTypeId) {
$accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
return CRM_Utils_Array::value('financial_account_id', $result);
}
- ///////////////// civicrm_contribution_delete methods
+ /**
+ *
+ */
public function testDeleteContribution() {
$contributionID = $this->contributionCreate($this->_individualId, $this->financialtypeID, 'dfsdf', 12389);
$params = array(