-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK-2438 added static liveness and tests
- Loading branch information
1 parent
296ed39
commit 77213a7
Showing
32 changed files
with
129 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
|
||
class SandboxBreakdown implements \JsonSerializable | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
|
||
class SandboxCheckReport implements \JsonSerializable | ||
{ | ||
|
||
/** | ||
* @var SandboxRecommendation | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
|
||
class SandboxDetail implements \JsonSerializable | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
|
||
class SandboxRecommendation implements \JsonSerializable | ||
{ | ||
|
||
/** | ||
* @var string|null | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
|
||
class SandboxRecommendationBuilder | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
|
||
class SandboxCheck implements \JsonSerializable | ||
{ | ||
|
||
/** | ||
* @var SandboxCheckResult | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
|
||
abstract class SandboxCheckBuilder | ||
{ | ||
|
||
/** | ||
* @var SandboxRecommendation | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
|
||
class SandboxCheckResult implements \JsonSerializable | ||
{ | ||
|
||
/** | ||
* @var SandboxCheckReport | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,4 @@ | |
|
||
class SandboxDocumentAuthenticityCheck extends SandboxDocumentCheck | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,4 @@ | |
|
||
class SandboxDocumentFaceMatchCheck extends SandboxDocumentCheck | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\DocScan\Request\Check; | ||
|
||
class SandboxStaticLivenessCheck extends SandboxLivenessCheck | ||
{ | ||
private const STATIC = 'STATIC'; | ||
|
||
/** | ||
* @param SandboxCheckResult $result | ||
*/ | ||
public function __construct(SandboxCheckResult $result) | ||
{ | ||
parent::__construct($result, self::STATIC); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/DocScan/Request/Check/SandboxStaticLivenessCheckBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\DocScan\Request\Check; | ||
|
||
class SandboxStaticLivenessCheckBuilder extends SandboxCheckBuilder | ||
{ | ||
/** | ||
* @return SandboxStaticLivenessCheck | ||
*/ | ||
public function build(): SandboxCheck | ||
{ | ||
$result = new SandboxCheckResult($this->buildReport()); | ||
return new SandboxStaticLivenessCheck($result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,4 @@ | |
|
||
class SandboxThirdPartyIdentityCheck extends SandboxDocumentCheck | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
|
||
class SandboxResponseConfig implements \JsonSerializable | ||
{ | ||
|
||
/** | ||
* @var SandboxTaskResults|null | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
|
||
class SandboxResponseConfigBuilder | ||
{ | ||
|
||
/** | ||
* @var SandboxTaskResults | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
tests/DocScan/Request/Check/SandboxStaticLivenessCheckBuilderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Test\DocScan\Request\Check; | ||
|
||
use PHPUnit\Framework\MockObject\MockObject; | ||
use Yoti\Sandbox\DocScan\Request\Check\Report\SandboxBreakdown; | ||
use Yoti\Sandbox\DocScan\Request\Check\Report\SandboxRecommendation; | ||
use Yoti\Sandbox\DocScan\Request\Check\SandboxLivenessCheck; | ||
use Yoti\Sandbox\DocScan\Request\Check\SandboxStaticLivenessCheck; | ||
use Yoti\Sandbox\DocScan\Request\Check\SandboxStaticLivenessCheckBuilder; | ||
use Yoti\Sandbox\Test\TestCase; | ||
|
||
class SandboxStaticLivenessCheckBuilderTest extends TestCase | ||
{ | ||
/** | ||
* @var MockObject|SandboxRecommendation | ||
*/ | ||
private $recommendationMock; | ||
|
||
/** | ||
* @var MockObject|SandboxBreakdown | ||
*/ | ||
private $breakdownMock; | ||
|
||
/** | ||
* @before | ||
*/ | ||
public function setUp(): void | ||
{ | ||
$this->recommendationMock = $this->createMock(SandboxRecommendation::class); | ||
$this->breakdownMock = $this->createMock(SandboxBreakdown::class); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldThrowExceptionWhenMissingRecommendation(): void | ||
{ | ||
$this->expectException(\TypeError::class); | ||
$this->expectExceptionMessage(SandboxRecommendation::class); | ||
|
||
(new SandboxStaticLivenessCheckBuilder())->build(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldBuildCorrectly(): void | ||
{ | ||
$result = (new SandboxStaticLivenessCheckBuilder()) | ||
->withRecommendation($this->recommendationMock) | ||
->withBreakdown($this->breakdownMock) | ||
->build(); | ||
|
||
$this->assertInstanceOf(SandboxStaticLivenessCheck::class, $result); | ||
$this->assertInstanceOf(SandboxLivenessCheck::class, $result); | ||
|
||
$this->assertJsonStringEqualsJsonString( | ||
json_encode([ | ||
'result' => [ | ||
'report' => [ | ||
'recommendation' => $this->recommendationMock, | ||
'breakdown' => [ | ||
$this->breakdownMock | ||
], | ||
], | ||
], | ||
'liveness_type' => 'STATIC', | ||
]), | ||
json_encode($result) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
*/ | ||
class SandboxTaskResultsTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @test | ||
* @covers ::__construct | ||
|