Skip to content

Commit

Permalink
Merge pull request #72 from onfido/test/fix-evidence-folder-test
Browse files Browse the repository at this point in the history
test: wait for evidence folder to be available
  • Loading branch information
sofia-gomes-onfido authored Jan 20, 2025
2 parents 2b7a327 + b42cdae commit d2fd834
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/OnfidoTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected function repeatRequestUntilStatusChanges(
callable $function,
array $params,
string $status,
$maxRetries = 10,
$maxRetries = 15,
$sleepTime = 1
)
{
Expand All @@ -199,7 +199,7 @@ protected function repeatRequestUntilStatusChanges(
protected function repeatRequestUntilTaskOutputChanges(
callable $function,
array $params,
$maxRetries = 10,
$maxRetries = 15,
$sleepTime = 1
)
{
Expand All @@ -222,7 +222,7 @@ protected function repeatRequestUntilTaskOutputChanges(
protected function repeatRequestUntilHttpCodeChanges(
callable $function,
array $params,
$maxRetries = 10,
$maxRetries = 15,
$sleepTime = 1
)
{
Expand Down
11 changes: 10 additions & 1 deletion test/Resource/ReportsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,21 @@ public function testListReports(): void

public function testFindReport(): void
{
$findReportFn = function($reportId) {
return self::$onfido->findReport($reportId);
};

$getDocumentReport = $this->repeatRequestUntilStatusChanges(
$findReportFn,
[$this->documentReportId],
ReportStatus::COMPLETE
);
$getDocumentReport = self::$onfido->findReport($this->documentReportId);
$getIdentityReport = self::$onfido->findReport($this->identityReportId);

$this->assertSame($this->documentReportId, $getDocumentReport->getId());
$this->assertSame(ReportName::DOCUMENT, $getDocumentReport->getName());
$this->assertSame(ReportStatus::AWAITING_DATA, $getDocumentReport->getStatus());
$this->assertSame(ReportStatus::COMPLETE, $getDocumentReport->getStatus());

$this->assertSame($this->identityReportId, $getIdentityReport->getId());
$this->assertSame(ReportName::IDENTITY_ENHANCED, $getIdentityReport->getName());
Expand Down
9 changes: 8 additions & 1 deletion test/Resource/WorkflowRunsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ public function testDownloadEvidenceFolder(): void
WorkflowRunStatus::APPROVED
)->getOutput();

$file = self::$onfido->downloadEvidenceFolder($workflowRunId);
$getEvidenceFolderFn = function($workflowRunId) {
return self::$onfido->downloadEvidenceFolder($workflowRunId);
};

$file = $this->repeatRequestUntilHttpCodeChanges(
$getEvidenceFolderFn,
[$workflowRunId]
);

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

0 comments on commit d2fd834

Please sign in to comment.