|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Yoti\Test\DocScan\Session\Retrieve; |
| 4 | + |
| 5 | +use Yoti\DocScan\Session\Retrieve\IdentityProfile\FailureReasonResponse; |
| 6 | +use Yoti\DocScan\Session\Retrieve\IdentityProfileResponse; |
| 7 | +use Yoti\Test\TestCase; |
| 8 | + |
| 9 | +/** |
| 10 | + * @coversDefaultClass \Yoti\DocScan\Session\Retrieve\IdentityProfileResponse |
| 11 | + */ |
| 12 | +class IdentityProfileResponseTest extends TestCase |
| 13 | +{ |
| 14 | + private const RESULT = 'DONE'; |
| 15 | + private const SUBJECT_ID = 'someStringHere'; |
| 16 | + private const REASON_CODE = 'MANDATORY_DOCUMENT_COULD_NOT_BE_PROVIDED'; |
| 17 | + private const IDENTITY_PROFILE_REPORT = [ |
| 18 | + 'trust_framework' => 'UK_TFIDA', |
| 19 | + 'schemes_compliance' => [ |
| 20 | + 0 => [ |
| 21 | + 'scheme' => [ |
| 22 | + 'type' => 'DBS', |
| 23 | + 'objective' => 'STANDARD', |
| 24 | + ], |
| 25 | + 'requirements_met' => true, |
| 26 | + 'requirements_not_met_info' => 'some string here', |
| 27 | + ], |
| 28 | + ], |
| 29 | + 'media' => [ |
| 30 | + ], |
| 31 | + ]; |
| 32 | + |
| 33 | + /** |
| 34 | + * @test |
| 35 | + * @covers ::__construct |
| 36 | + * @covers ::getIdentityProfileReport |
| 37 | + * @covers ::getFailureReason |
| 38 | + * @covers ::getResult |
| 39 | + * @covers ::getSubjectId |
| 40 | + * @covers \Yoti\DocScan\Session\Retrieve\IdentityProfile\FailureReasonResponse::getStringCode |
| 41 | + * @covers \Yoti\DocScan\Session\Retrieve\IdentityProfile\FailureReasonResponse::__construct |
| 42 | + */ |
| 43 | + public function shouldCreatedCorrectly(): void |
| 44 | + { |
| 45 | + $testData = [ |
| 46 | + 'subject_id' => self::SUBJECT_ID, |
| 47 | + 'result' => self::RESULT, |
| 48 | + 'failure_reason' => [ |
| 49 | + 'reason_code' => self::REASON_CODE, |
| 50 | + ], |
| 51 | + 'identity_profile_report' => self::IDENTITY_PROFILE_REPORT, |
| 52 | + ]; |
| 53 | + |
| 54 | + $result = new IdentityProfileResponse($testData); |
| 55 | + |
| 56 | + $this->assertEquals(self::RESULT, $result->getResult()); |
| 57 | + $this->assertEquals(self::SUBJECT_ID, $result->getSubjectId()); |
| 58 | + $this->assertEquals((object)self::IDENTITY_PROFILE_REPORT, $result->getIdentityProfileReport()); |
| 59 | + |
| 60 | + $this->assertInstanceOf(FailureReasonResponse::class, $result->getFailureReason()); |
| 61 | + $this->assertEquals(self::REASON_CODE, $result->getFailureReason()->getStringCode()); |
| 62 | + } |
| 63 | +} |
0 commit comments