Skip to content

Commit

Permalink
Add trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Aug 4, 2024
1 parent bb1fe47 commit fe785b9
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/Controller/MonitorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -156,7 +156,7 @@ private function processJson(array $results): JsonResponse
return JsonResponse::create(

Check failure on line 156 in src/Controller/MonitorController.php

View workflow job for this annotation

GitHub Actions / Quality control

UndefinedMethod

src/Controller/MonitorController.php:156:16: UndefinedMethod: Method Symfony\Component\HttpFoundation\JsonResponse::create does not exist (see https://psalm.dev/022)

Check warning on line 156 in src/Controller/MonitorController.php

View workflow job for this annotation

GitHub Actions / Quality control

MixedReturnStatement

src/Controller/MonitorController.php:156:16: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138)
['overall' => $this->healthInfo[$this->state][0],

Check warning on line 157 in src/Controller/MonitorController.php

View workflow job for this annotation

GitHub Actions / Quality control

MixedArrayAccess

src/Controller/MonitorController.php:157:27: MixedArrayAccess: Cannot access array value on mixed variable $this->healthInfo[$this->state] (see https://psalm.dev/051)
'results' => $results],
$this->responseCode
$this->responseCode,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/TestCase/Network/ConnectUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/TestConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
DependencyInjection $requestVars,
Configuration $globalConfig,
Configuration $authSourceConfig,
Configuration $moduleConfig
Configuration $moduleConfig,
) {
$this->serverVars = $serverVars;
$this->requestVars = $requestVars;
Expand Down
10 changes: 5 additions & 5 deletions src/TestSuite/AuthSource/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -94,7 +94,7 @@ public function invokeTest(): void
'certData' => $certData,
'category' => 'LDAP Server Certificate',
'certExpirationWarning' => $this->certExpirationWarning,
])
]),
);
$certTestResult = $certTest->getTestResult();
$this->addTestResult($certTestResult);
Expand All @@ -109,7 +109,7 @@ public function invokeTest(): void
new TestData([
'authSourceData' => $this->authSourceData,
'connection' => $connection,
])
]),
);
$bindTestResult = $bindTest->getTestResult();
$this->addTestResult($bindTestResult);
Expand All @@ -120,7 +120,7 @@ public function invokeTest(): void
new TestData([
'authSourceData' => $this->authSourceData,
'connection' => $connection,
])
]),
);
$searchTestResult = $searchTest->getTestResult();
$this->addTestResult($searchTestResult);
Expand Down
2 changes: 1 addition & 1 deletion src/TestSuite/AuthSources.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function invokeTest(): void

$output[$authSourceId] = array_merge(
$negoTest->getArrayizeTestResults(),
$ldapTest->getArrayizeTestResults()
$ldapTest->getArrayizeTestResults(),
);
break;
case 'multiauth:MultiAuth':
Expand Down
2 changes: 1 addition & 1 deletion src/TestSuite/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testLdapConfiguration(): void
$confTest = new TestCase\AuthSource\Ldap\Configuration(
new TestData([
'authSourceData' => Configuration::loadFromArray($authSourceData),
])
]),
);

$testResult = $confTest->getTestResult();
Expand Down
10 changes: 5 additions & 5 deletions tests/src/TestCase/AuthSource/Ldap/LdapSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand Down
13 changes: 7 additions & 6 deletions tests/src/TestCase/AuthSource/NegotiateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace SimpleSAML\Module\monitor\Test;

use Exception;
use KRB5NegotiateAuth;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use SimpleSAML\Module\monitor\State;
Expand All @@ -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,
Expand All @@ -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));

Check warning on line 52 in tests/src/TestCase/AuthSource/NegotiateTest.php

View workflow job for this annotation

GitHub Actions / Quality control

DeprecatedMethod

tests/src/TestCase/AuthSource/NegotiateTest.php:52:96: DeprecatedMethod: The method PHPUnit\Framework\TestCase::returnValue has been marked as deprecated (see https://psalm.dev/001)
$KRB5NegotiateAuthMock->expects($this->any())->method('getAuthenticatedUser')->will(
$this->returnValue('[email protected]')
$this->returnValue('[email protected]'),

Check warning on line 54 in tests/src/TestCase/AuthSource/NegotiateTest.php

View workflow job for this annotation

GitHub Actions / Quality control

DeprecatedMethod

tests/src/TestCase/AuthSource/NegotiateTest.php:54:20: DeprecatedMethod: The method PHPUnit\Framework\TestCase::returnValue has been marked as deprecated (see https://psalm.dev/001)
);
$testData = new TestData([
'handle' => $KRB5NegotiateAuthMock,
Expand All @@ -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));

Check warning on line 70 in tests/src/TestCase/AuthSource/NegotiateTest.php

View workflow job for this annotation

GitHub Actions / Quality control

DeprecatedMethod

tests/src/TestCase/AuthSource/NegotiateTest.php:70:96: DeprecatedMethod: The method PHPUnit\Framework\TestCase::returnValue has been marked as deprecated (see https://psalm.dev/001)
$testData = new TestData([
Expand All @@ -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));

Check warning on line 85 in tests/src/TestCase/AuthSource/NegotiateTest.php

View workflow job for this annotation

GitHub Actions / Quality control

DeprecatedMethod

tests/src/TestCase/AuthSource/NegotiateTest.php:85:96: DeprecatedMethod: The method PHPUnit\Framework\TestCase::returnValue has been marked as deprecated (see https://psalm.dev/001)
$testData = new TestData([
Expand Down
2 changes: 1 addition & 1 deletion tests/src/TestConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Check failure on line 62 in tests/src/TestConfigurationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.1, ubuntu-latest

Failed asserting that an array is not empty.

Check failure on line 62 in tests/src/TestConfigurationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.1, windows-latest

Failed asserting that an array is not empty.

Check failure on line 62 in tests/src/TestConfigurationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.2, ubuntu-latest

Failed asserting that an array is not empty.

Check failure on line 62 in tests/src/TestConfigurationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.2, windows-latest

Failed asserting that an array is not empty.

Check failure on line 62 in tests/src/TestConfigurationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.3, ubuntu-latest

Failed asserting that an array is not empty.

Check failure on line 62 in tests/src/TestConfigurationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.3, windows-latest

Failed asserting that an array is not empty.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/TestSuiteFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fe785b9

Please sign in to comment.