public function testValidateCreateReturnsFalse()
 {
     $adSet = new FacebookAdSet();
     $blob = new UnmanagedFacebookBlob();
     $blob->setStatus("blah");
     $blob->setAdSets([$adSet]);
     $blob->setAdAccountId('ad account id');
     $blob->setPageId(1234);
     $result = $this->sut->validateCreate($blob);
     $this->assertFalse($result->getResult());
     $this->assertEquals('[accessToken] NULL value found, but a string is required. ' . '[status] Does not have a value in the enumeration ["active","inactive"]. ' . '[creatives] NULL value found, but an array is required. ' . '[] Failed to match all schemas.', $result->getMessage());
 }
コード例 #2
0
 public function test_isValidUpdateBlob_UsingInvalidBlobForUpdate_ReturnsFalseAndErrorMessage()
 {
     $mockScenarioBlob = $this->getMockBuilder('PaperG\\FirehoundBlob\\ScenarioBlob')->disableOriginalConstructor()->getMock();
     $mockAdSet = $this->getMockBuilder('PaperG\\FirehoundBlob\\Facebook\\FacebookAdSet')->disableOriginalConstructor()->getMock();
     $mockCreative = $this->getMockBuilder('PaperG\\FirehoundBlob\\Facebook\\FacebookCreative')->disableOriginalConstructor()->getMock();
     $mockBudget = new Budget("invalid", "impression", "lifetime");
     $mockUnmanagedFbBlob = new UnmanagedFacebookBlob();
     $mockUnmanagedFbBlob->setAdAccountId(1123);
     $mockUnmanagedFbBlob->setPageId([1, 2, 3]);
     $mockUnmanagedFbBlob->setAccessToken(["helloworld"]);
     $mockUnmanagedFbBlob->setStatus('');
     $mockUnmanagedFbBlob->setCreatives([$mockCreative]);
     $mockUnmanagedFbBlob->setAdSets([$mockAdSet]);
     $mockUnmanagedFbBlob->setBudget($mockBudget);
     $mockScenarioBlob->expects($this->once())->method('getBlob')->will($this->returnValue($mockUnmanagedFbBlob));
     $results = $this->sut->isValidUpdateBlob($mockScenarioBlob);
     $this->assertEquals('[adAccountId] Integer value found, but a string is required. ' . '[pageId] Array value found, but a string or a number is required. ' . '[accessToken] Array value found, but a string is required. ' . '[budget.amount] String value found, but a number is required. ' . '[budget.budget_type] Does not have a value in the enumeration ["daily"]. ' . '[budget.type] Does not have a value in the enumeration ["dollar"]. ' . '[budget] Failed to match all schemas. [budget] Object value found, but a null is required. ' . '[budget] Failed to match exactly one schema. [adSets[0]] NULL value found, but an object is required. ' . '[adSets] Array value found, but a null is required. [adSets] Failed to match exactly one schema. ' . '[creatives[0]] NULL value found, but an object is required. ' . '[creatives] Array value found, but a null is required. [creatives] Failed to match exactly one schema. ' . '[status] Does not have a value in the enumeration ["active","inactive"]. ' . '[status] String value found, but a null is required. [status] Failed to match exactly one schema. ' . '[] Failed to match all schemas.', $results->getMessage());
     $this->assertEquals(false, $results->getResult());
 }