|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\Test\XML\Assert; |
|
6
|
|
|
|
|
7
|
|
|
use PHPUnit\Framework\Attributes\CoversClass; |
|
|
|
|
|
|
8
|
|
|
use PHPUnit\Framework\Attributes\DataProvider; |
|
|
|
|
|
|
9
|
|
|
use PHPUnit\Framework\TestCase; |
|
10
|
|
|
use SimpleSAML\Assert\AssertionFailedException; |
|
11
|
|
|
use SimpleSAML\XML\Assert\Assert; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class \SimpleSAML\Test\XML\Assert\NCNameTest |
|
15
|
|
|
* |
|
16
|
|
|
* @package simplesamlphp/xml-common |
|
17
|
|
|
*/ |
|
18
|
|
|
#[CoversClass(Assert::class)] |
|
19
|
|
|
final class NCNameTest extends TestCase |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @param boolean $shouldPass |
|
23
|
|
|
* @param string $name |
|
24
|
|
|
*/ |
|
25
|
|
|
#[DataProvider('provideNCName')] |
|
26
|
|
|
public function testValidNCName(bool $shouldPass, string $name): void |
|
27
|
|
|
{ |
|
28
|
|
|
try { |
|
29
|
|
|
Assert::validNCName($name); |
|
30
|
|
|
$this->assertTrue($shouldPass); |
|
31
|
|
|
} catch (AssertionFailedException $e) { |
|
32
|
|
|
$this->assertFalse($shouldPass); |
|
33
|
|
|
} |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @return array<int, array{0: bool, 1: string}> |
|
39
|
|
|
*/ |
|
40
|
|
|
public static function provideNCName(): array |
|
41
|
|
|
{ |
|
42
|
|
|
return [ |
|
43
|
|
|
[true, 'Test'], |
|
44
|
|
|
// May start with an underscore |
|
45
|
|
|
[true, '_Test'], |
|
46
|
|
|
// May contain dashes |
|
47
|
|
|
[true, '_1950-10-04_10-00'], |
|
48
|
|
|
// May contain dots |
|
49
|
|
|
[true, 'Te.st'], |
|
50
|
|
|
// May contain diacriticals |
|
51
|
|
|
[true, 'fööbár'], |
|
52
|
|
|
// Prefixed v4 UUID |
|
53
|
|
|
[true, '_5425e58e-e799-4884-92cc-ca64ecede32f'], |
|
54
|
|
|
// An empty value is not valid, unless xsi:nil is used |
|
55
|
|
|
[false, ''], |
|
56
|
|
|
// Wildcards are not allowed |
|
57
|
|
|
[false, 'Te*st'], |
|
58
|
|
|
// May not start with a digit |
|
59
|
|
|
[false, '1Test'], |
|
60
|
|
|
// May not start with a dash |
|
61
|
|
|
[false, '-Test'], |
|
62
|
|
|
// May not contain a colon |
|
63
|
|
|
[false, 'Te:st'], |
|
64
|
|
|
// Trailing newlines are forbidden |
|
65
|
|
|
[false, "Test\n"], |
|
66
|
|
|
]; |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
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