public function testToFromArray() { $mockMediaUrl = "mockMediaUrl"; $mockCall = "mock call"; $mockMessage = "mockMesage"; $mockCaption = "mock caption"; $mockLandingPage = "langing"; $mockName = "name"; $mockDescription = "mockDesc"; $mockVariationId = "mock var uuid"; $this->sut->setMediaUrl($mockMediaUrl); $this->sut->setCallToAction($mockCall); $this->sut->setMessage($mockMessage); $this->sut->setCaption($mockCaption); $this->sut->setLandingPage($mockLandingPage); $this->sut->setName($mockName); $this->sut->setDescription($mockDescription); $this->sut->setVariationId($mockVariationId); $arr = $this->sut->toArray(); $new = new FacebookCreativeData($arr); $this->assertEquals($this->sut, $new); }
public function testValidateCreate() { $adSet = new FacebookAdSet(); $creative = new FacebookCreative(); $creativeData = new FacebookCreativeData(); $creativeData->setMediaUrl("blah"); $creativeData->setName('name'); $creative->setPrimary($creativeData); $creative->setType('link'); $blob = new UnmanagedFacebookBlob(); $blob->setStatus("active"); $blob->setAdSets([$adSet]); $blob->setCreatives([$creative]); $blob->setAdAccountId('ad account id'); $blob->setPageId(1234); $blob->setAccessToken('access token'); $result = $this->sut->validateCreate($blob); $this->assertEmpty($result->getMessage()); $this->assertTrue($result->getResult()); }
public function test_isValidCreateBlob_UsingAValidBlobForCreate_WithIntPage_ReturnsTrue() { $mockScenarioBlob = $this->getMockBuilder('PaperG\\FirehoundBlob\\ScenarioBlob')->disableOriginalConstructor()->getMock(); $mockUnmanagedFbBlob = new UnmanagedFacebookBlob(); $mockAdSet = new FacebookAdSet(); $mockCreative = new FacebookCreative(); $mockCreativeData = new FacebookCreativeData(); $mockCreativeData->setMediaUrl("media url"); $mockCreativeData->setName('mock name'); $mockCreative->setType('link'); $mockCreative->setPrimary($mockCreativeData); $mockBudget = new Budget(1, 'dollar', 'daily'); $mockUnmanagedFbBlob->setAdAccountId('123-abc'); $mockUnmanagedFbBlob->setPageId('123-abc'); $mockUnmanagedFbBlob->setAccessToken('123-abc'); $mockUnmanagedFbBlob->setStatus('active'); $mockUnmanagedFbBlob->setCreatives([$mockCreative]); $mockUnmanagedFbBlob->setAdSets([$mockAdSet]); $mockUnmanagedFbBlob->setBudget($mockBudget); $mockScenarioBlob->expects($this->once())->method('getBlob')->will($this->returnValue($mockUnmanagedFbBlob)); $results = $this->sut->isValidCreateBlob($mockScenarioBlob); $this->assertEquals(true, $results->getResult()); }