当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::getAll方法代码示例

本文整理汇总了PHP中Notification::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::getAll方法的具体用法?PHP Notification::getAll怎么用?PHP Notification::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notification的用法示例。


在下文中一共展示了Notification::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSubmitNonCritical

 public function testSubmitNonCritical()
 {
     $super = User::getByUsername('super');
     $emailAddress = new Email();
     $emailAddress->emailAddress = 'sometest@zurmoalerts.com';
     $super->primaryEmail = $emailAddress;
     $saved = $super->save();
     $this->assertTrue($saved);
     $billy = User::getByUsername('billy');
     $emailAddress = new Email();
     $emailAddress->emailAddress = 'sometest2@zurmoalerts.com';
     $billy->primaryEmail = $emailAddress;
     $saved = $billy->save();
     $this->assertTrue($saved);
     $notifications = Notification::getAll();
     $this->assertEquals(0, count($notifications));
     $message = new NotificationMessage();
     $message->textContent = 'text content';
     $message->htmlContent = 'html content';
     $rules = new SimpleNotificationRules();
     $rules->addUser($super);
     $rules->addUser($billy);
     NotificationsUtil::submit($message, $rules);
     //It should not send an email because it is non-critical
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $notifications = Notification::getAll();
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:30,代码来源:NotificationsUtilTest.php

示例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());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:27,代码来源:MonitorJobTest.php

示例3: testRun

 public function testRun()
 {
     //Create workflow
     $workflow = new Workflow();
     $workflow->setDescription('aDescription');
     $workflow->setIsActive(true);
     $workflow->setOrder(5);
     $workflow->setModuleClassName('WorkflowsTest2Module');
     $workflow->setName('myFirstWorkflow');
     $workflow->setTriggerOn(Workflow::TRIGGER_ON_NEW_AND_EXISTING);
     $workflow->setType(Workflow::TYPE_ON_SAVE);
     $workflow->setTriggersStructure('1');
     //Add action that is missing required owner
     $action = new ActionForWorkflowForm('WorkflowModelTestItem2', Workflow::TYPE_ON_SAVE);
     $action->type = ActionForWorkflowForm::TYPE_CREATE;
     $action->relation = 'hasMany2';
     $attributes = array('string' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 'jason'), 'lastName' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 'jason'));
     $action->setAttributes(array(ActionForWorkflowForm::ACTION_ATTRIBUTES => $attributes));
     $workflow->addAction($action);
     //Create the saved Workflow
     $savedWorkflow = new SavedWorkflow();
     SavedWorkflowToWorkflowAdapter::resolveWorkflowToSavedWorkflow($workflow, $savedWorkflow);
     $saved = $savedWorkflow->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, count(Notification::getAll()));
     $job = new WorkflowValidityCheckJob();
     $this->assertTrue($job->run());
     $notifications = Notification::getAll();
     $this->assertEquals(1, count($notifications));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:30,代码来源:WorkflowValidityCheckJobTest.php

