Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"permissions": {
"allow": [
"Bash(git rev-list *)",
"Bash(./vendor/bin/phpunit --filter 'SdkConfigBuilderTest|SessionConfigurationResponseTest')",
"Bash(git config *)"
]
}
}
Comment on lines +1 to +9
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a settings.local.json file that appears to be a machine-/developer-local Claude CLI permissions config (including allowed Bash commands). Committing a *.local.* file can unintentionally share local tooling permissions across the team and into releases (e.g., source distributions). Consider removing this from version control and adding it to .gitignore, or committing a non-local template (e.g. settings.json.example) with the minimal required permissions instead.

Suggested change
{
"permissions": {
"allow": [
"Bash(git rev-list *)",
"Bash(./vendor/bin/phpunit --filter 'SdkConfigBuilderTest|SessionConfigurationResponseTest')",
"Bash(git config *)"
]
}
}
{}

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +9
15 changes: 15 additions & 0 deletions src/DocScan/Session/Create/SdkConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,19 @@ public function getSuppressedScreens(): ?array
{
return $this->suppressedScreens;
}

/**
* Returns true when the given screen identifier has been configured to be suppressed.
*
* @param string $screenIdentifier
* @return bool
*/
public function isScreenSuppressed(string $screenIdentifier): bool
{
if ($this->suppressedScreens === null) {
return false;
}

return in_array($screenIdentifier, $this->suppressedScreens, true);
}
}
16 changes: 16 additions & 0 deletions src/DocScan/Session/Create/SuppressedScreen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Yoti\DocScan\Session\Create;

class SuppressedScreen
{
public const ID_DOCUMENT_EDUCATION = 'ID_DOCUMENT_EDUCATION';
public const ID_DOCUMENT_REQUIREMENTS = 'ID_DOCUMENT_REQUIREMENTS';
public const SUPPLEMENTARY_DOCUMENT_EDUCATION = 'SUPPLEMENTARY_DOCUMENT_EDUCATION';
public const ZOOM_LIVENESS_EDUCATION = 'ZOOM_LIVENESS_EDUCATION';
public const STATIC_LIVENESS_EDUCATION = 'STATIC_LIVENESS_EDUCATION';
public const FACE_CAPTURE_EDUCATION = 'FACE_CAPTURE_EDUCATION';
public const FLOW_COMPLETION = 'FLOW_COMPLETION';
}
111 changes: 111 additions & 0 deletions tests/DocScan/Session/Create/SdkConfigBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Yoti\DocScan\Constants;
use Yoti\DocScan\Session\Create\SdkConfigBuilder;
use Yoti\DocScan\Session\Create\SuppressedScreen;
use Yoti\Test\TestCase;

/**
Expand Down Expand Up @@ -440,4 +441,114 @@ public function shouldNotIncludeSuppressedScreensInJsonWhenNull()
$jsonData = $result->jsonSerialize();
$this->assertFalse(property_exists($jsonData, 'suppressed_screens'));
}

/**
* @test
* @covers ::withSuppressedScreens
* @covers \Yoti\DocScan\Session\Create\SdkConfig::getSuppressedScreens
*/
public function shouldAllowEmptySuppressedScreensArray()
{
$result = (new SdkConfigBuilder())
->withSuppressedScreens([])
->build();

$this->assertSame([], $result->getSuppressedScreens());
}

/**
* @test
* @covers ::withSuppressedScreens
* @covers \Yoti\DocScan\Session\Create\SdkConfig::getSuppressedScreens
*/
public function shouldBuildUsingSuppressedScreenConstants()
{
$suppressedScreens = [
SuppressedScreen::ID_DOCUMENT_EDUCATION,
SuppressedScreen::ID_DOCUMENT_REQUIREMENTS,
SuppressedScreen::SUPPLEMENTARY_DOCUMENT_EDUCATION,
SuppressedScreen::ZOOM_LIVENESS_EDUCATION,
SuppressedScreen::STATIC_LIVENESS_EDUCATION,
SuppressedScreen::FACE_CAPTURE_EDUCATION,
SuppressedScreen::FLOW_COMPLETION,
];

$result = (new SdkConfigBuilder())
->withSuppressedScreens($suppressedScreens)
->build();

$this->assertEquals($suppressedScreens, $result->getSuppressedScreens());
}

/**
* @test
* @covers \Yoti\DocScan\Session\Create\SuppressedScreen
*/
public function suppressedScreenConstantsShouldHaveExpectedValues()
{
$this->assertSame('ID_DOCUMENT_EDUCATION', SuppressedScreen::ID_DOCUMENT_EDUCATION);
$this->assertSame('ID_DOCUMENT_REQUIREMENTS', SuppressedScreen::ID_DOCUMENT_REQUIREMENTS);
$this->assertSame(
'SUPPLEMENTARY_DOCUMENT_EDUCATION',
SuppressedScreen::SUPPLEMENTARY_DOCUMENT_EDUCATION
);
$this->assertSame('ZOOM_LIVENESS_EDUCATION', SuppressedScreen::ZOOM_LIVENESS_EDUCATION);
$this->assertSame('STATIC_LIVENESS_EDUCATION', SuppressedScreen::STATIC_LIVENESS_EDUCATION);
$this->assertSame('FACE_CAPTURE_EDUCATION', SuppressedScreen::FACE_CAPTURE_EDUCATION);
$this->assertSame('FLOW_COMPLETION', SuppressedScreen::FLOW_COMPLETION);
}

/**
* @test
* @covers \Yoti\DocScan\Session\Create\SdkConfig::isScreenSuppressed
*/
public function isScreenSuppressedShouldReturnTrueForListedScreen()
{
$result = (new SdkConfigBuilder())
->withSuppressedScreens([
SuppressedScreen::ID_DOCUMENT_EDUCATION,
SuppressedScreen::FLOW_COMPLETION,
])
->build();

$this->assertTrue($result->isScreenSuppressed(SuppressedScreen::ID_DOCUMENT_EDUCATION));
$this->assertTrue($result->isScreenSuppressed(SuppressedScreen::FLOW_COMPLETION));
}

/**
* @test
* @covers \Yoti\DocScan\Session\Create\SdkConfig::isScreenSuppressed
*/
public function isScreenSuppressedShouldReturnFalseForUnlistedScreen()
{
$result = (new SdkConfigBuilder())
->withSuppressedScreen(SuppressedScreen::ID_DOCUMENT_EDUCATION)
->build();

$this->assertFalse($result->isScreenSuppressed(SuppressedScreen::FLOW_COMPLETION));
}

/**
* @test
* @covers \Yoti\DocScan\Session\Create\SdkConfig::isScreenSuppressed
*/
public function isScreenSuppressedShouldReturnFalseWhenSuppressedScreensIsNull()
{
$result = (new SdkConfigBuilder())->build();

$this->assertFalse($result->isScreenSuppressed(SuppressedScreen::ID_DOCUMENT_EDUCATION));
}

/**
* @test
* @covers \Yoti\DocScan\Session\Create\SdkConfig::isScreenSuppressed
*/
public function isScreenSuppressedShouldBeCaseSensitive()
{
$result = (new SdkConfigBuilder())
->withSuppressedScreen(SuppressedScreen::ID_DOCUMENT_EDUCATION)
->build();

$this->assertFalse($result->isScreenSuppressed('id_document_education'));
}
}
Loading