From 7ba5767e39b105a7f9e4c527dc9a83fdeb684d7d Mon Sep 17 00:00:00 2001 From: Thijs Kinkhorst <thijs@kinkhorst.com> Date: Fri, 7 Aug 2020 11:31:35 +0000 Subject: [PATCH] Add testcase for skipping expire in MetadataConverter --- .../admin/lib/Controller/FederationTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/modules/admin/lib/Controller/FederationTest.php b/tests/modules/admin/lib/Controller/FederationTest.php index efb007116..c96641366 100644 --- a/tests/modules/admin/lib/Controller/FederationTest.php +++ b/tests/modules/admin/lib/Controller/FederationTest.php @@ -46,6 +46,9 @@ class FederationTest extends TestCase /** @var string */ private $broken_metadata_xml = self::FRAMEWORK . '/metadata/xml/corrupted-metadata-selfsigned.xml'; + /** @var string */ + private $expired_metadata_xml = self::FRAMEWORK . '/metadata/xml/expired-metadata.xml'; + /** @var string */ private $ssp_metadata = self::FRAMEWORK . '/metadata/simplesamlphp/saml20-idp-remote_cert_selfsigned.php'; @@ -224,6 +227,25 @@ class FederationTest extends TestCase $this->assertNull($response->data['error']); } + /** + * @return void + */ + public function testMetadataConverterSkipsExpires(): void + { + $request = Request::create( + '/federation/metadata-converter', + 'POST', + ['xmldata' => file_get_contents($this->expired_metadata_xml)] + ); + + $c = new Controller\Federation($this->config); + $c->setAuthUtils($this->authUtils); + $response = $c->metadataConverter($request); + + $this->assertTrue($response->isSuccessful()); + $this->assertStringNotContainsString("'expire' =>", $response->data['output']['saml20-idp-remote']); + } + /** * @return void -- GitLab