示例4: testProcessWorkflowAfterSave

 public function testProcessWorkflowAfterSave()
 {
     $model = new WorkflowModelTestItem();
     $event = new CEvent($model);
     $observer = new WorkflowsObserver();
     $observer->setDepth(25);
     $this->assertEquals(0, count(Notification::getAll()));
     $observer->processWorkflowAfterSave($event);
     $this->assertEquals(1, count(Notification::getAll()));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:WorkflowsObserverTest.php

示例5: testLogAndNotifyOnDuplicateGameModel

 /**
  * The best we can cover for is making sure the notification is created and it is not marked as critical.
  */
 public function testLogAndNotifyOnDuplicateGameModel()
 {
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $this->assertEquals(0, count(Notification::getAll()));
     GamificationUtil::logAndNotifyOnDuplicateGameModel('some content');
     //It should not send an email because it is non-critical
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $this->assertEquals(1, count(Notification::getAll()));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:14,代码来源:GamificationUtilTest.php

示例6: testSuperUserAllDefaultControllerActions

 public function testSuperUserAllDefaultControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $notifications = Notification::getAll();
     $this->assertEquals(1, count($notifications));
     //Test all default controller actions that do not require any POST/GET variables to be passed.
     //This actions are being redirected to the mashableInbox module.
     //This does not include portlet controller actions.
     $this->runControllerWithRedirectExceptionAndGetContent('notifications/default');
     $this->runControllerWithRedirectExceptionAndGetContent('notifications/default/index');
     $this->runControllerWithRedirectExceptionAndGetContent('notifications/default/userList');
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:12,代码来源:NotificationsWalkthroughTest.php

示例7: testSubscribeContactToList

 public function testSubscribeContactToList()
 {
     $marketingList = MarketingList::getById(self::$marketingListId);
     $this->assertEquals(0, $marketingList->marketingListMembers->count());
     $action = new ActionForWorkflowForm('Contact', Workflow::TYPE_ON_SAVE);
     $action->type = ActionForWorkflowForm::TYPE_SUBSCRIBE_TO_LIST;
     $attributes = array('marketingList' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => self::$marketingListId));
     $action->setAttributes(array(ActionForWorkflowForm::ACTION_ATTRIBUTES => $attributes));
     $contact = ContactTestHelper::createContactByNameForOwner('jason', Yii::app()->user->userModel);
     $helper = new WorkflowActionProcessingHelper(88, 'some name', $action, $contact, Yii::app()->user->userModel);
     $helper->processNonUpdateSelfAction();
     $marketingList->forget();
     $marketingList = MarketingList::getById(self::$marketingListId);
     $this->assertEquals(1, $marketingList->marketingListMembers->count());
     $this->assertEquals(0, $marketingList->marketingListMembers[0]->unsubscribed);
     //Try adding the same contact again to the list, it should not add the contact again.
     $helper = new WorkflowActionProcessingHelper(88, 'some name', $action, $contact, Yii::app()->user->userModel);
     $helper->processNonUpdateSelfAction();
     $marketingList->forget();
     $marketingList = MarketingList::getById(self::$marketingListId);
     $this->assertEquals(1, $marketingList->marketingListMembers->count());
     $this->assertEquals(0, $marketingList->marketingListMembers[0]->unsubscribed);
     //Unsubscribe contact from list, then resubscribe
     $marketingListMembers = MarketingListMember::getAll();
     $this->assertEquals(1, count($marketingListMembers));
     $marketingListMembers[0]->unsubscribed = true;
     $marketingListMembers[0]->unrestrictedSave();
     $marketingList->forget();
     $marketingList = MarketingList::getById(self::$marketingListId);
     $this->assertEquals(1, $marketingList->marketingListMembers->count());
     $this->assertEquals(1, $marketingList->marketingListMembers[0]->unsubscribed);
     //Try to resubscribe the contact, it should not resubscribe them
     $helper = new WorkflowActionProcessingHelper(88, 'some name', $action, $contact, Yii::app()->user->userModel);
     $helper->processNonUpdateSelfAction();
     $marketingList->forget();
     $marketingList = MarketingList::getById(self::$marketingListId);
     $this->assertEquals(1, $marketingList->marketingListMembers->count());
     $this->assertEquals(1, $marketingList->marketingListMembers[0]->unsubscribed);
     //Test gracefully handling trying to subscribe to a marketing list that does not exist
     $this->assertEquals(0, count(Notification::getAll()));
     $action = new ActionForWorkflowForm('Contact', Workflow::TYPE_ON_SAVE);
     $action->type = ActionForWorkflowForm::TYPE_SUBSCRIBE_TO_LIST;
     $attributes = array('marketingList' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 123456789));
     $action->setAttributes(array(ActionForWorkflowForm::ACTION_ATTRIBUTES => $attributes));
     $helper = new WorkflowActionProcessingHelper(88, 'some name', $action, $contact, Yii::app()->user->userModel);
     $helper->processNonUpdateSelfAction();
     $notifications = Notification::getAll();
     $this->assertEquals(1, count($notifications));
     //Test gracefully handling trying to unsubscribe to a marketing list that does not exist
     $this->assertTrue($notifications[0]->delete());
     $this->assertEquals(0, count(Notification::getAll()));
     $action = new ActionForWorkflowForm('Contact', Workflow::TYPE_ON_SAVE);
     $action->type = ActionForWorkflowForm::TYPE_UNSUBSCRIBE_FROM_LIST;
     $attributes = array('marketingList' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 123456789));
     $action->setAttributes(array(ActionForWorkflowForm::ACTION_ATTRIBUTES => $attributes));
     $helper = new WorkflowActionProcessingHelper(88, 'some name', $action, $contact, Yii::app()->user->userModel);
     $helper->processNonUpdateSelfAction();
     $this->assertEquals(1, count(Notification::getAll()));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:59,代码来源:WorkflowActionProcessingHelperTest.php

