Skip to content

Commit

Permalink
Fix incorrect type declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
ghalse committed Jan 10, 2023
1 parent ecfa247 commit 020f156
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Auth/Process/Fticks.php
Expand Up @@ -296,11 +296,11 @@ public function __construct(array $config, $reserved)
/**
* Warn about risky logger settings
*
* @param string $defaultFacility
* @param int $defaultFacility
* @param string $defaultProcessName
* @return void
*/
private function warnRiskyLogSettings(string $defaultFacility, string $defaultProcessName): void
private function warnRiskyLogSettings(int $defaultFacility, string $defaultProcessName): void
{
if (
array_key_exists('facility', $this->logconfig)
Expand Down
25 changes: 25 additions & 0 deletions tests/src/Auth/Process/FticksTest.php
Expand Up @@ -6,6 +6,7 @@
use SAML2\Constants;
use SimpleSAML\Module\fticks\Auth\Process\Fticks;
use SimpleSAML\Configuration;
use SimpleSAML\Error;
use SimpleSAML\Logger;
use SimpleSAML\Logger\StandardErrorLoggingHandler;

Expand Down Expand Up @@ -206,4 +207,28 @@ public function testFilteringString(): void
$this->expectOutputRegex('/^' . $pattern1 . '[^#]+' . $pattern2 . '\d+#$/');
$result = self::processFilter($config, $request);
}

/**
*/
public function testInvalidConfig(): void
{
$this->expectException(Error\Exception::class);
$result = self::processFilter([], self::$minRequest);
$result = self::processFilter(['federation' => 'ACME', 'logdest' => 'invalid'], self::$minRequest);
}

/**
* @backupStaticAttributes
*/
public function testRiskyLogSettings(): void
{
Logger::setCaptureLog();
$result = self::processFilter(
['federation' => 'ACME', 'logdest' => 'local', 'logconfig' => ['processname' => 'phpunit']],
self::$minRequest
);
$log = Logger::getCapturedLog();
$this->assertCount(1, $log);
$this->assertStringContainsString('syslog processname differs from global config', $log[0]);
}
}

0 comments on commit 020f156

Please sign in to comment.