本文整理汇总了PHP中Campaign::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Campaign::getByName方法的具体用法?PHP Campaign::getByName怎么用?PHP Campaign::getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Campaign
的用法示例。
在下文中一共展示了Campaign::getByName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRunWithDueActiveCampaignsWithMembers
/**
* @depends testRunWithDueActiveCampaignsWithNonMembers
*/
public function testRunWithDueActiveCampaignsWithMembers()
{
$marketingList = MarketingListTestHelper::createMarketingListByName('marketingList 04');
$marketingListId = $marketingList->id;
$contact1 = ContactTestHelper::createContactByNameForOwner('campaignContact 01', $this->user);
$contact2 = ContactTestHelper::createContactByNameForOwner('campaignContact 02', $this->user);
$contact3 = ContactTestHelper::createContactByNameForOwner('campaignContact 03', $this->user);
$contact4 = ContactTestHelper::createContactByNameForOwner('campaignContact 04', $this->user);
$contact5 = ContactTestHelper::createContactByNameForOwner('campaignContact 05', $this->user);
$processed = 0;
MarketingListMemberTestHelper::createMarketingListMember($processed, $marketingList, $contact1);
MarketingListMemberTestHelper::createMarketingListMember($processed, $marketingList, $contact2);
MarketingListMemberTestHelper::createMarketingListMember($processed, $marketingList, $contact3);
MarketingListMemberTestHelper::createMarketingListMember($processed, $marketingList, $contact4);
MarketingListMemberTestHelper::createMarketingListMember($processed, $marketingList, $contact5);
$marketingList->forgetAll();
$marketingList = MarketingList::getById($marketingListId);
CampaignTestHelper::createCampaign('Active, Due With 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());
$campaign = Campaign::getByName('Active, Due With Members');
$this->assertEquals(Campaign::STATUS_PROCESSING, $campaign[0]->status);
$allCampaignItems = CampaignItem::getAll();
$this->assertNotEmpty($allCampaignItems);
$this->assertCount(5, $allCampaignItems);
$campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaign[0]->id);
$this->assertNotEmpty($campaignItems);
$this->assertCount(5, $campaignItems);
}
示例2: testToString
/**
* @depends testCreateAndGetCampaignListById
*/
public function testToString()
{
$campaigns = Campaign::getByName('Test Campaign Name');
$this->assertEquals(1, count($campaigns));
$this->assertEquals('Test Campaign Name', strval($campaigns[0]));
}
示例3: testRunWithJustDueActiveCampaignsWithMembers
/**
* @depends testRunWithDueActiveCampaignsWithMembers
*/
public function testRunWithJustDueActiveCampaignsWithMembers()
{
$marketingList = MarketingListTestHelper::createMarketingListByName('marketingList 05');
$marketingListId = $marketingList->id;
$processed = 0;
for ($i = 6; $i <= 10; $i++) {
$contact = ContactTestHelper::createContactByNameForOwner('campaignContact 0' . $i, $this->user);
MarketingListMemberTestHelper::createMarketingListMember($processed, $marketingList, $contact);
}
$marketingList->forgetAll();
$marketingList = MarketingList::getById($marketingListId);
$nowDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$campaign = CampaignTestHelper::createCampaign('Active, Just Due With Members', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_ACTIVE, $nowDateTime, null, $marketingList);
// we have to do this to ensure when we retrieve the data status is updated from db.
$campaign->forgetAll();
$this->assertEmpty(CampaignItem::getAll());
// sleep 1 second to ensure we are giving ample time difference between creating the campaign and calling the job
sleep(1);
$job = new CampaignGenerateDueCampaignItemsJob();
$this->assertTrue($job->run());
$campaign = Campaign::getByName('Active, just Due With Members');
$this->assertEquals(Campaign::STATUS_PROCESSING, $campaign[0]->status);
$allCampaignItems = CampaignItem::getAll();
$this->assertNotEmpty($allCampaignItems);
$this->assertCount(5, $allCampaignItems);
$campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaign[0]->id);
$this->assertNotEmpty($campaignItems);
$this->assertCount(5, $campaignItems);
}
示例4: testDrillDownDetailsAction
/**
* @depends testSuperUserCreateFromRelationAction
*/
public function testDrillDownDetailsAction()
{
$campaign = Campaign::getByName('campaign01');
$campaignItem = CampaignItemTestHelper::createCampaignItem(true, $campaign[0]);
$this->setGetArray(array('campaignItemId' => $campaignItem->id));
$content = $this->runControllerWithNoExceptionsAndGetContent('campaigns/default/drillDownDetails');
$this->assertNotNull($content);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:CampaignDefaultControllerSuperUserWalkthroughTest.php
示例5: testSuperUserCreateFromRelationAction
/**
* @depends testSuperUserDeleteAction
*/
public function testSuperUserCreateFromRelationAction()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$campaigns = Campaign::getAll();
$this->assertEquals(2, count($campaigns));
$marketingList = MarketingListTestHelper::createMarketingListByName('my list');
//Create a new campaign from a related marketing list.
$this->setGetArray(array('relationAttributeName' => 'marketingList', 'relationModelId' => $marketingList->id, 'relationModuleId' => 'marketingLists', 'redirectUrl' => 'someRedirect'));
$this->setPostArray(array('Campaign' => array('name' => 'New Campaign using Create', 'fromName' => 'Zurmo Sales', 'fromAddress' => 'sales@zurmo.com', 'sendOnDateTime' => '6/13/2013 10:54 AM', 'subject' => 'New Campaign using Create Subject', 'enableTracking' => '1', 'supportsRichText' => '0', 'textContent' => 'Text', 'htmlContent' => 'Html')));
$this->runControllerWithRedirectExceptionAndGetContent('campaigns/default/createFromRelation');
$campaigns = Campaign::getByName('New Campaign using Create');
$this->assertEquals(1, count($campaigns));
$this->assertTrue($campaigns[0]->id > 0);
$this->assertTrue($campaigns[0]->owner == $super);
$this->assertTrue($campaigns[0]->marketingList->id == $marketingList->id);
$campaigns = Campaign::getAll();
$this->assertEquals(3, count($campaigns));
}
示例6: testSuperUserEditAction
/**
* @depends testSuperUserCreateAction
*/
public function testSuperUserEditAction()
{
$campaigns = Campaign::getAll();
$this->assertEquals(3, count($campaigns));
$marketingListId = self::getModelIdByModelNameAndName('MarketingList', 'MarketingListName');
$campaignId = self::getModelIdByModelNameAndName('Campaign', 'New Campaign using Create');
$this->setGetArray(array('id' => $campaignId));
$content = $this->runControllerWithNoExceptionsAndGetContent('campaigns/default/edit');
$this->assertTrue(strpos($content, '<title>ZurmoCRM - Campaigns</title>') !== false);
$this->assertTrue(strpos($content, '<div id="CampaignsPageView" class="ZurmoDefaultPageView ' . 'ZurmoPageView PageView">') !== false);
$this->assertTrue(strpos($content, '<div id="MarketingBreadCrumbView" class="BreadCrumbView">' . '<div class="breadcrumbs">') !== false);
$this->assertTrue(strpos($content, '/marketing/default/index">Marketing</a>') !== false);
$this->assertTrue(strpos($content, '/campaigns/default/list">Campaigns</a>') !== false);
$this->assertTrue(strpos($content, '<span>New Campaign using Create</span></div></div>') !== false);
$this->assertTrue(strpos($content, '<div id="CampaignEditView" class="SecuredEditView EditView DetailsView' . ' ModelView ConfigurableMetadataView MetadataView">') !== false);
$this->assertTrue(strpos($content, '<h1><span class="truncated-title"><span class="ellipsis-content">New ' . 'Campaign using Create</span></span></h1>') !== false);
$this->assertTrue(strpos($content, '<div class="wide form">') !== false);
$this->assertTrue(strpos($content, '<div class="attributesContainer">') !== false);
$this->assertTrue(strpos($content, '<div class="left-column"><div class="panel">') !== false);
$this->assertTrue(strpos($content, '<th><label for="Campaign_name" class="required">Name <span class=' . '"required">*</span></label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><input id="Campaign_name" name="Campaign[name]" ' . 'type="text" maxlength="64" value="New Campaign using Create"') !== false);
$this->assertTrue(strpos($content, '<th><label for="Campaign_marketingList_id" class="required">Marketing ' . 'List <span class="required">*</span></label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><input name="Campaign[marketingList][id]" ' . 'id="Campaign_marketingList_id" value="' . $marketingListId . '" type="hidden"') !== false);
$this->assertTrue(strpos($content, '<a id="Campaign_marketingList_SelectLink" href="#"><span ' . 'class="model-select-icon"></span>') !== false);
$this->assertTrue(strpos($content, '<th><label for="Campaign_fromName" class="required">From Name ' . '<span class="required">*</span></label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><input id="Campaign_fromName" name="Campaign[fromName]" ' . 'type="text" maxlength="64" value="Zurmo Sales"') !== false);
$this->assertTrue(strpos($content, '<th><label for="Campaign_fromAddress" class="required">From Address ' . '<span class="required">*</span></label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><input id="Campaign_fromAddress" ' . 'name="Campaign[fromAddress]" type="text" maxlength="64" ' . 'value="sales@zurmo.com"') !== false);
$this->assertTrue(strpos($content, '<th><label for="Campaign_sendOnDateTime" class="required">Send On ' . '<span class="required">*</span></label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><div class="has-date-select"><input ' . 'id="Campaign_sendOnDateTime" name="Campaign[sendOnDateTime]" ' . 'style="position:relative;z-index:10000;" type="text" ' . 'value="6/13/13 10:54 AM"') !== false);
$this->assertTrue(strpos($content, '<th><label for="Campaign_subject" class="required">Subject ' . '<span class="required">*</span></label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><input id="Campaign_subject" name="Campaign[subject]" ' . 'type="text" maxlength="64" value="New Campaign ' . 'using Create Subject"') !== false);
$this->assertTrue(strpos($content, '<tr><th>Enable Tracking<span id="enable-tracking-tooltip" ' . 'class="tooltip" title="Check to track when recipients open ' . 'an email or click any links.">?</span></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><input id="ytCampaign_enableTracking" type="hidden" ' . 'value="0" name="Campaign[enableTracking]"') !== false);
$this->assertTrue(strpos($content, '<label class="hasCheckBox c_on"><input id="Campaign_enableTracking" ' . 'name="Campaign[enableTracking]" value="1" checked="checked" ' . 'type="checkbox"') !== false);
$this->assertTrue(strpos($content, '<th>Support HTML<span id="support-rich-text-tooltip" class="tooltip" ' . 'title="When checked, email will be sent in both text and HTML format. ' . ' Uncheck to only send text emails">?</span></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><input id="ytCampaign_supportsRichText" type="hidden" ' . 'value="0" name="Campaign[supportsRichText]"') !== false);
$this->assertTrue(strpos($content, '<label class="hasCheckBox"><input id="Campaign_supportsRichText" ' . 'name="Campaign[supportsRichText]" value="1" type="checkbox"') !== false);
$this->assertTrue(strpos($content, '<th></th><td colspan="1"><div class="hasDropDown"><span class=' . '"select-arrow"></span><select name="Campaign[contactEmailTemplate' . 'Names]" id="Campaign_contactEmailTemplateNames_value">') !== false);
$this->assertTrue(strpos($content, '<option value="">Select a template</option>') !== false);
$this->assertTrue(strpos($content, 'EmailTemplate 01</option>') !== false);
$this->assertTrue(strpos($content, 'EmailTemplate 02</option>') !== false);
$this->assertTrue(strpos($content, 'EmailTemplate 03</option>') !== false);
$this->assertTrue(strpos($content, '<th><label>Attachments</label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><div id="fileUploadCampaign"><div class="fileupload' . '-buttonbar clearfix">') !== false);
$this->assertTrue(strpos($content, '<div class="addfileinput-button"><span>Y</span>') !== false);
$this->assertTrue(strpos($content, '<strong class="add-label">Add Files</strong>') !== false);
$this->assertTrue(strpos($content, '<input id="Campaign_files" type="file" name="Campaign_files"') !== false);
$this->assertTrue(strpos($content, '<div class="fileupload-content"><table class="files">') !== false);
$this->assertTrue(strpos($content, '<div class="right-column">') !== false);
$this->assertTrue(strpos($content, '<div class="email-template-combined-content">') !== false);
$this->assertTrue(strpos($content, '<div class="email-template-content"><div class="tabs-nav">') !== false);
$this->assertTrue(strpos($content, '<a class="active-tab" href="#tab1">Text Content</a>') !== false);
$this->assertTrue(strpos($content, '<a href="#tab2">Html Content</a>') !== false);
$this->assertTrue(strpos($content, '<a id="mergetag-guide" class="simple-link" href="#">' . 'MergeTag Guide</a></div>') !== false);
$this->assertTrue(strpos($content, '<div id="tab1" class="active-tab tab email-template-' . 'textContent"><th>') !== false);
$this->assertTrue(strpos($content, '<label for="Campaign_textContent">Text Content</label></th>') !== false);
$this->assertTrue(strpos($content, '<td colspan="1"><textarea id="Campaign_textContent" ' . 'name="Campaign[textContent]" rows="6" cols="50">Text' . '</textarea></td></div>') !== false);
$this->assertTrue(strpos($content, '<div id="tab2" class=" tab email-template-htmlContent">' . '<label for="Campaign_htmlContent">Html Content</label>') !== false);
$this->assertTrue(strpos($content, '<textarea id=\'Campaign_htmlContent\' name=\'Campaign[htmlContent]\'>' . 'Html</textarea></div>') !== false);
$marketingList = MarketingListTestHelper::createMarketingListByName('MarketingListName2', 'MarketingList Description', 'second', 'second@zurmo.com');
$this->setPostArray(array('Campaign' => array('name' => 'New Campaign', 'marketingList' => array('id' => $marketingList->id), 'fromName' => 'Zurmo Support', 'fromAddress' => 'support@zurmo.com', 'sendOnDateTime' => '5/14/13 10:54 AM', 'subject' => 'New Campaign Subject', 'enableTracking' => '0', 'supportsRichText' => '1', 'textContent' => 'Text Content', 'htmlContent' => 'Html Content')));
$redirectUrl = $this->runControllerWithRedirectExceptionAndGetUrl('campaigns/default/edit');
$campaign = Campaign::getByName('New Campaign');
$this->assertEquals(1, count($campaign));
$this->assertTrue($campaign[0]->id > 0);
$this->assertEquals('support@zurmo.com', $campaign[0]->fromAddress);
$this->assertEquals('Zurmo Support', $campaign[0]->fromName);
$this->assertEquals('New Campaign Subject', $campaign[0]->subject);
$this->assertEquals('0', $campaign[0]->enableTracking);
$this->assertEquals('1', $campaign[0]->supportsRichText);
$this->assertEquals('Text Content', $campaign[0]->textContent);
$this->assertEquals('Html Content', $campaign[0]->htmlContent);
$this->assertEquals(DateTimeUtil::convertTimestampToDbFormatDateTime(strtotime('5/14/13 10:54 AM')), $campaign[0]->sendOnDateTime);
$this->assertEquals($marketingList->id, $campaign[0]->marketingList->id);
$this->assertEquals($campaign[0]->owner, $this->user);
$compareRedirectUrl = Yii::app()->createUrl('campaigns/default/details', array('id' => $campaign[0]->id));
$this->assertEquals($compareRedirectUrl, $redirectUrl);
$campaign = Campaign::getAll();
$this->assertEquals(3, count($campaign));
}