示例8: testProjectNotifications

 public function testProjectNotifications()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $super->primaryEmail->emailAddress = 'super@zurmo.com';
     $super->save();
     Yii::app()->user->userModel = $super;
     $user = UserTestHelper::createBasicUser('ProjectUser');
     Notification::deleteAll();
     EmailMessage::deleteAll();
     $project = new Project();
     $project->name = 'Project For Notifications Test';
     $project->owner = $super;
     $project->description = 'Description';
     $this->assertTrue($project->save());
     //New project notification
     $notifications = Notification::getAll();
     $emailMessages = EmailMessage::getAll();
     $this->assertCount(1, $notifications);
     $this->assertCount(1, $emailMessages);
     $this->assertContains("The project, 'Project For Notifications Test', is now owned by you.", $notifications[0]->notificationMessage->textContent);
     $this->assertContains("The project, 'Project For Notifications Test', is now owned by you.", $emailMessages[0]->content->textContent);
     //Project archived notification
     $project->status = Project::STATUS_ARCHIVED;
     $this->assertTrue($project->save());
     $notifications = Notification::getAll();
     $emailMessages = EmailMessage::getAll();
     $this->assertCount(2, $notifications);
     $this->assertCount(2, $emailMessages);
     $this->assertContains("The project, 'Project For Notifications Test', is now archived.", $notifications[1]->notificationMessage->textContent);
     $this->assertContains("The project, 'Project For Notifications Test', is now archived.", $emailMessages[1]->content->textContent);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:32,代码来源:ProjectTest.php

