1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\Test\XMLSecurity\Assert; |
6
|
|
|
|
7
|
|
|
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider}; |
|
|
|
|
8
|
|
|
use PHPUnit\Framework\TestCase; |
9
|
|
|
use SimpleSAML\Assert\AssertionFailedException; |
10
|
|
|
use SimpleSAML\XMLSecurity\Assert\Assert; |
11
|
|
|
use SimpleSAML\XMLSecurity\Exception\ProtocolViolationException; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class \SimpleSAML\Test\XMLSecurity\Assert\HMACOutputLengthTest |
15
|
|
|
* |
16
|
|
|
* @package simplesamlphp/xml-security |
17
|
|
|
*/ |
18
|
|
|
#[CoversClass(Assert::class)] |
19
|
|
|
final class HMACOutputLengthTest extends TestCase |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @param boolean $shouldPass |
23
|
|
|
* @param string $HMACOutputLength |
24
|
|
|
*/ |
25
|
|
|
#[DataProvider('provideHMACOutputLength')] |
26
|
|
|
public function testValidHMACOutputLength(bool $shouldPass, string $HMACOutputLength): void |
27
|
|
|
{ |
28
|
|
|
try { |
29
|
|
|
Assert::validHMACOutputLength($HMACOutputLength); |
30
|
|
|
$this->assertTrue($shouldPass); |
31
|
|
|
} catch (AssertionFailedException|ProtocolViolationException $e) { |
32
|
|
|
$this->assertFalse($shouldPass); |
33
|
|
|
} |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return array<string, array{0: bool, 1: string}> |
39
|
|
|
*/ |
40
|
|
|
public static function provideHMACOutputLength(): array |
41
|
|
|
{ |
42
|
|
|
return [ |
43
|
|
|
'empty' => [false, ''], |
44
|
|
|
'valid positive integer' => [true, '128'], |
45
|
|
|
'invalid indivisible by 8' => [false, '4'], |
46
|
|
|
'invalid signed positive integer' => [false, '+128'], |
47
|
|
|
'invalid zero' => [false, '0'], |
48
|
|
|
'invalid leading zeros' => [false, '0000000000000000000128'], |
49
|
|
|
'invalid with fractional' => [false, '1.'], |
50
|
|
|
'invalid negative' => [false, '-128'], |
51
|
|
|
'invalid with thousands-delimiter' => [false, '1,28'], |
52
|
|
|
]; |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths