コード例 #1
0
 public function setup()
 {
     parent::setup();
     $targeting = new TargetingSpecs();
     $targeting->{TargetingSpecsFields::GEO_LOCATIONS} = array('countries' => array('US'));
     $this->adCampaign = new AdCampaign(null, $this->getActId());
     $this->adCampaign->{AdCampaignFields::NAME} = $this->getTestRunId();
     $this->adCampaign->create();
     $this->adSet = new AdSet(null, $this->getActId());
     $this->adSet->{AdSetFields::CAMPAIGN_GROUP_ID} = (int) $this->adCampaign->{AdSetFields::ID};
     $this->adSet->{AdSetFields::NAME} = $this->getTestRunId();
     $this->adSet->{AdSetFields::CAMPAIGN_STATUS} = AdSet::STATUS_PAUSED;
     $this->adSet->{AdSetFields::DAILY_BUDGET} = '150';
     $this->adSet->{AdSetFields::START_TIME} = (new \DateTime("+1 week"))->format(\DateTime::ISO8601);
     $this->adSet->{AdSetFields::END_TIME} = (new \DateTime("+2 week"))->format(\DateTime::ISO8601);
     $this->adSet->{AdSetFields::TARGETING} = $targeting;
     $this->adSet->{AdSetFields::BID_TYPE} = BidTypes::BID_TYPE_CPM;
     $this->adSet->{AdSetFields::BID_INFO} = array(BidInfoFields::IMPRESSIONS => 2);
     $this->adSet->save();
     $this->adImage = new AdImage(null, $this->getActId());
     $this->adImage->{AdImageFields::FILENAME} = $this->getTestImagePath();
     $this->adImage->save();
     $this->adCreative = new AdCreative(null, $this->getActId());
     $this->adCreative->{AdCreativeFields::TITLE} = 'My Test Ad';
     $this->adCreative->{AdCreativeFields::BODY} = 'My Test Ad Body';
     $this->adCreative->{AdCreativeFields::OBJECT_ID} = $this->getPageId();
     $this->adCreative->create();
 }
コード例 #2
0
ファイル: AdTest.php プロジェクト: vitalsaude/api
 public function setup()
 {
     parent::setup();
     $targeting = new TargetingSpecs();
     $targeting->{TargetingSpecsFields::GEO_LOCATIONS} = array('countries' => array('US'));
     $this->campaign = new Campaign(null, $this->getConfig()->accountId);
     $this->campaign->{CampaignFields::NAME} = $this->getConfig()->testRunId;
     $this->campaign->create();
     $this->adSet = new AdSet(null, $this->getConfig()->accountId);
     $this->adSet->{AdSetFields::CAMPAIGN_ID} = (int) $this->campaign->{AdSetFields::ID};
     $this->adSet->{AdSetFields::NAME} = $this->getConfig()->testRunId;
     $this->adSet->{AdSetFields::DAILY_BUDGET} = '150';
     $this->adSet->{AdSetFields::START_TIME} = (new \DateTime("+1 week"))->format(\DateTime::ISO8601);
     $this->adSet->{AdSetFields::END_TIME} = (new \DateTime("+2 week"))->format(\DateTime::ISO8601);
     $this->adSet->{AdSetFields::TARGETING} = $targeting;
     $this->adSet->{AdSetFields::OPTIMIZATION_GOAL} = OptimizationGoals::REACH;
     $this->adSet->{AdSetFields::BILLING_EVENT} = BillingEvents::IMPRESSIONS;
     $this->adSet->{AdSetFields::BID_AMOUNT} = 2;
     $this->adSet->save(array(AdSet::STATUS_PARAM_NAME => AdSet::STATUS_PAUSED));
     $this->adImage = new AdImage(null, $this->getConfig()->accountId);
     $this->adImage->{AdImageFields::FILENAME} = $this->getConfig()->testImagePath;
     $this->adImage->save();
     $link = new LinkData();
     $link->{LinkDataFields::MESSAGE} = 'Message';
     $link->{LinkDataFields::IMAGE_HASH} = $this->adImage->{AdImageFields::HASH};
     $link->{LinkDataFields::LINK} = $this->getConfig()->appUrl;
     $story = new ObjectStorySpec();
     $story->{ObjectStorySpecFields::PAGE_ID} = $this->getConfig()->pageId;
     $story->{ObjectStorySpecFields::LINK_DATA} = $link;
     $this->adCreative = new AdCreative(null, $this->getConfig()->accountId);
     $this->adCreative->{AdCreativeFields::OBJECT_STORY_SPEC} = $story;
     $this->adCreative->create();
 }
コード例 #3
0
 public function setup()
 {
     parent::setup();
     $this->adCampaign = new AdCampaign(null, $this->getActId());
     $this->adCampaign->{AdCampaignFields::NAME} = $this->getTestRunId();
     $this->adCampaign->create();
     $this->adSet = new AdSet(null, $this->getActId());
     $this->adSet->{AdSetFields::CAMPAIGN_GROUP_ID} = (int) $this->adCampaign->{AdSetFields::ID};
     $this->adSet->{AdSetFields::NAME} = $this->getTestRunId();
     $this->adSet->{AdSetFields::CAMPAIGN_STATUS} = AdSet::STATUS_PAUSED;
     $this->adSet->{AdSetFields::DAILY_BUDGET} = '150';
     $this->adSet->{AdSetFields::START_TIME} = (new \DateTime("+1 week"))->format(\DateTime::ISO8601);
     $this->adSet->{AdSetFields::END_TIME} = (new \DateTime("+2 week"))->format(\DateTime::ISO8601);
     $this->adSet->save();
     $this->adImage = new AdImage(null, $this->getActId());
     $this->adImage->{AdImageFields::FILENAME} = $this->getTestImagePath();
     $this->adImage->save();
     $this->adCreative = new AdCreative(null, $this->getActId());
     $this->adCreative->{AdCreativeFields::TITLE} = 'My Test Ad';
     $this->adCreative->{AdCreativeFields::BODY} = 'My Test Ad Body';
     $this->adCreative->{AdCreativeFields::OBJECT_ID} = $this->getPageId();
     $this->adCreative->create();
 }