本文整理汇总了PHP中DateTimeUtil::convertTimestampToDbFormatDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::convertTimestampToDbFormatDateTime方法的具体用法?PHP DateTimeUtil::convertTimestampToDbFormatDateTime怎么用?PHP DateTimeUtil::convertTimestampToDbFormatDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::convertTimestampToDbFormatDateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Deletes all job logs where the modifiedDateTime was more than 1 week ago.
* Runs operation in bulk to improve performance when large jobLogs are present.
*
* @see BaseJob::run()
*/
public function run()
{
$oneWeekAgoTimeStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 7);
$sql = 'DELETE from item, joblog using joblog inner join item on ' . 'item.id = joblog.item_id where joblog.enddatetime <= "' . $oneWeekAgoTimeStamp . '"';
ZurmoRedBean::exec($sql);
return true;
}
示例2: testCreateAndGetMissionById
public function testCreateAndGetMissionById()
{
$super = User::getByUsername('super');
$fileModel = ZurmoTestHelper::createFileModel();
$steven = UserTestHelper::createBasicUserWithEmailAddress('steven');
$steven->setRight('MissionsModule', MissionsModule::RIGHT_ACCESS_MISSIONS);
$steven->save();
$dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
$mission = new Mission();
$mission->owner = $super;
$mission->takenByUser = $steven;
$mission->dueDateTime = $dueStamp;
$mission->description = 'My test description';
$mission->reward = 'My test reward';
$mission->status = Mission::STATUS_AVAILABLE;
$mission->files->add($fileModel);
$everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
$mission->addPermissions($everyoneGroup, Permission::READ_WRITE);
$this->assertTrue($mission->save());
AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, $everyoneGroup);
$id = $mission->id;
$mission->forget();
unset($mission);
$mission = Mission::getById($id);
$this->assertEquals('My test description', $mission->description);
$this->assertEquals('My test reward', $mission->reward);
$this->assertEquals(Mission::STATUS_AVAILABLE, $mission->status);
$this->assertEquals($super, $mission->owner);
$this->assertEquals($steven, $mission->takenByUser);
$this->assertEquals(1, $mission->files->count());
$this->assertEquals($fileModel, $mission->files->offsetGet(0));
$this->assertEquals($dueStamp, $mission->dueDateTime);
$this->assertTrue(MissionsUtil::hasUserReadMissionLatest($mission, $super));
$this->assertFalse(MissionsUtil::hasUserReadMissionLatest($mission, $steven));
}
示例3: resolveAndSaveEmailMessage
public static function resolveAndSaveEmailMessage($textContent, $htmlContent, Item $itemOwnerModel, Contact $contact, MarketingList $marketingList, $itemId, $folderId)
{
$recipient = static::resolveRecipient($contact);
if (empty($recipient)) {
throw new MissingRecipientsForEmailMessageException();
}
$userId = static::resolveCurrentUserId();
if (get_class($itemOwnerModel) == 'Campaign') {
$ownerId = $itemOwnerModel->owner->id;
} else {
$ownerId = $marketingList->owner->id;
}
$subject = $itemOwnerModel->subject;
$serializedData = serialize($subject);
$headers = static::resolveHeaders($itemId);
$nowTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$emailMessageData = compact('subject', 'serializedData', 'textContent', 'htmlContent', 'userId', 'ownerId', 'headers', 'attachments', 'folderId', 'nowTimestamp');
$attachments = array('relatedModelType' => strtolower(get_class($itemOwnerModel)), 'relatedModelId' => $itemOwnerModel->id);
$sender = static::resolveSender($marketingList, $itemOwnerModel);
$emailMessageData = CMap::mergeArray($emailMessageData, $sender, $recipient, $attachments);
$emailMessageId = static::saveEmailMessageWithRelated($emailMessageData);
if (empty($emailMessageId)) {
throw new FailedToSaveModelException();
}
$emailMessage = EmailMessage::getById($emailMessageId);
return $emailMessage;
}
示例4: testCreateAndGetMissionById
public function testCreateAndGetMissionById()
{
$super = User::getByUsername('super');
$fileModel = ZurmoTestHelper::createFileModel();
$steven = UserTestHelper::createBasicUser('steven');
$dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
$mission = new Mission();
$mission->owner = $super;
$mission->takenByUser = $steven;
$mission->dueDateTime = $dueStamp;
$mission->description = 'My test description';
$mission->reward = 'My test reward';
$mission->status = Mission::STATUS_AVAILABLE;
$mission->files->add($fileModel);
$mission->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE);
$this->assertTrue($mission->save());
$id = $mission->id;
$mission->forget();
unset($mission);
$mission = Mission::getById($id);
$this->assertEquals('My test description', $mission->description);
$this->assertEquals('My test reward', $mission->reward);
$this->assertEquals(Mission::STATUS_AVAILABLE, $mission->status);
$this->assertEquals($super, $mission->owner);
$this->assertEquals($steven, $mission->takenByUser);
$this->assertEquals(1, $mission->files->count());
$this->assertEquals($fileModel, $mission->files->offsetGet(0));
$this->assertEquals($dueStamp, $mission->dueDateTime);
$this->assertTrue(MissionsUtil::hasUserReadMissionLatest($mission, $super));
$this->assertFalse(MissionsUtil::hasUserReadMissionLatest($mission, $steven));
}
示例5: testGetByType
public function testGetByType()
{
Yii::app()->user->userModel = User::getByUsername('super');
$jobLog = new JobLog();
$jobLog->type = 'Monitor';
$jobLog->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
$jobLog->isProcessed = false;
$this->assertTrue($jobLog->save());
$jobLog = new JobLog();
$jobLog->type = 'Monitor';
$jobLog->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
$jobLog->isProcessed = false;
$this->assertTrue($jobLog->save());
$jobLog = new JobLog();
$jobLog->type = 'SomethingElse';
$jobLog->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
$jobLog->isProcessed = false;
$this->assertTrue($jobLog->save());
$jobLogs = JobLog::getByType('Monitor');
$this->assertCount(2, $jobLogs);
$jobLogs = JobLog::getByType('Monitor', 1);
$this->assertCount(1, $jobLogs);
$jobLogs = JobLog::getByType('SomethingElse');
$this->assertCount(1, $jobLogs);
$jobLogs = JobLog::getByType('SomethingElse', 1);
$this->assertCount(1, $jobLogs);
}
示例6: testGetSearchAttributesDataByModelClassNamesAndRelatedItemIds
public function testGetSearchAttributesDataByModelClassNamesAndRelatedItemIds()
{
Yii::app()->user->userModel = User::getByUsername('super');
$modelClassNames = array('Meeting', 'Task', 'Note');
$relationItemIds = array(5, 7, 9);
$searchAttributesData = LatestActivitiesUtil::getSearchAttributesDataByModelClassNamesAndRelatedItemIds($modelClassNames, $relationItemIds, LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL);
$compareSearchAttributesData = array();
$compareSearchAttributesData['Meeting']['clauses'] = array(1 => array('attributeName' => 'activityItems', 'relatedAttributeName' => 'id', 'operatorType' => 'oneOf', 'value' => array(5, 7, 9)), 2 => array('attributeName' => 'startDateTime', 'operatorType' => 'lessThan', 'value' => DateTimeUtil::convertTimestampToDbFormatDateTime(time())), 3 => array('attributeName' => 'logged', 'operatorType' => 'equals', 'value' => true));
$compareSearchAttributesData['Meeting']['structure'] = '1 and (2 or 3)';
$compareSearchAttributesData['Task']['clauses'] = array(1 => array('attributeName' => 'activityItems', 'relatedAttributeName' => 'id', 'operatorType' => 'oneOf', 'value' => array(5, 7, 9)), 2 => array('attributeName' => 'completed', 'operatorType' => 'equals', 'value' => (bool) 1));
$compareSearchAttributesData['Task']['structure'] = '1 and 2';
$compareSearchAttributesData['Note']['clauses'] = array(1 => array('attributeName' => 'activityItems', 'relatedAttributeName' => 'id', 'operatorType' => 'oneOf', 'value' => array(5, 7, 9)));
$compareSearchAttributesData['Note']['structure'] = '1';
$this->assertEquals($compareSearchAttributesData['Meeting'], $searchAttributesData[0]['Meeting']);
$this->assertEquals($compareSearchAttributesData['Task'], $searchAttributesData[1]['Task']);
$this->assertEquals($compareSearchAttributesData['Note'], $searchAttributesData[2]['Note']);
$searchAttributesData = LatestActivitiesUtil::getSearchAttributesDataByModelClassNamesAndRelatedItemIds($modelClassNames, $relationItemIds, LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER);
$compareSearchAttributesData['Meeting']['structure'] = '1 and (2 or 3) and 4';
$compareSearchAttributesData['Meeting']['clauses'][4] = array('attributeName' => 'owner', 'operatorType' => 'equals', 'value' => Yii::app()->user->userModel->id);
$compareSearchAttributesData['Task']['structure'] = '1 and 2 and 3';
$compareSearchAttributesData['Task']['clauses'][3] = array('attributeName' => 'owner', 'operatorType' => 'equals', 'value' => Yii::app()->user->userModel->id);
$compareSearchAttributesData['Note']['structure'] = '1 and 2';
$compareSearchAttributesData['Note']['clauses'][2] = array('attributeName' => 'owner', 'operatorType' => 'equals', 'value' => Yii::app()->user->userModel->id);
$this->assertEquals($compareSearchAttributesData['Meeting'], $searchAttributesData[0]['Meeting']);
$this->assertEquals($compareSearchAttributesData['Task'], $searchAttributesData[1]['Task']);
$this->assertEquals($compareSearchAttributesData['Note'], $searchAttributesData[2]['Note']);
}
示例7: testRun
public function testRun()
{
$quote = DatabaseCompatibilityUtil::getQuote();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
$folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
//Create 2 sent notifications, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
$emailMessage = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
$emailMessage->folder = $folder;
$saved = $emailMessage->save();
$this->assertTrue($saved);
$modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
$sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $emailMessage->getClassId('Item');
ZurmoRedBean::exec($sql);
$emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('My Email Message 2', $super);
$emailMessage2->folder = $folder;
$saved = $emailMessage2->save();
$this->assertTrue($saved);
$this->assertEquals(2, EmailMessage::getCount());
$job = new ClearSentNotificationsEmailJob();
$this->assertTrue($job->run());
$emailMessages = EmailMessage::getAll();
$this->assertEquals(1, count($emailMessages));
$this->assertEquals($emailMessage2->id, $emailMessages[0]->id);
}
示例8: testRunAndProcessStuckJobs
public function testRunAndProcessStuckJobs()
{
Yii::app()->user->userModel = User::getByUsername('super');
$emailAddress = new Email();
$emailAddress->emailAddress = 'sometest@zurmoalerts.com';
Yii::app()->user->userModel->primaryEmail = $emailAddress;
$saved = Yii::app()->user->userModel->save();
$this->assertTrue($saved);
$this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
$this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
$monitorJob = new MonitorJob();
$this->assertEquals(0, count(JobInProcess::getAll()));
$this->assertEquals(0, count(Notification::getAll()));
$jobInProcess = new JobInProcess();
$jobInProcess->type = 'Test';
$this->assertTrue($jobInProcess->save());
//Should make createdDateTime long enough in past to trigger as stuck.
$createdDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 1000);
$sql = "Update item set createddatetime = '" . $createdDateTime . "' where id = " . $jobInProcess->getClassId('Item');
R::exec($sql);
$jobInProcess->forget();
$monitorJob->run();
$this->assertEquals(1, count(Notification::getAll()));
//Confirm an email was sent
$this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
$this->assertEquals(1, Yii::app()->emailHelper->getSentCount());
}
示例9: testRun
public function testRun()
{
//Create 2 jobLogs, and set one with a date over a week ago (8 days ago) for the endDateTime
$eightDaysAgoTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
$jobLog = new JobLog();
$jobLog->type = 'Monitor';
$jobLog->startDateTime = $eightDaysAgoTimestamp;
$jobLog->endDateTime = $eightDaysAgoTimestamp;
$jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
$jobLog->isProcessed = false;
$jobLog->save();
$jobLog2 = new JobLog();
$jobLog2->type = 'ImportCleanup';
$jobLog2->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog2->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$jobLog2->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
$jobLog2->isProcessed = false;
$jobLog2->save();
$sql = 'select count(*) count from item';
$row = R::getRow($sql);
$this->assertEquals(4, $row['count']);
$job = new JobLogCleanupJob();
$this->assertTrue($job->run());
$jobLogs = JobLog::getAll();
$this->assertEquals(1, count($jobLogs));
$this->assertEquals($jobLog2->id, $jobLogs[0]->id);
$sql = 'select count(*) count from item';
$row = R::getRow($sql);
$this->assertEquals(3, $row['count']);
}
示例10: testRun
public function testRun()
{
$quote = DatabaseCompatibilityUtil::getQuote();
//Create 2 imports, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
$import = new Import();
$serializedData['importRulesType'] = 'ImportModelTestItem';
$import->serializedData = serialize($serializedData);
$this->assertTrue($import->save());
ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName(), true);
$modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
$sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $import->getClassId('Item');
ZurmoRedBean::exec($sql);
$staleImportId = $import->id;
$import2 = new Import();
$serializedData['importRulesType'] = 'ImportModelTestItem';
$import2->serializedData = serialize($serializedData);
$this->assertTrue($import2->save());
ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import2->getTempTableName(), true);
$this->assertEquals(2, Import::getCount());
$tableExists = ZurmoRedBean::$writer->doesTableExist($import->getTempTableName());
$this->assertTrue($tableExists);
$job = new ImportCleanupJob();
$this->assertTrue($job->run());
$tableExists = ZurmoRedBean::$writer->doesTableExist($import->getTempTableName());
$this->assertFalse($tableExists);
$imports = Import::getAll();
$this->assertEquals(1, count($imports));
$this->assertEquals($import2->id, $imports[0]->id);
}
示例11: testProcessAfterSaveWhenSendIsInFuture
public function testProcessAfterSaveWhenSendIsInFuture()
{
$this->assertEquals(0, WorkflowMessageInQueue::getCount());
$workflow = new Workflow();
$workflow->setId(self::$savedWorkflow->id);
$workflow->type = Workflow::TYPE_ON_SAVE;
$emailMessageForm = new EmailMessageForWorkflowForm('WorkflowModelTestItem', Workflow::TYPE_ON_SAVE);
$emailMessageForm->sendAfterDurationInterval = 1;
$emailMessageForm->sendAfterDurationType = TimeDurationUtil::DURATION_TYPE_DAY;
$recipients = array(array('type' => WorkflowEmailMessageRecipientForm::TYPE_DYNAMIC_TRIGGERED_MODEL_USER, 'audienceType' => EmailMessageRecipient::TYPE_TO, 'dynamicUserType' => DynamicTriggeredModelUserWorkflowEmailMessageRecipientForm::DYNAMIC_USER_TYPE_CREATED_BY_USER));
$emailMessageForm->setAttributes(array(EmailMessageForWorkflowForm::EMAIL_MESSAGE_RECIPIENTS => $recipients));
$workflow->addEmailMessage($emailMessageForm);
$model = new WorkflowModelTestItem();
$model->lastName = 'lastName';
$model->string = 'string';
$this->assertTrue($model->save());
$compareDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 86400);
WorkflowEmailMessagesUtil::processAfterSave($workflow, $model, Yii::app()->user->userModel);
$workflowMessageInQueues = WorkflowMessageInQueue::getAll();
$this->assertEquals(1, count($workflowMessageInQueues));
$this->assertTrue($workflowMessageInQueues[0]->savedWorkflow->isSame(self::$savedWorkflow));
$this->assertTrue($workflowMessageInQueues[0]->triggeredByUser->isSame(Yii::app()->user->userModel));
$this->assertEquals($model->getClassId('Item'), $workflowMessageInQueues[0]->modelItem->getClassId('Item'));
$this->assertEquals('WorkflowModelTestItem', $workflowMessageInQueues[0]->modelClassName);
$this->assertEquals($compareDateTime, $workflowMessageInQueues[0]->processDateTime);
$emailMessageData = SavedWorkflowToWorkflowAdapter::makeArrayFromEmailMessageForWorkflowFormAttributesData(array($emailMessageForm));
$this->assertEquals(serialize($emailMessageData), $workflowMessageInQueues[0]->serializedData);
$this->assertTrue($workflowMessageInQueues[0]->delete());
}
示例12: testSimpleUserImportWhereAllRowsSucceed
public function testSimpleUserImportWhereAllRowsSucceed()
{
Yii::app()->user->userModel = User::getByUsername('super');
$tasks = Task::getAll();
$this->assertEquals(0, count($tasks));
$import = new Import();
$serializedData['importRulesType'] = 'Tasks';
$serializedData['firstRowIsHeaderRow'] = true;
$import->serializedData = serialize($serializedData);
$this->assertTrue($import->save());
ImportTestHelper::createTempTableByFileNameAndTableName('simpleImportTest.csv', $import->getTempTableName(), Yii::getPathOfAlias('application.modules.tasks.tests.unit.files'));
$this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
// includes header rows.
$mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeDateTimeColumnMappingData('dueDateTime'), 'column_2' => ImportMappingUtil::makeDateTimeColumnMappingData('completedDateTime'), 'column_3' => ImportMappingUtil::makeBooleanColumnMappingData('completed'), 'column_4' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived'), 'column_5' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived'), 'column_6' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived'), 'column_7' => ImportMappingUtil::makeTextAreaColumnMappingData('description'));
$importRules = ImportRulesUtil::makeImportRulesByType('Tasks');
$page = 0;
$config = array('pagination' => array('pageSize' => 50));
//This way all rows are processed.
$dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
$dataProvider->getPagination()->setCurrentPage($page);
$importResultsUtil = new ImportResultsUtil($import);
$actionDateTime = substr(DateTimeUtil::convertTimestampToDbFormatDateTime(time()), 0, -3);
$messageLogger = new ImportMessageLogger();
ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
$importResultsUtil->processStatusAndMessagesForEachRow();
//Confirm that 3 models where created.
$tasks = Task::getAll();
$this->assertEquals(3, count($tasks));
$tasks = Task::getByName('task1');
$this->assertEquals(1, count($tasks[0]));
$this->assertEquals(1, count($tasks[0]->activityItems));
$this->assertEquals('testAccount', $tasks[0]->activityItems[0]->name);
$this->assertEquals('Account', get_class($tasks[0]->activityItems[0]));
$this->assertNull($tasks[0]->completed);
$this->assertEquals($actionDateTime, substr($tasks[0]->latestDateTime, 0, -3));
$tasks = Task::getByName('task2');
$this->assertEquals(1, count($tasks[0]));
$this->assertEquals(1, count($tasks[0]->activityItems));
$this->assertEquals('testContact', $tasks[0]->activityItems[0]->firstName);
$this->assertEquals('Contact', get_class($tasks[0]->activityItems[0]));
$this->assertEquals(1, $tasks[0]->completed);
$this->assertEquals('2011-12-22 06:03', substr($tasks[0]->latestDateTime, 0, -3));
$tasks = Task::getByName('task3');
$this->assertEquals(1, count($tasks[0]));
$this->assertEquals(1, count($tasks[0]->activityItems));
$this->assertEquals('testOpportunity', $tasks[0]->activityItems[0]->name);
$this->assertEquals('Opportunity', get_class($tasks[0]->activityItems[0]));
$this->assertNull($tasks[0]->completed);
$this->assertEquals($actionDateTime, substr($tasks[0]->latestDateTime, 0, -3));
//Confirm 10 rows were processed as 'created'.
$this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::CREATED));
//Confirm that 0 rows were processed as 'updated'.
$this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
//Confirm 2 rows were processed as 'errors'.
$this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
$beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
$this->assertEquals(0, count($beansWithErrors));
}
示例13: generateCampaignItemsForDueCampaigns
/**
* @return bool
*/
public function generateCampaignItemsForDueCampaigns()
{
$nowTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
// Begin Not Coding Standard
$sql = "`generate_campaign_items`(" . Campaign::STATUS_ACTIVE . "," . Campaign::STATUS_PROCESSING . ",'{$nowTimestamp}')";
// End Not Coding Standard
ZurmoDatabaseCompatibilityUtil::callProcedureWithoutOuts($sql);
Yii::app()->jobQueue->add('CampaignQueueMessagesInOutbox', 5);
return true;
}
示例14: testInlineCreateCommentFromAjax
public function testInlineCreateCommentFromAjax()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$task = new Task();
$task->name = 'aTest';
$nowStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$this->assertTrue($task->save());
$this->setGetArray(array('id' => $task->id, 'uniquePageId' => 'CommentInlineEditForModelView'));
$this->runControllerWithNoExceptionsAndGetContent('tasks/default/inlineCreateCommentFromAjax');
}
示例15: resolveSearchAttributeDataForLatestActivities
/**
* Only show meetings that have a start date in the past from when the mashable activity feed is run.
* @see ActivityMashableActivityRules::resolveSearchAttributeDataForLatestActivities()
*/
public function resolveSearchAttributeDataForLatestActivities($searchAttributeData)
{
assert('is_array($searchAttributeData)');
$clausesCount = count($searchAttributeData['clauses']);
$searchAttributeData['clauses'][$clausesCount + 1] = array('attributeName' => 'startDateTime', 'operatorType' => 'lessThan', 'value' => DateTimeUtil::convertTimestampToDbFormatDateTime(Yii::app()->timeZoneHelper->convertFromLocalTimeStampForCurrentUser(time())));
if ($searchAttributeData['structure'] != null) {
$searchAttributeData['structure'] .= ' and ';
}
$searchAttributeData['structure'] .= $clausesCount + 1;
return $searchAttributeData;
}