コード例 #1
0
 public function testToFromArray()
 {
     $mockCityAction = "city action";
     $this->sut->setCityAction($mockCityAction);
     $array = $this->sut->toArray();
     $new = new FacebookGeographicTargeting($array);
     $this->assertEquals($this->sut, $new);
     $this->assertEquals($mockCityAction, $new->getCityAction());
 }
 public function testValidateUpdateBadBudget()
 {
     $mockAdAccountId = 'mock ad account id';
     $mockPageId = 'mock page id';
     $mockAccessToken = 'mock access token';
     $geo = new FacebookGeographicTargeting();
     $geo->setCityAction('include');
     $geo->setCityIds([12, 32]);
     $blob = new UnmanagedFacebookBlob();
     $blob->setGeographicTargeting($geo);
     $blob->setAdAccountId($mockAdAccountId);
     $blob->setPageId($mockPageId);
     $blob->setAccessToken($mockAccessToken);
     $blob->setStatus("active");
     $budget = new Budget(1, "invalid");
     $blob->setBudget($budget);
     $result = $this->sut->validateUpdate($blob);
     $this->assertFalse($result->getResult());
     $expected = "[budget.type] Does not have a value in the enumeration [\"impression\",\"dollar\"]. " . "[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. [] Failed to match all schemas.";
     $this->assertEquals($expected, $result->getMessage());
 }