simplesamlphp /
xml-common
| 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 | * @phpstan-ignore trait.unused |
||||||
| 16 | */ |
||||||
| 17 | trait ArrayizableElementTestTrait |
||||||
| 18 | { |
||||||
| 19 | /** @var class-string */ |
||||||
|
0 ignored issues
–
show
|
|||||||
| 20 | protected static string $testedClass; |
||||||
| 21 | |||||||
| 22 | /** @var array */ |
||||||
| 23 | protected static array $arrayRepresentation; |
||||||
| 24 | |||||||
| 25 | |||||||
| 26 | /** |
||||||
| 27 | * Test arrayization / de-arrayization |
||||||
| 28 | */ |
||||||
| 29 | #[Depends('testMarshalling')] |
||||||
| 30 | public function testArrayization(): void |
||||||
| 31 | { |
||||||
| 32 | if (!class_exists(self::$testedClass)) { |
||||||
| 33 | $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
Loading history...
|
|||||||
| 34 | 'Unable to run ' . self::class . '::testArrayization(). Please set ' . self::class |
||||||
| 35 | . ':$element to a class-string representing the XML-class being tested', |
||||||
| 36 | ); |
||||||
| 37 | } elseif (self::$arrayRepresentation === null) { |
||||||
|
0 ignored issues
–
show
|
|||||||
| 38 | $this->markTestSkipped( |
||||||
| 39 | 'Unable to run ' . self::class . '::testArrayization(). Please set ' . self::class |
||||||
| 40 | . ':$arrayRepresentation to an array representing the XML-class being tested', |
||||||
| 41 | ); |
||||||
| 42 | } else { |
||||||
| 43 | $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
Loading history...
|
|||||||
| 44 | self::$arrayRepresentation, |
||||||
| 45 | self::$testedClass::fromArray(self::$arrayRepresentation)->toArray(), |
||||||
| 46 | ); |
||||||
| 47 | } |
||||||
| 48 | } |
||||||
| 49 | } |
||||||
| 50 |
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