diff --git a/php/src/vaas/Message/VaasVerdict.php b/php/src/vaas/Message/VaasVerdict.php index d2b22873..32a54f0a 100644 --- a/php/src/vaas/Message/VaasVerdict.php +++ b/php/src/vaas/Message/VaasVerdict.php @@ -9,13 +9,15 @@ public function __construct(VerdictResponse $verdictResponse) $this->Sha256 = $verdictResponse->sha256 ?? ""; $this->Verdict = $verdictResponse->verdict ?? Verdict::UNKNOWN; $this->Guid = $verdictResponse->guid ?? ""; - $this->LibMagic = $verdictResponse->lib_magic ?? null; - $this->Detections = $verdictResponse->detections ?? null; + $this->MimeType = $verdictResponse->mime_type ?? null; + $this->FileType = $verdictResponse->file_type ?? null; + $this->Detection = $verdictResponse->detection ?? null; } public string $Sha256; public Verdict $Verdict; public string $Guid; - public ?LibMagic $LibMagic; - public ?array $Detections; + public ?string $FileType; + public ?string $MimeType; + public ?string $Detection; } diff --git a/php/src/vaas/Message/VerdictResponse.php b/php/src/vaas/Message/VerdictResponse.php index 79c5db54..f6c603d2 100644 --- a/php/src/vaas/Message/VerdictResponse.php +++ b/php/src/vaas/Message/VerdictResponse.php @@ -9,6 +9,7 @@ class VerdictResponse extends BaseMessage public string $guid; public string $sha256; public ?string $upload_token; - public ?LibMagic $lib_magic; - public ?array $detections; + public ?string $file_type; + public ?string $mime_type; + public ?string $detection; } diff --git a/php/tests/vaas/VaasTest.php b/php/tests/vaas/VaasTest.php index 1cb7fa41..da766c3e 100644 --- a/php/tests/vaas/VaasTest.php +++ b/php/tests/vaas/VaasTest.php @@ -176,19 +176,19 @@ public function testForSha256CleanSha256_GetsCleanResponse(): void $this->assertEqualsIgnoringCase($cleanSha256, $verdict->Sha256); } - // public function testForSha256AmtsoPupSample_GetsPupResponse(): void - // { - // $uuid = $this->getUuid(); - // $pupSha256 = "d6f6c6b9fde37694e12b12009ad11ab9ec8dd0f193e7319c523933bdad8a50ad"; - // $vaas = $this->_getVaas(); - // $vaas->Connect($this->getClientCredentialsGrantAuthenticator()->getToken()); + public function testForSha256AmtsoPupSample_GetsPupResponse(): void + { + $uuid = $this->getUuid(); + $pupSha256 = "d6f6c6b9fde37694e12b12009ad11ab9ec8dd0f193e7319c523933bdad8a50ad"; + $vaas = $this->_getVaas(); + $vaas->Connect($this->getClientCredentialsGrantAuthenticator()->getToken()); - // $verdict = $vaas->ForSha256($pupSha256, $uuid); + $verdict = $vaas->ForSha256($pupSha256, $uuid); - // $this->assertEquals(Verdict::PUP, $verdict->Verdict); - // $this->assertEquals($uuid, $verdict->Guid); - // $this->assertEqualsIgnoringCase($pupSha256, $verdict->Sha256); - // } + $this->assertEquals(Verdict::PUP, $verdict->Verdict); + $this->assertEquals($uuid, $verdict->Guid); + $this->assertEqualsIgnoringCase($pupSha256, $verdict->Sha256); + } public function testForMultipleHashes_GetsResponse(): void { @@ -579,7 +579,7 @@ public function testForStream_WithEicarUrlContentAsStream_ReturnsMaliciousWithDe $verdict = $vaas->ForStream($stream); $this->assertEquals(Verdict::MALICIOUS, $verdict->Verdict); - $this->assertEquals("text/plain", $verdict->LibMagic->mime_type); - $this->assertContains("EICAR-Test-File", array_column($verdict->Detections, "virus")); + $this->assertEquals("text/plain", $verdict->MimeType); + $this->assertNotEmpty($verdict->Detection); } }