Passed
Pull Request — master (#60)
by Tim
02:12
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
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\Test\XMLSecurity\XML;
6
7
use PHPUnit\Framework\Attributes\Group;
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