Skip to content

Commit

Permalink
Merge pull request #75 from DiogoAndreBotas/add-tests-for-download-nf…
Browse files Browse the repository at this point in the history
…c-face-endpoint

Add tests for Download NFC Face endpoint
  • Loading branch information
dvacca-onfido authored Feb 19, 2025
2 parents 07e6fc5 + 2d45e9e commit bddef8f
Show file tree
Hide file tree
Showing 3 changed files with 11,786 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/OnfidoTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ protected static function cleanUpWebhooks(): void
}
}

protected function uploadDocument(string $applicantId): Onfido\Model\Document
protected function uploadDocument(string $applicantId, string $filePath = 'test/media/sample_driving_licence.png'): Onfido\Model\Document
{
return self::$onfido->uploadDocument(
Onfido\Model\DocumentTypes::PASSPORT,
$applicantId,
new \SplFileObject('test/media/sample_driving_licence.png')
new \SplFileObject($filePath)
);
}

Expand Down
16 changes: 16 additions & 0 deletions test/Resource/DocumentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,21 @@ public function testDownloadInexistentDocument(): void
$this->expectException(Onfido\ApiException::class);
self::$onfido->downloadDocument($inexistentDocumentId);
}

public function testDownloadNfcFace(): void
{
$nfcFace = $this->uploadDocument($this->applicantId, 'test/media/nfc_data.json');
$file = self::$onfido->downloadDocument($nfcFace->getId());

$this->assertGreaterThan(0, $file->getSize());
}

public function testDownloadNfcFaceNotFound(): void
{
$inexistentDocumentId = '00000000-0000-0000-0000-000000000000';

$this->expectException(Onfido\ApiException::class);
self::$onfido->downloadNfcFace($inexistentDocumentId);
}
}
?>
Loading

0 comments on commit bddef8f

Please sign in to comment.