本文整理汇总了PHP中MarketingListTestHelper::populateMarketingListByName方法的典型用法代码示例。如果您正苦于以下问题:PHP MarketingListTestHelper::populateMarketingListByName方法的具体用法?PHP MarketingListTestHelper::populateMarketingListByName怎么用?PHP MarketingListTestHelper::populateMarketingListByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarketingListTestHelper
的用法示例。
在下文中一共展示了MarketingListTestHelper::populateMarketingListByName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProcessDueAutoresponderItemThrowsExceptionWhenContentHasInvalidMergeTags
/**
* @depends testProcessDueAutoresponderItemThrowsExceptionWhenNoContactIsAvailable
* @expectedException NotSupportedException
* @expectedExceptionMessage Provided content contains few invalid merge tags
*/
public function testProcessDueAutoresponderItemThrowsExceptionWhenContentHasInvalidMergeTags()
{
$contact = ContactTestHelper::createContactByNameForOwner('contact 01', $this->user);
$marketingList = MarketingListTestHelper::populateMarketingListByName('marketingList 01');
$autoresponder = AutoresponderTestHelper::createAutoresponder('subject 01', '[[TEXT^CONTENT]]', '[[HTML^CONTENT]]', 1, Autoresponder::OPERATION_SUBSCRIBE, true, $marketingList, false);
$processed = 0;
$processDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$autoresponderItem = AutoresponderItemTestHelper::createAutoresponderItem($processed, $processDateTime, $autoresponder, $contact);
$this->processDueItem($autoresponderItem);
}
示例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);
}
示例3: 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);
}
示例4: testProcessDueCampaignItemThrowsExceptionWhenContentHasInvalidMergeTags
/**
* @depends testProcessDueCampaignItemThrowsExceptionWhenNoContactIsAvailable
* @expectedException NotSupportedException
* @expectedExceptionMessage Provided content contains few invalid merge tags
*/
public function testProcessDueCampaignItemThrowsExceptionWhenContentHasInvalidMergeTags()
{
$contact = ContactTestHelper::createContactByNameForOwner('contact 01', $this->user);
$marketingList = MarketingListTestHelper::populateMarketingListByName('marketingList 01');
$campaign = CampaignTestHelper::createCampaign('campaign 01', 'subject 01', '[[TEXT^CONTENT]]', '[[HTML^CONTENT]]', null, null, null, null, null, null, $marketingList, false);
$processed = 0;
$campaignItem = CampaignItemTestHelper::createCampaignItem($processed, $campaign, $contact);
CampaignItemsUtil::processDueItem($campaignItem);
}
示例5: testRunWithDueActiveCampaignsWithNonMembers
/**
* @depends testRunWithNonDueActiveCampaigns
*/
public function testRunWithDueActiveCampaignsWithNonMembers()
{
$marketingList = MarketingListTestHelper::populateMarketingListByName('marketingList 03');
CampaignTestHelper::createCampaign('Active, Due But No Members', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_ACTIVE, null, null, $marketingList);
$this->assertEmpty(CampaignItem::getAll());
$job = new CampaignGenerateDueCampaignItemsJob();
$this->assertTrue($job->run());
$this->assertEmpty(CampaignItem::getAll());
}