Skip to content

Commit

Permalink
Fix several issues reported by quality tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jul 25, 2023
1 parent d1cb99e commit 819bbc7
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 6 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@
"ext-krb5": "*",

"simplesamlphp/simplesamlphp": "^2.0.0",
"simplesamlphp/simplesamlphp-module-ldap": "^2.0.0",
"simplesamlphp/simplesamlphp-test-framework": "^1.5.5",
"simplesamlphp/xml-security": "^0.6.6"
"simplesamlphp/xml-security": "^0.6.6",
"vimeo/psalm": "^5.13"
},
"support": {
"issues": "https://github.com/tvdijen/simplesamlphp-module-monitor/issues",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
By default it is less stringent about long lines than other coding standards
</description>

<file>config-templates</file>
<file>config</file>
<file>hooks</file>
<file>public</file>
<file>src</file>
Expand Down
27 changes: 27 additions & 0 deletions psalm-dev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<psalm
name="SimpleSAMLphp testsuite"
useDocblockTypes="true"
errorLevel="4"
reportMixedIssues="false"
hideExternalErrors="true"
allowStringToStandInForClass="true"
>
<projectFiles>
<directory name="tests" />

<!-- Ignore certain directories -->
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<!-- Ignore UnresolvableInclude on CLI-scripts -->
<UnresolvableInclude>
<errorLevel type="suppress">
<file name="tests/bootstrap.php" />
</errorLevel>
</UnresolvableInclude>
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
>
<projectFiles>
<directory name="hooks" />
<directory name="public" />
<directory name="src" />
<directory name="www" />
</projectFiles>

<issueHandlers>
Expand Down
8 changes: 7 additions & 1 deletion src/TestCase/AuthSource/Ldap/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use function intval;
use function ldap_explode_dn;
use function sprintf;
use function str_replace;
use function stripos;
use function strpos;
Expand Down Expand Up @@ -78,7 +79,12 @@ protected function initialize(TestData $testData): void
public function invokeTest(): void
{
try {
$this->connection->search([$this->base], sprintf('(|(%s=%s))', $this->attributes[0], $this->username), [], false);
$this->connection->search(
[$this->base],
sprintf('(|(%s=%s))', $this->attributes[0], $this->username),
[],
false,
);
} catch (Error\Error $error) {
// Fallthru
}
Expand Down
2 changes: 2 additions & 0 deletions tests/files/TestSuiteImplementation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Tests\SimpleSAML\Module\monitor\TestFiles;

use SimpleSAML\Module\monitor\State;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace SimpleSAML\Module\monitor\Test;

use SimpleSAML\Configuration;
use SimpleSAML\Module\ldap\Auth\Ldap;
use SimpleSAML\Module\ldap\Connector\Ldap;
use SimpleSAML\Module\monitor\TestCase;
use SimpleSAML\Module\monitor\TestData;
use SimpleSAML\Module\monitor\State;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/TestCase/AuthSource/Ldap/LdapSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use SimpleSAML\Configuration;
use SimpleSAML\Error;
use SimpleSAML\Module\ldap\Auth\Ldap;
use SimpleSAML\Module\ldap\Connector\Ldap;
use SimpleSAML\Module\monitor\TestCase;
use SimpleSAML\Module\monitor\TestData;
use SimpleSAML\Module\monitor\State;
Expand Down

0 comments on commit 819bbc7

Please sign in to comment.