From fe785b9638ace700c961d69aa9b69f9780649c2a Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Sun, 4 Aug 2024 22:47:48 +0200 Subject: [PATCH] Add trailing commas --- src/Controller/MonitorController.php | 4 ++-- src/TestCase/Network/ConnectUri.php | 2 +- src/TestConfiguration.php | 2 +- src/TestSuite/AuthSource/Ldap.php | 10 +++++----- src/TestSuite/AuthSources.php | 2 +- src/TestSuite/Store.php | 2 +- tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php | 10 +++++----- .../AuthSource/Ldap/LdapConfigurationTest.php | 2 +- .../src/TestCase/AuthSource/Ldap/LdapSearchTest.php | 10 +++++----- tests/src/TestCase/AuthSource/NegotiateTest.php | 13 +++++++------ tests/src/TestConfigurationTest.php | 2 +- tests/src/TestSuiteFactoryTest.php | 2 +- 12 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Controller/MonitorController.php b/src/Controller/MonitorController.php index a3ea27b..0997640 100644 --- a/src/Controller/MonitorController.php +++ b/src/Controller/MonitorController.php @@ -84,7 +84,7 @@ public function __construct(Configuration $config) $this->requestVars, $this->config, $this->authsourceConfig, - $this->moduleConfig + $this->moduleConfig, ); $this->monitor = new Monitor($this->testConfiguration); } @@ -156,7 +156,7 @@ private function processJson(array $results): JsonResponse return JsonResponse::create( ['overall' => $this->healthInfo[$this->state][0], 'results' => $results], - $this->responseCode + $this->responseCode, ); } diff --git a/src/TestCase/Network/ConnectUri.php b/src/TestCase/Network/ConnectUri.php index 16cdc93..1abfb72 100644 --- a/src/TestCase/Network/ConnectUri.php +++ b/src/TestCase/Network/ConnectUri.php @@ -103,7 +103,7 @@ public function invokeTest(): void $errstr, $this->timeout, STREAM_CLIENT_CONNECT, - $this->context + $this->context, ); $testResult = new TestResult('Network connection', $this->uri); diff --git a/src/TestConfiguration.php b/src/TestConfiguration.php index 2d0ab77..0d92074 100644 --- a/src/TestConfiguration.php +++ b/src/TestConfiguration.php @@ -53,7 +53,7 @@ public function __construct( DependencyInjection $requestVars, Configuration $globalConfig, Configuration $authSourceConfig, - Configuration $moduleConfig + Configuration $moduleConfig, ) { $this->serverVars = $serverVars; $this->requestVars = $requestVars; diff --git a/src/TestSuite/AuthSource/Ldap.php b/src/TestSuite/AuthSource/Ldap.php index 98736bb..54eb141 100644 --- a/src/TestSuite/AuthSource/Ldap.php +++ b/src/TestSuite/AuthSource/Ldap.php @@ -66,7 +66,7 @@ public function invokeTest(): void { // Test LDAP configuration $confTest = new TestCase\AuthSource\Ldap\Configuration( - new TestData(['authSourceData' => $this->authSourceData]) + new TestData(['authSourceData' => $this->authSourceData]), ); $confTestResult = $confTest->getTestResult(); $this->addTestResult($confTestResult); @@ -79,7 +79,7 @@ public function invokeTest(): void foreach ($this->hosts as $hostname) { $preparedTestData = $this->prepareConnection($hostname); $connTest = new TestCase\Network\ConnectUri( - new TestData($preparedTestData) + new TestData($preparedTestData), ); $connTestResult = $connTest->getTestResult(); $this->addTestResult($connTestResult); @@ -94,7 +94,7 @@ public function invokeTest(): void 'certData' => $certData, 'category' => 'LDAP Server Certificate', 'certExpirationWarning' => $this->certExpirationWarning, - ]) + ]), ); $certTestResult = $certTest->getTestResult(); $this->addTestResult($certTestResult); @@ -109,7 +109,7 @@ public function invokeTest(): void new TestData([ 'authSourceData' => $this->authSourceData, 'connection' => $connection, - ]) + ]), ); $bindTestResult = $bindTest->getTestResult(); $this->addTestResult($bindTestResult); @@ -120,7 +120,7 @@ public function invokeTest(): void new TestData([ 'authSourceData' => $this->authSourceData, 'connection' => $connection, - ]) + ]), ); $searchTestResult = $searchTest->getTestResult(); $this->addTestResult($searchTestResult); diff --git a/src/TestSuite/AuthSources.php b/src/TestSuite/AuthSources.php index da9ac6c..e518f3d 100644 --- a/src/TestSuite/AuthSources.php +++ b/src/TestSuite/AuthSources.php @@ -98,7 +98,7 @@ public function invokeTest(): void $output[$authSourceId] = array_merge( $negoTest->getArrayizeTestResults(), - $ldapTest->getArrayizeTestResults() + $ldapTest->getArrayizeTestResults(), ); break; case 'multiauth:MultiAuth': diff --git a/src/TestSuite/Store.php b/src/TestSuite/Store.php index ab9a6c8..fdeade8 100644 --- a/src/TestSuite/Store.php +++ b/src/TestSuite/Store.php @@ -110,7 +110,7 @@ private function testPhpSession(TestConfiguration $configuration): array $tmp_configuration = Configuration::getInstance(); $tmp_configuration = $tmp_configuration->toArray(); $tmp_configuration['memcache_store.servers'] = $this->parsePhpMemcachedConfiguration( - session_save_path() + session_save_path(), ); $tmp_configuration = Configuration::loadFromArray($tmp_configuration); Configuration::setPreloadedConfig($tmp_configuration); diff --git a/tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php b/tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php index 4f6a0fb..792248d 100644 --- a/tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php +++ b/tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php @@ -23,14 +23,14 @@ public function testBindSuccesful(): void 'search.password' => 'password', ]; $connectionMock = $this->getMockBuilder(Ldap::class)->onlyMethods( - ['bind'] + ['bind'], )->disableOriginalConstructor()->getMock(); $connectionMock->expects($this->once())->method('bind')->willReturn(true); $confTest = new TestCase\AuthSource\Ldap\Bind( new TestData([ 'authSourceData' => Configuration::loadFromArray($authSourceData), 'connection' => $connectionMock, - ]) + ]), ); $testResult = $confTest->getTestResult(); @@ -44,17 +44,17 @@ public function testBindFailed(): void 'search.password' => 'password', ]; $connectionMock = $this->getMockBuilder(Ldap::class)->onlyMethods( - ['bind'] + ['bind'], )->disableOriginalConstructor()->getMock(); $connectionMock->expects($this->once())->method('bind')->will( - $this->throwException(new Error\Error('Invalid credentials.')) + $this->throwException(new Error\Error('Invalid credentials.')), ); $confTest = new TestCase\AuthSource\Ldap\Bind( new TestData([ 'authSourceData' => Configuration::loadFromArray($authSourceData), 'connection' => $connectionMock, - ]) + ]), ); $testResult = $confTest->getTestResult(); diff --git a/tests/src/TestCase/AuthSource/Ldap/LdapConfigurationTest.php b/tests/src/TestCase/AuthSource/Ldap/LdapConfigurationTest.php index 32b061c..0efc696 100644 --- a/tests/src/TestCase/AuthSource/Ldap/LdapConfigurationTest.php +++ b/tests/src/TestCase/AuthSource/Ldap/LdapConfigurationTest.php @@ -23,7 +23,7 @@ public function testLdapConfiguration(): void $confTest = new TestCase\AuthSource\Ldap\Configuration( new TestData([ 'authSourceData' => Configuration::loadFromArray($authSourceData), - ]) + ]), ); $testResult = $confTest->getTestResult(); diff --git a/tests/src/TestCase/AuthSource/Ldap/LdapSearchTest.php b/tests/src/TestCase/AuthSource/Ldap/LdapSearchTest.php index c66a29b..c56dc7a 100644 --- a/tests/src/TestCase/AuthSource/Ldap/LdapSearchTest.php +++ b/tests/src/TestCase/AuthSource/Ldap/LdapSearchTest.php @@ -30,14 +30,14 @@ public function testSearchSuccesful(): void ); $connectionMock = $this->getMockBuilder(Ldap::class)->onlyMethods( - ['search'] + ['search'], )->disableOriginalConstructor()->getMock(); $connectionMock->expects($this->once())->method('search')->willReturn($entry); $confTest = new TestCase\AuthSource\Ldap\Search( new TestData([ 'authSourceData' => Configuration::loadFromArray($authSourceData), 'connection' => $connectionMock, - ]) + ]), ); $testResult = $confTest->getTestResult(); @@ -52,16 +52,16 @@ public function testSearchFailed(): void 'search.password' => 'password', ]; $connectionMock = $this->getMockBuilder(Ldap::class)->onlyMethods( - ['search'] + ['search'], )->disableOriginalConstructor()->getMock(); $connectionMock->expects($this->once())->method('search')->will( - $this->throwException(new Error\Error('UNHANDLEDEXCEPTION')) + $this->throwException(new Error\Error('UNHANDLEDEXCEPTION')), ); $confTest = new TestCase\AuthSource\Ldap\Search( new TestData([ 'authSourceData' => Configuration::loadFromArray($authSourceData), 'connection' => $connectionMock, - ]) + ]), ); $testResult = $confTest->getTestResult(); diff --git a/tests/src/TestCase/AuthSource/NegotiateTest.php b/tests/src/TestCase/AuthSource/NegotiateTest.php index f081a7f..fcb2afe 100644 --- a/tests/src/TestCase/AuthSource/NegotiateTest.php +++ b/tests/src/TestCase/AuthSource/NegotiateTest.php @@ -4,6 +4,7 @@ namespace SimpleSAML\Module\monitor\Test; +use Exception; use KRB5NegotiateAuth; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use SimpleSAML\Module\monitor\State; @@ -29,10 +30,10 @@ public static function tearDownAfterClass(): void public function testNegotiateException(): void { $KRB5NegotiateAuthMock = $this->getMockBuilder(KRB5NegotiateAuth::class)->onlyMethods( - ['doAuthentication', 'getAuthenticatedUser'] + ['doAuthentication', 'getAuthenticatedUser'], )->disableOriginalConstructor()->getMock(); $KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->will( - $this->throwException(new \Exception('Generic exception message')) + $this->throwException(new Exception('Generic exception message')), ); $testData = new TestData([ 'handle' => $KRB5NegotiateAuthMock, @@ -46,11 +47,11 @@ public function testNegotiateException(): void public function testNegotiateSuccess(): void { $KRB5NegotiateAuthMock = $this->getMockBuilder(KRB5NegotiateAuth::class)->onlyMethods( - ['doAuthentication', 'getAuthenticatedUser'] + ['doAuthentication', 'getAuthenticatedUser'], )->disableOriginalConstructor()->getMock(); $KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->will($this->returnValue(true)); $KRB5NegotiateAuthMock->expects($this->any())->method('getAuthenticatedUser')->will( - $this->returnValue('testuser@example.org') + $this->returnValue('testuser@example.org'), ); $testData = new TestData([ 'handle' => $KRB5NegotiateAuthMock, @@ -64,7 +65,7 @@ public function testNegotiateSuccess(): void public function testNegotiateNoAuthorzation(): void { $KRB5NegotiateAuthMock = $this->getMockBuilder(KRB5NegotiateAuth::class)->onlyMethods( - ['doAuthentication', 'getAuthenticatedUser'] + ['doAuthentication', 'getAuthenticatedUser'], )->disableOriginalConstructor()->getMock(); $KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->will($this->returnValue(false)); $testData = new TestData([ @@ -79,7 +80,7 @@ public function testNegotiateNoAuthorzation(): void public function testNegotiateError(): void { $KRB5NegotiateAuthMock = $this->getMockBuilder(KRB5NegotiateAuth::class)->onlyMethods( - ['doAuthentication', 'getAuthenticatedUser'] + ['doAuthentication', 'getAuthenticatedUser'], )->disableOriginalConstructor()->getMock(); $KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->will($this->returnValue(false)); $testData = new TestData([ diff --git a/tests/src/TestConfigurationTest.php b/tests/src/TestConfigurationTest.php index 5a1a858..1b07ea2 100644 --- a/tests/src/TestConfigurationTest.php +++ b/tests/src/TestConfigurationTest.php @@ -56,7 +56,7 @@ public function testTestConfiguration(): void $metadataConfig = $testConf->getMetadataConfig(); $this->assertArrayHasKey( 'https://idp.example.org/saml2/idp/metadata.php', - $metadataConfig['saml20-idp-remote'] + $metadataConfig['saml20-idp-remote'], ); $this->assertNotEmpty($testConf->getAvailableApacheModules()); diff --git a/tests/src/TestSuiteFactoryTest.php b/tests/src/TestSuiteFactoryTest.php index 59edb4f..2ea32e5 100644 --- a/tests/src/TestSuiteFactoryTest.php +++ b/tests/src/TestSuiteFactoryTest.php @@ -28,7 +28,7 @@ public function testTestSuiteFactory(): void 'enable.wsfed-sp' => false, ]), Configuration::loadFromArray([]), - Configuration::loadFromArray([]) + Configuration::loadFromArray([]), ); $testData = new TestData(['travis' => 'travis', 'test' => 'travis']); $testSuite = new TestSuiteImplementation($config, $testData);