1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | namespace SimpleSAML\XML\TestUtils; |
||||||
6 | |||||||
7 | use PHPUnit\Framework\Attributes\Depends; |
||||||
0 ignored issues
–
show
|
|||||||
8 | |||||||
9 | use function class_exists; |
||||||
10 | |||||||
11 | /** |
||||||
12 | * Test for arrayizable XML classes to perform default serialization tests. |
||||||
13 | * |
||||||
14 | * @package simplesamlphp\xml-common |
||||||
15 | */ |
||||||
16 | trait ArrayizableElementTestTrait |
||||||
17 | { |
||||||
18 | /** @var class-string */ |
||||||
0 ignored issues
–
show
|
|||||||
19 | protected static string $testedClass; |
||||||
20 | |||||||
21 | /** @var array */ |
||||||
22 | protected static array $arrayRepresentation; |
||||||
23 | |||||||
24 | |||||||
25 | /** |
||||||
26 | * Test arrayization / de-arrayization |
||||||
27 | */ |
||||||
28 | #[Depends('testMarshalling')] |
||||||
29 | public function testArrayization(): void |
||||||
30 | { |
||||||
31 | if (!class_exists(self::$testedClass)) { |
||||||
32 | $this->markTestSkipped( |
||||||
0 ignored issues
–
show
It seems like
markTestSkipped() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
33 | 'Unable to run ' . self::class . '::testArrayization(). Please set ' . self::class |
||||||
34 | . ':$element to a class-string representing the XML-class being tested', |
||||||
35 | ); |
||||||
36 | } elseif (self::$arrayRepresentation === null) { |
||||||
0 ignored issues
–
show
|
|||||||
37 | $this->markTestSkipped( |
||||||
38 | 'Unable to run ' . self::class . '::testArrayization(). Please set ' . self::class |
||||||
39 | . ':$arrayRepresentation to an array representing the XML-class being tested', |
||||||
40 | ); |
||||||
41 | } else { |
||||||
42 | $this->assertEquals( |
||||||
0 ignored issues
–
show
It seems like
assertEquals() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
43 | self::$arrayRepresentation, |
||||||
44 | self::$testedClass::fromArray(self::$arrayRepresentation)->toArray(), |
||||||
45 | ); |
||||||
46 | } |
||||||
47 | } |
||||||
48 | } |
||||||
49 |
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