|
4 | 4 |
|
5 | 5 | namespace SimpleSAML\Test\Module\exampleattributeserver\Controller; |
6 | 6 |
|
| 7 | +use PHPUnit\Framework\Attributes\CoversClass; |
7 | 8 | use PHPUnit\Framework\TestCase; |
8 | 9 | use SimpleSAML\Configuration; |
9 | 10 | use SimpleSAML\HTTP\RunnableResponse; |
10 | 11 | use SimpleSAML\Metadata\MetaDataStorageHandler; |
11 | | -use SimpleSAML\Module\exampleattributeserver\Controller; |
| 12 | +use SimpleSAML\Module\exampleattributeserver\Controller\AttributeServer; |
| 13 | +use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; |
12 | 14 | use Symfony\Component\HttpFoundation\Request; |
13 | 15 |
|
14 | 16 | /** |
15 | 17 | * Set of tests for the controllers in the "exampleattributeserver" module. |
16 | 18 | * |
17 | | - * @covers \SimpleSAML\Module\exampleattributeserver\Controller\AttributeServer |
18 | | - * @package SimpleSAML\Test |
| 19 | + * @package simplesamlphp/simplesamlphp-module-exampleattributeserver |
19 | 20 | */ |
| 21 | +#[CoversClass(AttributeServer::class)] |
20 | 22 | class ExampleAttributeServerTest extends TestCase |
21 | 23 | { |
22 | 24 | /** @var \SimpleSAML\Configuration */ |
@@ -61,44 +63,11 @@ public function testMain(): void |
61 | 63 | $mdh->method('getMetaDataConfig')->willReturn(Configuration::loadFromArray([ |
62 | 64 | 'EntityID' => 'auth_source_id', |
63 | 65 | 'testAttributeEndpoint' => 'test', |
64 | | - 'privatekey' => dirname(__FILE__, 4) . '/vendor/simplesamlphp/xml-security/resources/keys/selfsigned.simplesamlphp.org.key', |
| 66 | + 'privatekey' => PEMCertificatesMock::buildKeysPath(PEMCertificatesMock::SELFSIGNED_PRIVATE_KEY), |
65 | 67 | 'privatekey_pass' => '1234', |
66 | 68 | ])); |
67 | | -/** |
68 | | - $mdh = new class () extends MetaDataStorageHandler { |
69 | | - public function __construct() |
70 | | - { |
71 | | - } |
72 | | -
|
73 | | - public function getMetaDataCurrentEntityID(string $set, string $type = 'entityid'): string |
74 | | - { |
75 | | - return 'localhost/simplesaml'; |
76 | | - } |
77 | | -
|
78 | | - public function getMetaData(?string $entityId, string $set): array |
79 | | - { |
80 | | - return [ |
81 | | - 'https://example.org/' => ['testAttributeEndpoint' => []] |
82 | | - ]; |
83 | | - } |
84 | | -
|
85 | | - public function getList(string $set = 'saml20-idp-hosted', bool $showExpired = false): array |
86 | | - { |
87 | | - if ($set === 'saml20-idp-hosted') { |
88 | | - return [ |
89 | | - 0 => [ |
90 | | - 'name' => 'SimpleSAMLphp Hosted IDP', |
91 | | - 'descr' => 'The local IDP', |
92 | | - 'OrganizationDisplayName' => ['en' => 'My IDP', 'nl' => 'Mijn IDP'] |
93 | | - ] |
94 | | - ]; |
95 | | - } |
96 | | - return []; |
97 | | - } |
98 | | - }; |
99 | | -*/ |
100 | 69 |
|
101 | | - $c = new Controller\AttributeServer(self::$config); |
| 70 | + $c = new AttributeServer(self::$config); |
102 | 71 | $c->setMetadataStorageHandler($mdh); |
103 | 72 | $response = $c->main($request); |
104 | 73 |
|
|
0 commit comments