本文整理汇总了PHP中DateTimeUtil类的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil类的具体用法?PHP DateTimeUtil怎么用?PHP DateTimeUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DateTimeUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetHis
/**
* @covers DateTimeUtil::getHis
*/
public function testGetHis()
{
$obj = new DateTimeUtil();
$val = 1448400000;
$actual = $obj->getHis($val);
$expected = '06:20:00';
$this->assertEquals($expected, $actual, __CLASS__ . "::" . __METHOD__ . ": line " . __LINE__);
}
示例2: 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());
}
示例3: renderExpirationDateTimeContent
protected static function renderExpirationDateTimeContent(GameReward $gameReward)
{
if (!DateTimeUtil::isDateTimeStringNull($gameReward->expirationDateTime)) {
$content = Zurmo::t('ZurmoModule', 'Until') . ' ';
return $content . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($gameReward->expirationDateTime);
}
}
示例4: 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);
}
示例5: renderItemAndCommentsContent
/**
* Renders and returns string content of summary content for the given model.
* @param RedBeanModel $model
* @param mixed $redirectUrl
* @param string $ownedByFilter
* @param string $viewModuleClassName
* @return string content
*/
public static function renderItemAndCommentsContent(SocialItem $model, $redirectUrl, $renderToUserString)
{
assert('is_string($redirectUrl) || $redirectUrl == null');
$userUrl = Yii::app()->createUrl('/users/default/details', array('id' => $model->owner->id));
$content = '<div class="social-item">';
$avatarImage = $model->owner->getAvatarImage(50);
$content .= '<div class="comment model-details-summary clearfix">';
$content .= '<span class="user-details">' . ZurmoHtml::link($avatarImage, $userUrl);
$content .= '</span>';
$userLink = ZurmoHtml::link(strval($model->owner), $userUrl, array('class' => 'user-link'));
$content .= '<div class="comment-content"><p>';
if ($model->toUser->id > 0 && $renderToUserString) {
$toUserUrl = Yii::app()->createUrl('/users/default/details', array('id' => $model->toUser->id));
$toUserLink = ZurmoHtml::link(strval($model->toUser), $toUserUrl, array('class' => 'user-link'));
$content .= Zurmo::t('SocialItemsModule', '{postedFromUser} to {postedToUser}', array('{postedFromUser}' => $userLink, '{postedToUser}' => $toUserLink));
} else {
$content .= $userLink;
}
$content .= '</p>';
$content .= self::renderModelDescription($model) . '</div>';
$content .= self::renderAfterDescriptionContent($model);
$content .= self::renderItemFileContent($model);
$content .= '<span class="comment-details"><strong>' . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($model->createdDateTime, 'long', null) . '</strong>';
if ($model->canUserDelete(Yii::app()->user->userModel)) {
$content .= ' · <span class="delete-comment">' . self::renderDeleteLinkContent($model) . '</span></span>';
}
$content .= '</div>';
$content .= self::renderCommentsContent($model);
$content .= self::renderCreateCommentContent($model);
$content .= '</div>';
self::registerListColumnScripts();
return $content;
}
示例6: makeCombinedData
/**
* @return array
*/
protected function makeCombinedData()
{
$combinedRows = array();
$groupBy = $this->resolveGroupBy('EmailMessage', 'sentDateTime');
$beginDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($this->beginDate);
$endDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($this->endDate);
if ($this->marketingList == null) {
$searchAttributeData = static::makeCampaignsSearchAttributeData('sentDateTime', $beginDateTime, $endDateTime, $this->campaign);
$sql = static::makeCampaignsSqlQuery($searchAttributeData, $groupBy);
$rows = R::getAll($sql);
foreach ($rows as $row) {
$chartIndexToCompare = $row[$this->resolveIndexGroupByToUse()];
$combinedRows[$chartIndexToCompare] = $row;
}
}
if ($this->campaign == null) {
$searchAttributeData = static::makeAutorespondersSearchAttributeData('sentDateTime', $beginDateTime, $endDateTime, $this->marketingList);
$sql = static::makeAutorespondersSqlQuery($searchAttributeData, $groupBy);
$rows = R::getAll($sql);
foreach ($rows as $row) {
$chartIndexToCompare = $row[$this->resolveIndexGroupByToUse()];
if (!isset($combinedRows[$chartIndexToCompare])) {
$combinedRows[$chartIndexToCompare] = $row;
} else {
$combinedRows[$chartIndexToCompare][self::COUNT] += $row[self::COUNT];
$combinedRows[$chartIndexToCompare][self::UNIQUE_OPENS] += $row[self::UNIQUE_OPENS];
$combinedRows[$chartIndexToCompare][self::UNIQUE_CLICKS] += $row[self::UNIQUE_CLICKS];
}
}
}
return $combinedRows;
}
示例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: getCommonTimeScope
public static function getCommonTimeScope()
{
static $timeScope = array();
if (empty($timeScope)) {
$time = EnvUtil::getRequest("time");
$start = EnvUtil::getRequest("start");
$end = EnvUtil::getRequest("end");
if (!empty($time)) {
if (!in_array($time, array("thisweek", "lastweek", "thismonth", "lastmonth"))) {
$time = "thisweek";
}
} else {
if (!empty($start) && !empty($end)) {
$start = strtotime($start);
$end = strtotime($end);
if ($start && $end) {
$timeScope = array("timestr" => "custom", "start" => $start, "end" => $end);
}
} else {
$time = "thisweek";
}
}
if (empty($timeScope)) {
$timeScope = DateTimeUtil::getStrTimeScope($time);
$timeScope["timestr"] = $time;
}
}
return $timeScope;
}
示例9: testSanitizePostByDesignerTypeForSavingModel
public function testSanitizePostByDesignerTypeForSavingModel()
{
$language = Yii::app()->getLanguage();
$this->assertEquals($language, 'en');
$postData = array('aDate' => '5/4/11', 'aDateTime' => '5/4/11 5:45 PM');
$sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), $postData);
$compareData = array('aDate' => '2011-05-04', 'aDateTime' => DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('5/4/11 5:45 PM'));
$this->assertEquals($compareData, $sanitizedPostData);
$this->assertTrue(is_string($compareData['aDateTime']));
//now do German (de) to check a different locale.
Yii::app()->setLanguage('de');
$postData = array('aDate' => '04.05.11', 'aDateTime' => '04.05.11 17:45');
$sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), $postData);
$compareData = array('aDate' => '2011-05-04', 'aDateTime' => DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('04.05.11 17:45'));
$this->assertEquals($compareData, $sanitizedPostData);
$this->assertTrue(is_string($compareData['aDateTime']));
//reset language back to english
Yii::app()->setLanguage('en');
//test sanitizing a bad datetime
$sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), array('aDateTime' => 'wang chung'));
$this->assertNull($sanitizedPostData['aDateTime']);
//sanitize an empty datetime
$sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel(new DateDateTime(), array('aDateTime' => ''));
$this->assertEmpty($sanitizedPostData['aDateTime']);
}
示例10: 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']);
}
示例11: sanitizePostByTypeForSavingMappingData
/**
* Sanitize post data, specifically handling any date and date time conversions from local format to the
* database format.
* @param string $importRulesType
* @param array $postMappingData
*/
public static function sanitizePostByTypeForSavingMappingData($importRulesType, $postMappingData)
{
assert('is_string($importRulesType)');
assert('is_array($postMappingData)');
foreach ($postMappingData as $columnName => $mappingData) {
if (!isset($mappingData['mappingRulesData'])) {
$postMappingData[$columnName]['mappingRulesData'] = array();
}
}
foreach ($postMappingData as $columnName => $mappingData) {
foreach ($mappingData['mappingRulesData'] as $mappingRuleFormClassName => $mappingRuleFormData) {
$model = MappingRuleFormAndElementTypeUtil::makeForm($importRulesType, $mappingData['attributeIndexOrDerivedType'], $mappingRuleFormClassName);
foreach ($mappingRuleFormData as $attributeName => $value) {
if ($value !== null) {
if (!is_array($value)) {
if ($model->isAttribute($attributeName) && $model->isAttributeSafe($attributeName)) {
$type = ModelAttributeToMixedTypeUtil::getTypeByModelUsingValidator($model, $model::getAttributeName());
if ($type == 'Date') {
$postMappingData[$columnName]['mappingRulesData'][$mappingRuleFormClassName][$attributeName] = DateTimeUtil::resolveValueForDateDBFormatted($value);
}
if ($type == 'DateTime' && !empty($value)) {
$postMappingData[$columnName]['mappingRulesData'][$mappingRuleFormClassName][$attributeName] = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero($value);
}
}
}
}
}
}
}
return $postMappingData;
}
示例12: 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());
}
示例13: 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;
}
示例14: testSanitizePostByTypeForSavingMappingData
public function testSanitizePostByTypeForSavingMappingData()
{
$language = Yii::app()->getLanguage();
$this->assertEquals($language, 'en');
$postData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '5/4/2011'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '5/4/2011 5:45 PM'))));
$sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
$compareDateTime = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('5/4/2011 5:45 PM');
$compareData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '2011-05-04'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => $compareDateTime))));
$this->assertEquals($compareData, $sanitizedPostData);
//now do German (de) to check a different locale.
Yii::app()->setLanguage('de');
$postData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '04.05.2011'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '04.05.2011 17:45'))));
$sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
$compareDateTime = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('04.05.2011 17:45');
$compareData = array('column_0' => array('attributeIndexOrDerivedType' => 'date', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => '2011-05-04'))), 'column_1' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => $compareDateTime))));
$this->assertEquals($compareData, $sanitizedPostData);
//reset language back to english
Yii::app()->setLanguage('en');
//test sanitizing a bad datetime
$postData = array('column_0' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => 'wang chung'))));
$sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
$this->assertNull($sanitizedPostData['column_0']['mappingRulesData']['DefaultValueModelAttributeMappingRuleForm']['defaultValue']);
//sanitize an empty datetime
$postData = array('column_0' => array('attributeIndexOrDerivedType' => 'dateTime', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => ''))));
$sanitizedPostData = ImportWizardFormPostUtil::sanitizePostByTypeForSavingMappingData('ImportModelTestItem', $postData);
$this->assertEmpty($sanitizedPostData['column_0']['mappingRulesData']['DefaultValueModelAttributeMappingRuleForm']['defaultValue']);
}
示例15: 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));
}