public function testInitialState() { $Status = new Status(); $this->assertEmpty($Status->getCanonicalId()); $this->assertEmpty($Status->getError()); $this->assertEmpty($Status->getMessageId()); $this->assertFalse($Status->hasCanonicalId()); $this->assertFalse($Status->mustRemove()); $this->assertFalse($Status->canRetry()); }
/** * Create response object by JSON data * @param string $string JSON response data * @return Response self */ private static function createJsonResponse($string) { $Data = json_decode($string); $Response = new self(); $Response->canonicalIdsCount = (int) $Data->canonical_ids; $Response->failureCount = (int) $Data->failure; $Response->multicastId = (string) $Data->multicast_id; $Response->successCount = (int) $Data->success; foreach ($Data->results as $Result) { $Status = new Status(); if (isset($Result->message_id)) { $Status->setMessageId($Result->message_id); } if (isset($Result->registration_id)) { $Status->setCanonicalId($Result->registration_id); } if (isset($Result->error)) { $Status->setError($Result->error); } $Response->results[] = $Status; } return $Response; }