Passed
Push — master ( 446cbf...9401ba )
by Tim
02:04
created

ElementRegistryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A testElementRegistry() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\Test\XMLSecurity\XML;
6
7
use PHPUnit\Framework\Attributes\Group;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\Attributes\Group was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PHPUnit\Framework\TestCase;
9
10
use function dirname;
11
use function sprintf;
12
13
/**
14
 * Tests for element registry.
15
 *
16
 * @package simplesamlphp/xml-security
17
 */
18
#[Group('utils')]
19
final class ElementRegistryTest extends TestCase
20
{
21
    /**
22
     * Test that the class-name can be resolved and it's localname matches.
23
     */
24
    public function testElementRegistry(): void
25
    {
26
        $elementRegistry = dirname(__FILE__, 3) . '/src/XML/element.registry.php';
27
        $namespaces = include($elementRegistry);
28
29
        foreach ($namespaces as $namespaceURI => $elements) {
30
            foreach ($elements as $localName => $fqdn) {
31
                $this->assertTrue(class_exists($fqdn), sprintf('Class \'%s\' could not be found.', $fqdn));
32
                $this->assertEquals($fqdn::getLocalName(), $localName);
33
                $this->assertEquals($fqdn::getNamespaceURI(), $namespaceURI);
34
            }
35
        }
36
    }
37
}
38