From 89e86a68501e5081dcbb4c0408e49ef94e4ad698 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Mon, 22 Aug 2022 17:19:50 +0200 Subject: [PATCH] phpcs: fix multiline statements + indentation (cherry picked from commit b08104d1cca2c00a9947ac4ba5ab7a2c91afdcf0) --- tests/modules/saml/src/IdP/SAML2Test.php | 117 +++++++++++++---------- 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/tests/modules/saml/src/IdP/SAML2Test.php b/tests/modules/saml/src/IdP/SAML2Test.php index 3e2d11603..20b1f8094 100644 --- a/tests/modules/saml/src/IdP/SAML2Test.php +++ b/tests/modules/saml/src/IdP/SAML2Test.php @@ -284,9 +284,13 @@ EOT; $this->assertArrayHasKey('SingleSignOnService', $hostedMd); $this->assertIsArray($hostedMd['SingleSignOnService']); $this->assertCount(1, $hostedMd['SingleSignOnService']); - $this->assertEquals(['Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', - 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService'], - $hostedMd['SingleSignOnService'][0]); + $this->assertEquals( + [ + 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', + 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService' + ], + $hostedMd['SingleSignOnService'][0] + ); $this->assertArrayHasKey('SingleLogoutService', $hostedMd); $this->assertIsArray($hostedMd['SingleLogoutService']); $this->assertCount(1, $hostedMd['SingleLogoutService']); @@ -382,9 +386,13 @@ EOT; ], $hostedMd['SingleSignOnService'][0] ); - $this->assertEquals(['Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', - 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService'], - $hostedMd['SingleSignOnService'][1]); + $this->assertEquals( + [ + 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', + 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService' + ], + $hostedMd['SingleSignOnService'][1] + ); } public function testIdPGetHostedMetadataECP(): void @@ -395,12 +403,21 @@ EOT; $this->assertArrayHasKey('SingleSignOnService', $hostedMd); $this->assertIsArray($hostedMd['SingleSignOnService']); $this->assertCount(2, $hostedMd['SingleSignOnService']); - $this->assertEquals(['Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', - 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService'], - $hostedMd['SingleSignOnService'][0]); - $this->assertEquals(['Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP', 'index' => 0, - 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService'], - $hostedMd['SingleSignOnService'][1]); + $this->assertEquals( + [ + 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', + 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService' + ], + $hostedMd['SingleSignOnService'][0] + ); + $this->assertEquals( + [ + 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP', + 'index' => 0, + 'Location' => 'http://localhost/simplesaml/module.php/saml/idp/singleSignOnService' + ], + $hostedMd['SingleSignOnService'][1] + ); } /** @@ -454,19 +471,19 @@ EOT; public function testMetadataHostedOrganizationData(): void { $config = [ - 'OrganizationName' => [ - 'en' => 'Voorbeeld Organisatie Foundation b.a.', - 'nl' => 'Stichting Voorbeeld Organisatie b.a.', - ], - 'OrganizationDisplayName' => [ - 'en' => 'Example organization', - 'nl' => 'Voorbeeldorganisatie', - ], - 'OrganizationURL' => [ - 'en' => 'https://example.com', - 'nl' => 'https://example.com/nl', - ], - ]; + 'OrganizationName' => [ + 'en' => 'Voorbeeld Organisatie Foundation b.a.', + 'nl' => 'Stichting Voorbeeld Organisatie b.a.', + ], + 'OrganizationDisplayName' => [ + 'en' => 'Example organization', + 'nl' => 'Voorbeeldorganisatie', + ], + 'OrganizationURL' => [ + 'en' => 'https://example.com', + 'nl' => 'https://example.com/nl', + ], + ]; $md = $this->idpMetadataHandlerHelper($config); $this->assertEquals('Voorbeeld Organisatie Foundation b.a.', $md['OrganizationName']['en']); @@ -480,13 +497,13 @@ EOT; public function testMetadataHostedOrganizationDataDefaultForDisplayNameIsName(): void { $config = [ - 'OrganizationName' => [ - 'nl' => 'Stichting Voorbeeld Organisatie b.a.', - ], - 'OrganizationURL' => [ - 'nl' => 'https://example.com/nl', - ], - ]; + 'OrganizationName' => [ + 'nl' => 'Stichting Voorbeeld Organisatie b.a.', + ], + 'OrganizationURL' => [ + 'nl' => 'https://example.com/nl', + ], + ]; $md = $this->idpMetadataHandlerHelper($config); $this->assertEquals('Stichting Voorbeeld Organisatie b.a.', $md['OrganizationName']['nl']); @@ -500,13 +517,13 @@ EOT; public function testMetadataHostedOrganizationURLMissingRaisesException(): void { $config = [ - 'OrganizationName' => [ - 'nl' => 'Stichting Voorbeeld Organisatie b.a.', - ], - 'OrganizationDisplayName' => [ - 'nl' => 'Voorbeeldorganisatie', - ], - ]; + 'OrganizationName' => [ + 'nl' => 'Stichting Voorbeeld Organisatie b.a.', + ], + 'OrganizationDisplayName' => [ + 'nl' => 'Voorbeeldorganisatie', + ], + ]; $this->expectException(Exception::class); $this->expectExceptionMessage('If OrganizationName is set, OrganizationURL must also be set.'); @@ -521,7 +538,7 @@ EOT; $ea = ['{urn:simplesamlphp:v1}foo' => ['bar']]; $config = [ 'EntityAttributes' => $ea, - ]; + ]; $md = $this->idpMetadataHandlerHelper($config); $this->assertArrayHasKey('EntityAttributes', $md); @@ -532,7 +549,7 @@ EOT; $ea = ['http://macedir.org/entity-category' => ['http://refeds.org/category/hide-from-discovery']]; $config = [ 'EntityAttributes' => $ea, - ]; + ]; $md = $this->idpMetadataHandlerHelper($config); $this->assertArrayHasKey('EntityAttributes', $md); @@ -615,12 +632,12 @@ EOT; public function testMetadataHostedContainsRegistrationInfo(): void { $config = [ - 'RegistrationInfo' => [ - 'authority' => 'urn:mace:sp.example.org', - 'instant' => '2008-01-17T11:28:03.577Z', - 'policies' => ['en' => 'http://sp.example.org/policy', 'es' => 'http://sp.example.org/politica'], - ], - ]; + 'RegistrationInfo' => [ + 'authority' => 'urn:mace:sp.example.org', + 'instant' => '2008-01-17T11:28:03.577Z', + 'policies' => ['en' => 'http://sp.example.org/policy', 'es' => 'http://sp.example.org/politica'], + ], + ]; $md = $this->idpMetadataHandlerHelper($config); $this->assertArrayHasKey('RegistrationInfo', $md); @@ -639,9 +656,9 @@ EOT; public function testMetadataHostedSigning(): void { $config = [ - 'redirect.validate' => true, - 'validate.authnrequest' => true, - ]; + 'redirect.validate' => true, + 'validate.authnrequest' => true, + ]; $md = $this->idpMetadataHandlerHelper($config); $this->assertArrayHasKey('sign.authnrequest', $md); -- GitLab