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


PHP Campaign::deleteAll方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $this->user = User::getByUsername('super');
     Yii::app()->user->userModel = $this->user;
     Campaign::deleteAll();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:CampaignItemsUtilTest.php

示例2: testMarkProcessedCampaignsAsCompletedWithCustomPageSize

 /**
  * @depends testMarkProcessedCampaignsAsCompleted
  */
 public function testMarkProcessedCampaignsAsCompletedWithCustomPageSize()
 {
     Campaign::deleteAll();
     $contact = ContactTestHelper::createContactByNameForOwner('contact 02', $this->user);
     $marketingList = MarketingListTestHelper::populateMarketingListByName('marketingList 02');
     $campaign01 = CampaignTestHelper::createCampaign('campaign 01', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, null, $marketingList);
     $this->assertNotNull($campaign01);
     $campaign01Id = $campaign01->id;
     CampaignItemTestHelper::createCampaignItem(1, $campaign01, $contact);
     $campaign02 = CampaignTestHelper::createCampaign('campaign 02', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, null, $marketingList);
     $this->assertNotNull($campaign02);
     $campaign02Id = $campaign02->id;
     CampaignItemTestHelper::createCampaignItem(1, $campaign02, $contact);
     $campaign03 = CampaignTestHelper::createCampaign('campaign 03', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, null, $marketingList);
     $this->assertNotNull($campaign03);
     $campaign03Id = $campaign03->id;
     $campaign01->forgetAll();
     $campaign02->forgetAll();
     $campaign03->forgetAll();
     Yii::app()->jobQueue->deleteAll();
     $jobs = Yii::app()->jobQueue->getAll();
     $this->assertCount(0, $jobs);
     $this->assertTrue(CampaignsUtil::markProcessedCampaignsAsCompleted(1));
     $jobs = Yii::app()->jobQueue->getAll();
     $this->assertCount(1, $jobs);
     $this->assertEquals('CampaignMarkCompleted', $jobs[5][0]['jobType']);
     $campaign01 = Campaign::getById($campaign01Id);
     $this->assertNotNull($campaign01);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign01->status);
     $campaign02 = Campaign::getById($campaign02Id);
     $this->assertNotNull($campaign02);
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign02->status);
     $campaign03 = Campaign::getById($campaign03Id);
     $this->assertNotNull($campaign03);
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign03->status);
     $campaign01->forgetAll();
     $campaign02->forgetAll();
     $campaign03->forgetAll();
     Yii::app()->jobQueue->deleteAll();
     $jobs = Yii::app()->jobQueue->getAll();
     $this->assertCount(0, $jobs);
     $this->assertTrue(CampaignsUtil::markProcessedCampaignsAsCompleted());
     $jobs = Yii::app()->jobQueue->getAll();
     $this->assertCount(0, $jobs);
     $campaign01 = Campaign::getById($campaign01Id);
     $this->assertNotNull($campaign01);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign01->status);
     $campaign02 = Campaign::getById($campaign02Id);
     $this->assertNotNull($campaign02);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign02->status);
     $campaign03 = Campaign::getById($campaign03Id);
     $this->assertNotNull($campaign03);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign03->status);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:57,代码来源:CampaignsUtilTest.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $this->user = User::getByUsername('super');
     Yii::app()->user->userModel = $this->user;
     Campaign::deleteAll();
     CampaignItem::deleteAll();
     Contact::deleteAll();
     MarketingList::deleteAll();
     MarketingListMember::deleteAll();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:CampaignGenerateDueCampaignItemsJobBenchmarkTest.php