示例9: testExportAction

 /**
  * @depends testCreateActionForRowsAndColumns
  */
 public function testExportAction()
 {
     if (RedBeanDatabase::isFrozen()) {
         return;
     }
     $notificationsBeforeCount = count(Notification::getAll());
     $notificationMessagesBeforeCount = count(NotificationMessage::getAll());
     $savedReports = SavedReport::getAll();
     $this->assertEquals(2, count($savedReports));
     $this->setGetArray(array('id' => $savedReports[0]->id));
     //Test where there is no data to export
     $this->runControllerWithRedirectExceptionAndGetContent('reports/default/export');
     $this->assertContains('There is no data to export.', Yii::app()->user->getFlash('notification'));
     $reportModelTestItem = new ReportModelTestItem();
     $reportModelTestItem->string = 'string1';
     $reportModelTestItem->lastName = 'xLast1';
     $this->assertTrue($reportModelTestItem->save());
     $reportModelTestItem = new ReportModelTestItem();
     $reportModelTestItem->string = 'string2';
     $reportModelTestItem->lastName = 'xLast2';
     $this->assertTrue($reportModelTestItem->save());
     $content = $this->runControllerWithExitExceptionAndGetContent('reports/default/export');
     $this->assertEquals('Testing download.', $content);
     ExportModule::$asynchronousThreshold = 1;
     $this->runControllerWithRedirectExceptionAndGetUrl('reports/default/export');
     // Start background job
     $job = new ExportJob();
     $this->assertTrue($job->run());
     $exportItems = ExportItem::getAll();
     $this->assertEquals(1, count($exportItems));
     $fileModel = $exportItems[0]->exportFileModel;
     $this->assertEquals(1, $exportItems[0]->isCompleted);
     $this->assertEquals('csv', $exportItems[0]->exportFileType);
     $this->assertEquals('reports', $exportItems[0]->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     $this->assertEquals($notificationsBeforeCount + 1, count(Notification::getAll()));
     $this->assertEquals($notificationMessagesBeforeCount + 1, count(NotificationMessage::getAll()));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:41,代码来源:ReportsSuperUserWalkthroughTest.php

示例10: testGetCountByTypeAndUser

 /**
  * @depends testNotificationMessage
  */
 public function testGetCountByTypeAndUser()
 {
     $super = User::getByUsername('super');
     $billy = User::getByUsername('billy');
     Yii::app()->user->userModel = $super;
     $this->assertEquals(0, count(Notification::getAll()));
     $notification = new Notification();
     $notification->type = 'Simple';
     $notification->owner = $super;
     $this->assertTrue($notification->save());
     $notification = new Notification();
     $notification->type = 'Simple';
     $notification->owner = $super;
     $this->assertTrue($notification->save());
     //There are 2 notifications
     $this->assertEquals(2, count(Notification::getAll()));
     //And 0 notifications unread for billy
     $this->assertEquals(0, Notification::getCountByTypeAndUser('Simple', $billy));
     //Now add another super notification, but not simple.
     $notification = new Notification();
     $notification->type = 'Simple2Test';
     $notification->owner = $super;
     $this->assertTrue($notification->save());
     //And there are still 2 notifications for super
     $this->assertEquals(2, Notification::getCountByTypeAndUser('Simple', $super));
     //Add a notification for billy.
     $notification = new Notification();
     $notification->type = 'Simple';
     $notification->owner = $billy;
     $this->assertTrue($notification->save());
     //And there is still 1 unread notification for billy
     $this->assertEquals(1, Notification::getCountByTypeAndUser('Simple', $billy));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:36,代码来源:NotificationTest.php

示例11: testSendNotificationInNewComment

 /**
  * @depends testAjaxChangeStatus
  */
 public function testSendNotificationInNewComment()
 {
     $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $missions = Mission::getAll();
     $this->assertEquals(1, count($missions));
     $mission = $missions[0];
     $this->assertEquals(0, $mission->comments->count());
     EmailMessage::deleteAll();
     Notification::deleteAll();
     $messageCount = 0;
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     //Save new comment.
     $this->setGetArray(array('relatedModelId' => $mission->id, 'relatedModelClassName' => 'Mission', 'relatedModelRelationName' => 'comments', 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('Comment' => array('description' => 'a ValidComment Name')));
     $this->runControllerWithRedirectExceptionAndGetContent('comments/default/inlineCreateSave');
     $this->assertEquals(1, $mission->comments->count());
     $this->assertEquals($messageCount + 1, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $emailMessages = EmailMessage::getAll();
     $emailMessage = $emailMessages[$messageCount];
     $this->assertEquals(1, count($emailMessage->recipients));
     $this->assertContains('mission', $emailMessage->subject);
     $this->assertContains(strval($mission), $emailMessage->subject);
     $this->assertContains(strval($mission->comments[0]), $emailMessage->content->htmlContent);
     $this->assertContains(strval($mission->comments[0]), $emailMessage->content->textContent);
     $notifications = Notification::getAll();
     $notification = $notifications[$messageCount];
     $this->assertCount(1, $notifications);
     $this->assertEquals('Mission new comment', strval($notification));
     $this->assertContains(strval($mission->comments[0]), $notification->notificationMessage->htmlContent);
     $this->assertContains(strval($mission->comments[0]), $notification->notificationMessage->textContent);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:MissionsUserWalkthroughTest.php

示例12: 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(StuckJob::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() - 10000);
     $sql = "Update item set createddatetime = '" . $createdDateTime . "' where id = " . $jobInProcess->getClassId('Item');
     ZurmoRedBean::exec($sql);
     $jobInProcess->forget();
     $monitorJob->run();
     $this->assertEquals(0, count(JobInProcess::getAll()));
     //should still be 0 but the quantity should increase
     $this->assertEquals(0, count(Notification::getAll()));
     //There should now be one stuck job with quantity 1
     $stuckJobs = StuckJob::getAll();
     $this->assertEquals(1, count($stuckJobs));
     $this->assertEquals('Test', $stuckJobs[0]->type);
     $this->assertEquals(1, $stuckJobs[0]->quantity);
     //Now it should increase to 2
     $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() - 10000);
     $sql = "Update item set createddatetime = '" . $createdDateTime . "' where id = " . $jobInProcess->getClassId('Item');
     ZurmoRedBean::exec($sql);
     $jobInProcess->forget();
     $monitorJob->run();
     $this->assertEquals(0, count(JobInProcess::getAll()));
     //should still be 0 but the quantity should increase
     $this->assertEquals(0, count(Notification::getAll()));
     //There should now be one stuck job with quantity 1
     $stuckJobs = StuckJob::getAll();
     $this->assertEquals(1, count($stuckJobs));
     $this->assertEquals('Test', $stuckJobs[0]->type);
     $this->assertEquals(2, $stuckJobs[0]->quantity);
     //Set quantity to 3, then run monitor again and notification should go out.
     $stuckJobs[0]->quantity = 3;
     $this->assertTrue($stuckJobs[0]->save());
     $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() - 10000);
     $sql = "Update item set createddatetime = '" . $createdDateTime . "' where id = " . $jobInProcess->getClassId('Item');
     ZurmoRedBean::exec($sql);
     $jobInProcess->forget();
     //Now the threshold of 4 should be reached and we should send a notification
     $monitorJob->run();
     ForgetAllCacheUtil::forgetAllCaches();
     $stuckJobs = StuckJob::getAll();
     $this->assertEquals(1, count($stuckJobs));
     $this->assertEquals('Test', $stuckJobs[0]->type);
     $this->assertEquals(4, $stuckJobs[0]->quantity);
     $this->assertEquals(1, count(Notification::getAll()));
     //Confirm an email was sent
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(1, EmailMessage::getCount());
     $this->assertEquals(1, Yii::app()->emailHelper->getSentCount());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:73,代码来源:MonitorJobTest.php

示例13: clearNotificationsWorkflowsAndEmailMessages

 protected function clearNotificationsWorkflowsAndEmailMessages()
 {
     $notifications = Notification::getAll();
     foreach ($notifications as $notification) {
         $notification->delete();
     }
     $emailMessages = EmailMessage::getAll();
     foreach ($emailMessages as $emailMessage) {
         $emailMessage->delete();
     }
     $workflows = SavedWorkflow::getAll();
     foreach ($workflows as $workflow) {
         $workflow->delete();
     }
 }
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info,代码行数:15,代码来源:WorkflowValidityCheckJobTest.php

示例14: testSubmittingDuplicateNotifications

 public function testSubmittingDuplicateNotifications()
 {
     $user = $this->user;
     Notification::deleteAll();
     EmailMessage::deleteAll();
     $message = new NotificationMessage();
     $message->textContent = 'text content';
     $message->htmlContent = 'html content';
     $rules = new SimpleNotificationRules();
     $rules->setCritical(true);
     $rules->setAllowDuplicates(false);
     $rules->addUser($user);
     NotificationsUtil::submit($message, $rules);
     $this->assertEquals(1, Yii::app()->emailHelper->getSentCount());
     $this->assertCount(1, Notification::getAll());
     NotificationsUtil::submit($message, $rules);
     $this->assertEquals(1, Yii::app()->emailHelper->getSentCount());
     $this->assertCount(1, Notification::getAll());
     $rules->setAllowDuplicates(true);
     NotificationsUtil::submit($message, $rules);
     $this->assertEquals(2, Yii::app()->emailHelper->getSentCount());
     $this->assertCount(2, Notification::getAll());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:23,代码来源:NotificationsUtilTest.php

示例15: testMakeMonitorStuckJobNotification

 public function testMakeMonitorStuckJobNotification()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $super->primaryEmail->emailAddress = 'super@zurmo.com';
     $this->assertTrue($super->save());
     $notificationInitalCount = Notification::getCount();
     $emailMessageInitialCount = EmailMessage::getCount();
     JobsManagerUtil::makeMonitorStuckJobNotification();
     $notifications = Notification::getAll();
     $emailMessages = EmailMessage::getAll();
     $this->assertCount($emailMessageInitialCount + 1, $notifications);
     $this->assertCount($notificationInitalCount + 1, $emailMessages);
     $this->assertEquals('The monitor job is stuck.', $notifications[0]->notificationMessage->htmlContent);
     $this->assertEquals('The monitor job is stuck.', $notifications[0]->notificationMessage->textContent);
     $this->assertContains('The monitor job is stuck.', $emailMessages[0]->content->htmlContent);
     $this->assertContains('The monitor job is stuck.', $emailMessages[0]->content->textContent);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:JobsManagerUtilTest.php


注:本文中的Notification::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。