From f0f9d1016f885cfb20849ddc06df27b3cff9035e Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Sun, 7 Apr 2024 16:09:39 +0200 Subject: [PATCH] Fix unit tests --- .github/workflows/php.yml | 8 +++--- composer.json | 2 +- psalm-dev.xml | 27 +++++++++++++++++++ src/Auth/Source/X509userCert.php | 3 +-- ...ExpiryWarningTest.php => AuthX509Test.php} | 0 tools/composer-require-checker.json | 5 +++- 6 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 psalm-dev.xml rename tests/src/Controller/{ExpiryWarningTest.php => AuthX509Test.php} (100%) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index b726c78..451dccd 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -55,7 +55,7 @@ jobs: php-version: '8.3' tools: composer, composer-require-checker, composer-unused, phpcs, psalm # optional performance gain for psalm: opcache - extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, spl, xml + extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, opcache, openssl, pcre, spl, xml - name: Setup problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" @@ -119,7 +119,7 @@ jobs: with: # Should be the lowest supported version php-version: '8.1' - extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml + extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml tools: composer coverage: none @@ -166,7 +166,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml + extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml tools: composer ini-values: error_reporting=E_ALL coverage: pcov @@ -228,7 +228,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml + extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml tools: composer ini-values: error_reporting=E_ALL coverage: none diff --git a/composer.json b/composer.json index 08f23e9..3bd5e20 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "simplesamlphp/simplesamlphp": "^2.2", "simplesamlphp/simplesamlphp-module-ldap": "^2.2", "symfony/http-foundation": "^6.4", - "symfony/security-bundle": "^6.4" + "symfony/ldap": "^6.4" }, "require-dev": { "simplesamlphp/simplesamlphp-test-framework": "^1.6.0" diff --git a/psalm-dev.xml b/psalm-dev.xml new file mode 100644 index 0000000..6116331 --- /dev/null +++ b/psalm-dev.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/Auth/Source/X509userCert.php b/src/Auth/Source/X509userCert.php index 431051e..256d58f 100644 --- a/src/Auth/Source/X509userCert.php +++ b/src/Auth/Source/X509userCert.php @@ -18,14 +18,13 @@ use Symfony\Component\Ldap\Security\LdapUserProvider; use Symfony\Component\Security\Core\Exception\UserNotFoundException; -use function array_key_exists; use function array_fill_keys; +use function array_key_exists; use function array_merge; use function array_values; use function current; use function openssl_x509_parse; use function sprintf; -use function str_replace; /** * This class implements x509 certificate authentication with certificate validation against an LDAP directory. diff --git a/tests/src/Controller/ExpiryWarningTest.php b/tests/src/Controller/AuthX509Test.php similarity index 100% rename from tests/src/Controller/ExpiryWarningTest.php rename to tests/src/Controller/AuthX509Test.php diff --git a/tools/composer-require-checker.json b/tools/composer-require-checker.json index 6f661ff..8a6e045 100644 --- a/tools/composer-require-checker.json +++ b/tools/composer-require-checker.json @@ -1,5 +1,8 @@ { "symbol-whitelist": [ - "SimpleSAML\\Module\\ldap\\ConfigHelper" + "SimpleSAML\\Module\\ldap\\ConfigHelper", + "SimpleSAML\\Module\\ldap\\ConnectorFactory", + "SimpleSAML\\Module\\ldap\\ConnectorInterface", + "Symfony\\Component\\Security\\Core\\Exception\\UserNotFoundException" ] }