示例4: testRunWithCampaignPausedAfterAllItemsGeneratedAndThenUnpaused

 public function testRunWithCampaignPausedAfterAllItemsGeneratedAndThenUnpaused()
 {
     // Cleanup
     Campaign::deleteAll();
     $this->assertEquals(0, Campaign::getCount());
     $this->assertEquals(0, CampaignItem::getCount());
     $this->assertEquals(0, CampaignItemActivity::getCount());
     MarketingList::deleteAll();
     $this->assertEquals(0, MarketingList::getCount());
     $this->assertEquals(0, MarketingListMember::getCount());
     EmailMessage::deleteAll();
     $this->assertEquals(0, EmailMessage::getCount());
     $this->assertEquals(0, EmailMessageContent::getCount());
     $this->assertEquals(0, EmailMessageSender::getCount());
     $this->assertEquals(0, EmailMessageRecipient::getCount());
     Contact::deleteAll();
     $this->assertEquals(0, Contact::getCount());
     // setup an email address for contacts
     $email = new Email();
     $email->emailAddress = 'demo@zurmo.com';
     // create a marketing list with 5 members
     $marketingList = MarketingListTestHelper::createMarketingListByName('marketingList 05');
     $marketingListId = $marketingList->id;
     for ($i = 1; $i <= 5; $i++) {
         $contact = ContactTestHelper::createContactByNameForOwner('campaignContact 0' . $i, $this->user);
         $contact->primaryEmail = $email;
         $this->assertTrue($contact->save());
         MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList, $contact);
     }
     $marketingList->forgetAll();
     // create a due campaign with that marketing list
     $campaign = CampaignTestHelper::createCampaign('campaign 04', 'subject', 'text Content', 'Html Content', null, null, null, null, null, null, MarketingList::getById($marketingListId));
     $campaignId = $campaign->id;
     /*
      * Run 1:
      * CampaignGenerateDueCampaignItemsJob
      * status == processing
      * items generated but unprocessed
      *
      * CampaignQueueMessagesInOutboxJob
      * status == processing
      * items processed with email messages generated and queued
      *
      * ProcessOutboundEmailJob
      * status == processing
      * email items attempted to be sent
      *
      * Run 2:
      * Pause the campaign
      * items are processed and still present
      *
      * Unpause the campaign
      * status == active
      * items are processed and still present
      *
      * CampaignGenerateDueCampaignItemsJob
      * status == processing
      * ensure all items are present and processed
      *
      * CampaignQueueMessagesInOutboxJob
      * status == processing
      * ensure all items are present and processed
      * ensure all email messages are present with correct folder type
      *
      * ProcessOutboundEmailJob
      * ensure all email messages are present with correct folder type
      * status == processing
      *
      *
      * Run 3:
      * Mark Campaign as Completed
      * status == completed
      */
     // we have to do this to ensure when we retrieve the data status is updated from db.
     $campaign->forgetAll();
     $this->assertEmpty(CampaignItem::getAll());
     // Run 1 starts here
     // Run CampaignGenerateDueCampaignItemsJob
     $job = new CampaignGenerateDueCampaignItemsJob();
     $this->assertTrue($job->run());
     $campaign = Campaign::getById($campaignId);
     // ensure status is processing
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
     // ensure 5 campaign items have been generated
     $this->assertEquals(5, CampaignItem::getCount());
     // ensure all 5 campaign items are unprocessed
     $campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaignId);
     $this->assertNotEmpty($campaignItems);
     $this->assertCount(5, $campaignItems);
     // Run CampaignQueueMessagesInOutboxJob
     $job = new CampaignQueueMessagesInOutboxJob();
     $this->assertTrue($job->run());
     // Ensure campaign status
     $campaign = Campaign::getById($campaignId);
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
     // ensure all 5 campaign items are processed
     $campaignItems = CampaignItem::getByProcessedAndCampaignId(1, $campaignId);
     $this->assertNotEmpty($campaignItems);
     $this->assertCount(5, $campaignItems);
     // Ensure 5 new email messages
//.........这里部分代码省略.........
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:101,代码来源:CampaignMarkCompletedJobTest.php

示例5: testRunWithCustomBatchSize

 /**
  * @depends testRunWithCampaignWithProcessingStatusAndProcessedItems
  */
 public function testRunWithCustomBatchSize()
 {
     Campaign::deleteAll();
     $contact = ContactTestHelper::createContactByNameForOwner('contact 03', $this->user);
     $marketingList = MarketingListTestHelper::populateMarketingListByName('marketingList 04');
     $campaign01 = CampaignTestHelper::createCampaign('campaign 01', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, null, $marketingList);
     $this->assertNotNull($campaign01);
     $campaign01Id = $campaign01->id;
     CampaignItemTestHelper::createCampaignItem(1, $campaign01, $contact);
     $campaign02 = CampaignTestHelper::createCampaign('campaign 02', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, null, $marketingList);
     $this->assertNotNull($campaign02);
     $campaign02Id = $campaign02->id;
     CampaignItemTestHelper::createCampaignItem(1, $campaign02, $contact);
     $campaign03 = CampaignTestHelper::createCampaign('campaign 03', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, null, $marketingList);
     $this->assertNotNull($campaign03);
     $campaign03Id = $campaign03->id;
     $campaign01->forgetAll();
     $campaign02->forgetAll();
     $campaign03->forgetAll();
     $job = new CampaignMarkCompletedJob();
     AutoresponderOrCampaignBatchSizeConfigUtil::setBatchSize(1);
     $this->assertTrue($job->run());
     $campaign01 = Campaign::getById($campaign01Id);
     $this->assertNotNull($campaign01);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign01->status);
     $campaign02 = Campaign::getById($campaign02Id);
     $this->assertNotNull($campaign02);
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign02->status);
     $campaign03 = Campaign::getById($campaign03Id);
     $this->assertNotNull($campaign03);
     $this->assertEquals(Campaign::STATUS_PROCESSING, $campaign03->status);
     $campaign01->forgetAll();
     $campaign02->forgetAll();
     $campaign03->forgetAll();
     AutoresponderOrCampaignBatchSizeConfigUtil::setBatchSize(null);
     $this->assertTrue($job->run());
     $campaign01 = Campaign::getById($campaign01Id);
     $this->assertNotNull($campaign01);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign01->status);
     $campaign02 = Campaign::getById($campaign02Id);
     $this->assertNotNull($campaign02);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign02->status);
     $campaign03 = Campaign::getById($campaign03Id);
     $this->assertNotNull($campaign03);
     $this->assertEquals(Campaign::STATUS_COMPLETED, $campaign03->status);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:49,代码来源:CampaignMarkCompletedJobTest.php


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