From 0d6abc4ea9b4ceca92312fb20df19b81d0f620d4 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Thu, 18 Oct 2018 11:17:38 +0200
Subject: [PATCH] tests: PSR2

---
 lib/SimpleSAML/Locale/Translate.php           |   2 +-
 lib/SimpleSAML/XHTML/IdPDisco.php             |  29 +++--
 tests/BuiltInServer.php                       |   1 -
 tests/lib/SimpleSAML/Auth/StateTest.php       |   3 +-
 tests/lib/SimpleSAML/ConfigurationTest.php    |   8 +-
 .../SimpleSAML/Locale/LocalizationTest.php    |   1 -
 .../Metadata/MetaDataStorageSourceTest.php    |  13 +-
 .../SimpleSAML/Metadata/SAMLBuilderTest.php   |  16 +--
 .../SimpleSAML/Metadata/SAMLParserTest.php    |   9 +-
 .../consent/lib/Auth/Process/ConsentTest.php  |   6 +-
 .../lib/Auth/Process/AttributeAddTest.php     |   2 +-
 .../lib/Auth/Process/AttributeAlterTest.php   |   8 +-
 .../lib/Auth/Process/AttributeCopyTest.php    |   4 +-
 .../lib/Auth/Process/AttributeLimitTest.php   |  37 +++---
 .../lib/Auth/Process/AttributeMapTest.php     |   2 +-
 .../lib/Auth/Process/AttributeRealmTest.php   |   4 +-
 .../Auth/Process/CardinalitySingleTest.php    |   2 +-
 .../core/lib/Auth/Process/CardinalityTest.php |   2 +-
 .../modules/core/lib/Auth/Process/PHPTest.php |   2 +-
 .../lib/Auth/Process/ScopeAttributeTest.php   |  35 +++---
 .../Auth/Process/ScopeFromAttributeTest.php   |   4 +-
 .../core/lib/Auth/Process/TargetedIDTest.php  | 113 +++++++++---------
 .../core/lib/Auth/UserPassOrgBaseTest.php     |   3 +-
 .../lib/Storage/SQLPermanentStorageTest.php   |   2 +-
 .../ldap/lib/Auth/Process/BaseFilterTest.php  |   2 +-
 .../lib/Auth/Source/Auth_Source_SP_Test.php   |   6 +-
 26 files changed, 164 insertions(+), 152 deletions(-)

diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php
index c9e7a223d..2b577fdc5 100644
--- a/lib/SimpleSAML/Locale/Translate.php
+++ b/lib/SimpleSAML/Locale/Translate.php
@@ -541,7 +541,7 @@ class Translate
             $priorities = $langcfg->getArray('priorities', []);
         }
 
-        if ( !empty($priorities[$context['currentLanguage']]) ) {
+        if (!empty($priorities[$context['currentLanguage']])) {
             foreach ($priorities[$context['currentLanguage']] as $lang) {
                 if (isset($translations[$lang])) {
                     return $translations[$lang];
diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php
index 794e82543..51449f95f 100644
--- a/lib/SimpleSAML/XHTML/IdPDisco.php
+++ b/lib/SimpleSAML/XHTML/IdPDisco.php
@@ -595,31 +595,34 @@ class IdPDisco
         $tryLanguages = [0 => $language, 1 => $defaultLanguage, 2 => $fallbackLanguage];
 
         $newlist = [];
-        foreach($idpList as $entityid => $data) {
+        foreach ($idpList as $entityid => $data) {
             $newlist[$entityid]['entityid'] = $entityid;
-            foreach ( $tryLanguages as $lang ) {
-                if ( $name = $this->getEntityDisplayName($data, $lang) ) {
+            foreach ($tryLanguages as $lang) {
+                if ($name = $this->getEntityDisplayName($data, $lang)) {
                     $newlist[$entityid]['name'] = $name;
                     continue;
                 }
             }
-            if ( empty($newlist[$entityid]['name']) ) {
+            if (empty($newlist[$entityid]['name'])) {
                 $newlist[$entityid]['name'] = $entityid;
             }
-            foreach ( $tryLanguages as $lang ) {
-                if ( !empty($data['description'][$lang]) ) {
+            foreach ($tryLanguages as $lang) {
+                if (!empty($data['description'][$lang])) {
                     $newlist[$entityid]['description'] = $data['description'][$lang];
                     continue;
                 }
             }
-            if ( !empty($data['icon']) ) {
+            if (!empty($data['icon'])) {
                 $newlist[$entityid]['icon'] = $data['icon'];
                 $newlist[$entityid]['iconurl'] = \SimpleSAML\Utils\HTTP::resolveURL($data['icon']);
             }
         }
-        usort($newlist, function($idpentry1, $idpentry2) {
-            return strcasecmp($idpentry1['name'],$idpentry2['name']);
-            });
+        usort(
+            $newlist,
+            function ($idpentry1, $idpentry2) {
+                return strcasecmp($idpentry1['name'], $idpentry2['name']);
+            }
+        );
 
         $t->data['idplist'] = $newlist;
         $t->data['preferredidp'] = $preferredIdP;
@@ -633,11 +636,11 @@ class IdPDisco
 
     private function getEntityDisplayName(array $idpData, $language)
     {
-        if(isset($idpData['UIInfo']['DisplayName'][$language]) ) {
+        if (isset($idpData['UIInfo']['DisplayName'][$language])) {
             return $idpData['UIInfo']['DisplayName'][$language];
-        } elseif ( isset($idpData['name'][$language]) ) {
+        } elseif (isset($idpData['name'][$language])) {
             return $idpData['name'][$language];
-        } elseif ( isset($idpData['OrganizationDisplayName'][$language]) ) {
+        } elseif (isset($idpData['OrganizationDisplayName'][$language])) {
             return $idpData['OrganizationDisplayName'][$language];
         }
         return null;
diff --git a/tests/BuiltInServer.php b/tests/BuiltInServer.php
index e98a4a61c..0695e8c7e 100644
--- a/tests/BuiltInServer.php
+++ b/tests/BuiltInServer.php
@@ -9,7 +9,6 @@
 
 namespace SimpleSAML\Test;
 
-
 class BuiltInServer
 {
 
diff --git a/tests/lib/SimpleSAML/Auth/StateTest.php b/tests/lib/SimpleSAML/Auth/StateTest.php
index 210d7ddfc..481105559 100644
--- a/tests/lib/SimpleSAML/Auth/StateTest.php
+++ b/tests/lib/SimpleSAML/Auth/StateTest.php
@@ -5,14 +5,13 @@ use PHPUnit\Framework\TestCase;
 /**
  * Tests for \SimpleSAML\Auth\State
  */
-class Auth_StateTest extends TestCase
+class StateTest extends TestCase
 {
     /**
      * Test the getPersistentAuthData() function.
      */
     public function testGetPersistentAuthData()
     {
-
         $mandatory = [
             'Attributes' => [],
             'Expire' => 1234,
diff --git a/tests/lib/SimpleSAML/ConfigurationTest.php b/tests/lib/SimpleSAML/ConfigurationTest.php
index 9f7d4dcd3..379612bd9 100644
--- a/tests/lib/SimpleSAML/ConfigurationTest.php
+++ b/tests/lib/SimpleSAML/ConfigurationTest.php
@@ -5,7 +5,7 @@ use \SimpleSAML\Configuration;
 /**
  * Tests for \SimpleSAML\Configuration
  */
-class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase
+class ConfigurationTest extends SimpleSAML\Test\Utils\ClearStateTestCase
 {
     /**
      * Test \SimpleSAML\Configuration::getVersion()
@@ -364,7 +364,8 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase
     /**
      * Test \SimpleSAML\Configuration::getValueValidate()
      */
-    public function testGetValueValidate() {
+    public function testGetValueValidate()
+    {
         $c = Configuration::loadFromArray([
             'opt' => 'b',
         ]);
@@ -439,7 +440,8 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase
     }
 
     /**
-     * Test \SimpleSAML\Configuration::getArrayizeString() option with an array that contains something that isn't a string.
+     * Test \SimpleSAML\Configuration::getArrayizeString() option
+     * with an array that contains something that isn't a string.
      * @expectedException Exception
      */
     public function testGetArrayizeStringWrongValue()
diff --git a/tests/lib/SimpleSAML/Locale/LocalizationTest.php b/tests/lib/SimpleSAML/Locale/LocalizationTest.php
index 0d67caa0e..cc58f1ebe 100644
--- a/tests/lib/SimpleSAML/Locale/LocalizationTest.php
+++ b/tests/lib/SimpleSAML/Locale/LocalizationTest.php
@@ -45,5 +45,4 @@ class LocalizationTest extends TestCase
         $this->assertArrayHasKey($newDomain, $registeredDomains);
         $this->assertEquals($registeredDomains[$newDomain], $newDomainLocaleDir);
     }
-
 }
diff --git a/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php b/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php
index ce301db53..b2ae04291 100644
--- a/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php
+++ b/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php
@@ -10,7 +10,8 @@ class MetaDataStorageSourceTest extends PHPUnit_Framework_TestCase
      * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig XML bad source
      * @expectedException \Exception
      */
-    public function testBadXMLSource() {
+    public function testBadXMLSource()
+    {
         \SimpleSAML\Metadata\MetaDataStorageSource::getSource(["type"=>"xml", "foo"=>"baa"]);
     }
 
@@ -18,7 +19,8 @@ class MetaDataStorageSourceTest extends PHPUnit_Framework_TestCase
      * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig invalid static XML source
      * @expectedException Exception
      */
-    public function testInvalidStaticXMLSource() {
+    public function testInvalidStaticXMLSource()
+    {
         $strTestXML = "
 <EntityDescriptor ID=\"_12345678-90ab-cdef-1234-567890abcdef\" entityID=\"https://saml.idp/entityid\" xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\">
 </EntityDescriptor>
@@ -29,7 +31,8 @@ class MetaDataStorageSourceTest extends PHPUnit_Framework_TestCase
     /**
      * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig XML static XML source
      */
-    public function testStaticXMLSource() {
+    public function testStaticXMLSource()
+    {
         $testEntityId = "https://saml.idp/entityid";
         $strTestXML = "
 <EntityDescriptor ID=\"_12345678-90ab-cdef-1234-567890abcdef\" entityID=\"$testEntityId\" xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\">
@@ -49,8 +52,8 @@ xmlns:fed=\"http://docs.oasis-open.org/wsfed/federation/200706\">
         // As a secondary thing, check that the entity ID from the static source provided can be extracted
         $source = \SimpleSAML\Metadata\MetaDataStorageSource::getSource(["type"=>"xml", "xml"=>$strTestXML]);
         $idpSet = $source->getMetadataSet("saml20-idp-remote");
-        $this->assertArrayHasKey($testEntityId, $idpSet,  "Did not extract expected IdP entity ID from static XML source");
-	// Finally verify that a different entity ID does not get loaded
+        $this->assertArrayHasKey($testEntityId, $idpSet, "Did not extract expected IdP entity ID from static XML source");
+        // Finally verify that a different entity ID does not get loaded
         $this->assertCount(1, $idpSet, "Unexpectedly got metadata for an alternate entity than that defined");
     }
 }
diff --git a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php
index c06cb5467..04f88d1ec 100644
--- a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php
+++ b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php
@@ -160,26 +160,26 @@ class SAMLBuilderTest extends TestCase
 
         $spDesc = $samlBuilder->getEntityDescriptor();
         $acs = $spDesc->getElementsByTagName("AttributeConsumingService");
-	$acs1 = $acs->item(0);
+        $acs1 = $acs->item(0);
         $this->assertFalse($acs1->hasAttribute("isDefault"));
 
-	$metadata['attributes.isDefault'] = true;
+        $metadata['attributes.isDefault'] = true;
 
         $samlBuilder = new SAMLBuilder($entityId);
         $samlBuilder->addMetadata($set, $metadata);
         $spDesc = $samlBuilder->getEntityDescriptor();
         $acs = $spDesc->getElementsByTagName("AttributeConsumingService");
-	$acs1 = $acs->item(0);
+        $acs1 = $acs->item(0);
         $this->assertTrue($acs1->hasAttribute("isDefault"));
         $this->assertEquals("true", $acs1->getAttribute("isDefault"));
 
-	$metadata['attributes.isDefault'] = false;
+        $metadata['attributes.isDefault'] = false;
 
         $samlBuilder = new SAMLBuilder($entityId);
         $samlBuilder->addMetadata($set, $metadata);
         $spDesc = $samlBuilder->getEntityDescriptor();
         $acs = $spDesc->getElementsByTagName("AttributeConsumingService");
-	$acs1 = $acs->item(0);
+        $acs1 = $acs->item(0);
         $this->assertTrue($acs1->hasAttribute("isDefault"));
         $this->assertEquals("false", $acs1->getAttribute("isDefault"));
     }
@@ -207,18 +207,18 @@ class SAMLBuilderTest extends TestCase
 
         $spDesc = $samlBuilder->getEntityDescriptor();
         $acs = $spDesc->getElementsByTagName("AttributeConsumingService");
-	$acs1 = $acs->item(0);
+        $acs1 = $acs->item(0);
         $this->assertTrue($acs1->hasAttribute("index"));
         $this->assertEquals("0", $acs1->getAttribute("index"));
 
-	$metadata['attributes.index'] = 15;
+        $metadata['attributes.index'] = 15;
 
         $samlBuilder = new SAMLBuilder($entityId);
         $samlBuilder->addMetadata($set, $metadata);
 
         $spDesc = $samlBuilder->getEntityDescriptor();
         $acs = $spDesc->getElementsByTagName("AttributeConsumingService");
-	$acs1 = $acs->item(0);
+        $acs1 = $acs->item(0);
         $this->assertTrue($acs1->hasAttribute("index"));
         $this->assertEquals("15", $acs1->getAttribute("index"));
     }
diff --git a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php
index cfed7b198..9db79a1cf 100644
--- a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php
+++ b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php
@@ -9,7 +9,6 @@ use PHPUnit\Framework\TestCase;
  */
 class SAMLParserTest extends TestCase
 {
-
     /**
      * Test Registration Info is parsed
      */
@@ -38,7 +37,6 @@ XML
         // RegistrationInfo is accessible in the SP or IDP metadata accessors
         $metadata = $entities['theEntityID']->getMetadata20SP();
         $this->assertEquals($expected, $metadata['RegistrationInfo']);
-
     }
 
     /**
@@ -125,11 +123,14 @@ XML
         $this->assertEquals("Example service", $metadata['name']['en']);
         $this->assertEquals("Dit is een voorbeeld voor de unittest.", $metadata['description']['nl']);
 
-        $expected_a = ["urn:mace:dir:attribute-def:eduPersonPrincipalName", "urn:mace:dir:attribute-def:mail", "urn:mace:dir:attribute-def:displayName"];
+        $expected_a = [
+            "urn:mace:dir:attribute-def:eduPersonPrincipalName",
+            "urn:mace:dir:attribute-def:mail",
+            "urn:mace:dir:attribute-def:displayName"
+        ];
         $expected_r = ["urn:mace:dir:attribute-def:eduPersonPrincipalName"];
 
         $this->assertEquals($expected_a, $metadata['attributes']);
         $this->assertEquals($expected_r, $metadata['attributes.required']);
     }
-
 }
diff --git a/tests/modules/consent/lib/Auth/Process/ConsentTest.php b/tests/modules/consent/lib/Auth/Process/ConsentTest.php
index d6b4e8b71..1f0b07eab 100644
--- a/tests/modules/consent/lib/Auth/Process/ConsentTest.php
+++ b/tests/modules/consent/lib/Auth/Process/ConsentTest.php
@@ -209,10 +209,12 @@ class ConsentTest extends TestCase
         $this->assertEquals($instanceVars['focus']->getValue($testcase), $config['focus']);
         $this->assertEquals($instanceVars['hiddenAttributes']->getValue($testcase), $config['hiddenAttributes']);
         $this->assertEquals($instanceVars['noconsentattributes']->getValue($testcase), $config['attributes.exclude']);
-        $this->assertEquals($instanceVars['showNoConsentAboutService']->getValue($testcase), $config['showNoConsentAboutService']);
+        $this->assertEquals(
+            $instanceVars['showNoConsentAboutService']->getValue($testcase),
+            $config['showNoConsentAboutService']
+        );
 
         $deprecated = $reflection->newInstance(['noconsentattributes' => $config['attributes.exclude'],], null);
         $this->assertEquals($instanceVars['noconsentattributes']->getValue($deprecated), $config['attributes.exclude']);
-
     }
 }
diff --git a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php
index c84fbc95e..fc7117f0c 100644
--- a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php
+++ b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:AttributeAdd filter.
  */
-class Test_Core_Auth_Process_AttributeAdd extends TestCase
+class AttributeAddTest extends TestCase
 {
 
     /**
diff --git a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php
index 454215470..fe82b93ac 100644
--- a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php
+++ b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:AttributeAlter filter.
  */
-class Test_Core_Auth_Process_AttributeAlter extends TestCase
+class AttributeAlterTest extends TestCase
 {
 
     /**
@@ -91,9 +91,11 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase
 
         $result = self::processFilter($config, $request);
         $attributes = $result['Attributes'];
-        $this->assertEquals($attributes,
+        $this->assertEquals(
+            $attributes,
             ['something' => ['somevalue'],
-            'somethingelse' => ['someothervalue']]);
+            'somethingelse' => ['someothervalue']]
+        );
     }
 
     /**
diff --git a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php
index cedd94322..6e1d923a1 100644
--- a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php
+++ b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:AttributeCopy filter.
  */
-class Test_Core_Auth_Process_AttributeCopy extends TestCase
+class AttributeCopyTest extends TestCase
 {
 
     /**
@@ -17,7 +17,7 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase
      */
     private static function processFilter(array $config, array $request)
     {
-        $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeCopy($config, NULL);
+        $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeCopy($config, null);
         $filter->process($request);
         return $request;
     }
diff --git a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php
index 9bc2260ce..019cbaf1e 100644
--- a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php
+++ b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:AttributeLimit filter.
  */
-class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
+class AttributeLimitTest extends TestCase
 {
     /**
      * Helper function to run the filter with a given configuration.
@@ -16,7 +16,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
      */
     private static function processFilter(array $config, array $request)
     {
-        $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeLimit($config, NULL);
+        $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeLimit($config, null);
         $filter->process($request);
         return $request;
     }
@@ -54,7 +54,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
 
         $config = [
             'cn',
-            'default' => TRUE,
+            'default' => true,
         ];
 
         $result = self::processFilter($config, $request);
@@ -64,8 +64,6 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
         $this->assertArrayNotHasKey('eduPersonTargetedID', $attributes);
         $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes);
         $this->assertCount(2, $attributes);
-
-
     }
 
     /**
@@ -100,7 +98,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
 
         $config = [
             'cn',
-            'default' => TRUE,
+            'default' => true,
         ];
 
         $result = self::processFilter($config, $request);
@@ -139,7 +137,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
                  'mail' => ['user@example.org'],
             ],
             'Destination' => [
-		'attributes' => ['cn','mail'],
+                'attributes' => ['cn','mail'],
             ],
             'Source' => [
             ],
@@ -168,7 +166,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
     public function testDefaultWithMetadata()
     {
         $config = [
-            'default' => TRUE,
+            'default' => true,
         ];
 
         $result = self::processFilter($config, self::$request);
@@ -184,7 +182,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
     public function testDefaultWithAttrs()
     {
         $config = [
-            'default' => TRUE,
+            'default' => true,
             'eduPersonTargetedID', 'eduPersonAffiliation',
         ];
 
@@ -205,7 +203,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
     public function testInvalidConfig()
     {
         $config = [
-            'invalidArg' => TRUE,
+            'invalidArg' => true,
         ];
 
         self::processFilter($config, self::$request);
@@ -219,7 +217,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
     public function testInvalidAttributeName()
     {
         $config = [
-		null
+            null
         ];
 
         self::processFilter($config, self::$request);
@@ -232,7 +230,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
     public function testMatchAttributeValues()
     {
         $config = [
-		'eduPersonAffiliation' => ['member']
+            'eduPersonAffiliation' => ['member']
         ];
 
         $result = self::processFilter($config, self::$request);
@@ -242,7 +240,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
         $this->assertEquals($attributes['eduPersonAffiliation'], ['member']);
 
         $config = [
-		'eduPersonAffiliation' => ['member','staff']
+            'eduPersonAffiliation' => ['member','staff']
         ];
 
         $result = self::processFilter($config, self::$request);
@@ -252,22 +250,22 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
         $this->assertEquals($attributes['eduPersonAffiliation'], ['member']);
 
         $config = [
-		'eduPersonAffiliation' => ['student']
+            'eduPersonAffiliation' => ['student']
         ];
         $result = self::processFilter($config, self::$request);
         $attributes = $result['Attributes'];
         $this->assertCount(0, $attributes);
 
         $config = [
-		'eduPersonAffiliation' => ['student','staff']
+            'eduPersonAffiliation' => ['student','staff']
         ];
         $result = self::processFilter($config, self::$request);
         $attributes = $result['Attributes'];
         $this->assertCount(0, $attributes);
     }
 
-    public function testBadOptionsNotTreatedAsValidValues() {
-
+    public function testBadOptionsNotTreatedAsValidValues()
+    {
         // Ensure really misconfigured ignoreCase and regex options are not interpretted as valid valus
         $config = [
             'eduPersonAffiliation' => ['ignoreCase' => 'member', 'nomatch'],
@@ -282,7 +280,8 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
      * Verify that the true value for ignoreCase doesn't get converted into a string ('1') by
      * php and matched against an attribute value of '1'
      */
-    public function testThatIgnoreCaseOptionNotMatchBooleanAsStringValue() {
+    public function testThatIgnoreCaseOptionNotMatchBooleanAsStringValue()
+    {
         $config = [
             'someAttribute' => ['ignoreCase' => true, 'someValue']
         ];
@@ -473,7 +472,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase
     public function testNoIntersection()
     {
         $config = [
-            'default' => TRUE,
+            'default' => true,
         ];
 
         $request = [
diff --git a/tests/modules/core/lib/Auth/Process/AttributeMapTest.php b/tests/modules/core/lib/Auth/Process/AttributeMapTest.php
index 5c50f59bd..35ca92526 100644
--- a/tests/modules/core/lib/Auth/Process/AttributeMapTest.php
+++ b/tests/modules/core/lib/Auth/Process/AttributeMapTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:AttributeMap filter.
  */
-class Test_Core_Auth_Process_AttributeMap extends TestCase
+class AttributeMapTest extends TestCase
 {
     /**
      * Helper function to run the filter with a given configuration.
diff --git a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php
index 9821cf275..85d5a2b1c 100644
--- a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php
+++ b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:AttributeRealm filter.
  */
-class Test_Core_Auth_Process_AttributeRealm extends TestCase
+class AttributeRealmTest extends TestCase
 {
 
     /**
@@ -17,7 +17,7 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase
      */
     private static function processFilter(array $config, array $request)
     {
-        $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeRealm($config, NULL);
+        $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeRealm($config, null);
         $filter->process($request);
         return $request;
     }
diff --git a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php
index ebf43b9c5..dcd105f47 100644
--- a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php
+++ b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php
@@ -7,7 +7,7 @@ if (class_exists('\PHPUnit\Framework\TestCase', true) and !class_exists('\PHPUni
 /**
  * Test for the core:CardinalitySingle filter.
  */
-class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_TestCase
+class CardinalitySingleTest extends \PHPUnit_Framework_TestCase
 {
     private $http;
 
diff --git a/tests/modules/core/lib/Auth/Process/CardinalityTest.php b/tests/modules/core/lib/Auth/Process/CardinalityTest.php
index da6e2e30d..c9d1bc971 100644
--- a/tests/modules/core/lib/Auth/Process/CardinalityTest.php
+++ b/tests/modules/core/lib/Auth/Process/CardinalityTest.php
@@ -8,7 +8,7 @@ if (class_exists('\PHPUnit\Framework\TestCase', true) and !class_exists('\PHPUni
 /**
  * Test for the core:Cardinality filter.
  */
-class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase
+class CardinalityTest extends \PHPUnit_Framework_TestCase
 {
     private $http;
 
diff --git a/tests/modules/core/lib/Auth/Process/PHPTest.php b/tests/modules/core/lib/Auth/Process/PHPTest.php
index 67bf33b70..9ca6ff262 100644
--- a/tests/modules/core/lib/Auth/Process/PHPTest.php
+++ b/tests/modules/core/lib/Auth/Process/PHPTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:PHP filter.
  */
-class Test_Core_Auth_Process_PHP extends TestCase
+class PHPTest extends TestCase
 {
     /**
      * Helper function to run the filter with a given configuration.
diff --git a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php
index 6bc4d276f..9a91a0041 100644
--- a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php
+++ b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php
@@ -5,9 +5,8 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:ScopeAttribute filter.
  */
-class Test_Core_Auth_Process_ScopeAttribute extends TestCase
+class ScopeAttributeTest extends TestCase
 {
-
     /*
      * Helper function to run the filter with a given configuration.
      *
@@ -17,7 +16,7 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase
      */
     private static function processFilter(array $config, array $request)
     {
-        $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeAttribute($config, NULL);
+        $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeAttribute($config, null);
         $filter->process($request);
         return $request;
     }
@@ -63,7 +62,10 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase
         ];
         $result = self::processFilter($config, $request);
         $attributes = $result['Attributes'];
-        $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['library-walk-in@example.edu', 'member@example.com']);
+        $this->assertEquals(
+            $attributes['eduPersonScopedAffiliation'],
+            ['library-walk-in@example.edu', 'member@example.com']
+        );
     }
 
     /*
@@ -170,7 +172,10 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase
         ];
         $result = self::processFilter($config, $request);
         $attributes = $result['Attributes'];
-        $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@example.com','staff@example.com','faculty@example.com']);
+        $this->assertEquals(
+            $attributes['eduPersonScopedAffiliation'],
+            ['member@example.com','staff@example.com','faculty@example.com']
+        );
     }
 
     /*
@@ -194,26 +199,26 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase
         $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['student@example.org']);
     }
 
-	/*
-	 * When the target attribute exists and onlyIfEmpty is set
-	 */
-	public function testOnlyIfEmpty()
-	{
-       $config = [
+    /*
+     * When the target attribute exists and onlyIfEmpty is set
+     */
+    public function testOnlyIfEmpty()
+    {
+        $config = [
             'scopeAttribute' => 'schacHomeOrganization',
             'sourceAttribute' => 'eduPersonAffiliation',
             'targetAttribute' => 'eduPersonScopedAffiliation',
-			'onlyIfEmpty' => true,
-       ];
+            'onlyIfEmpty' => true,
+        ];
         $request = [
             'Attributes' => [
                 'schacHomeOrganization' => ['example.org'],
                 'eduPersonAffiliation' => ['student'],
-				'eduPersonScopedAffiliation' => ['staff@example.org', 'member@example.org'],
+                'eduPersonScopedAffiliation' => ['staff@example.org', 'member@example.org'],
             ]
         ];
         $result = self::processFilter($config, $request);
         $attributes = $result['Attributes'];
         $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['staff@example.org', 'member@example.org']);
-	}
+    }
 }
diff --git a/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php
index 0e5aace08..fd2cd097f 100644
--- a/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php
+++ b/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:ScopeFromAttribute filter.
  */
-class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase
+class ScopeFromAttributeTest extends TestCase
 {
 
     /*
@@ -17,7 +17,7 @@ class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase
      */
     private static function processFilter(array $config, array $request)
     {
-        $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeFromAttribute($config, NULL);
+        $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeFromAttribute($config, null);
         $filter->process($request);
         return $request;
     }
diff --git a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php
index 51f5c6b1d..2649859f2 100644
--- a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php
+++ b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the core:TargetedID filter.
  */
-class Test_Core_Auth_Process_TargetedID extends TestCase
+class TargetedIDTest extends TestCase
 {
     /**
      * Helper function to run the filter with a given configuration.
@@ -16,7 +16,7 @@ class Test_Core_Auth_Process_TargetedID extends TestCase
      */
     private static function processFilter(array $config, array $request)
     {
-        $filter = new \SimpleSAML\Module\core\Auth\Process\TargetedID($config, NULL);
+        $filter = new \SimpleSAML\Module\core\Auth\Process\TargetedID($config, null);
         $filter->process($request);
         return $request;
     }
@@ -26,12 +26,11 @@ class Test_Core_Auth_Process_TargetedID extends TestCase
 //     */
 //    public function testBasic()
 //    {
-//        $config = array(
-//        );
-//        $request = array(
+//        $config = [];
+//        $request = [
 //            'Attributes' => [],
 //            'UserID' => 'user2@example.org',
-//        );
+//        ];
 //        $result = self::processFilter($config, $request);
 //        $attributes = $result['Attributes'];
 //        $this->assertArrayHasKey('eduPersonTargetedID', $attributes);
@@ -44,22 +43,21 @@ class Test_Core_Auth_Process_TargetedID extends TestCase
 //     */
 //    public function testWithSrcDst()
 //    {
-//        $config = array(
-//        );
-//        $request = array(
-//            'Attributes' => array(
+//        $config = [];
+//        $request = [
+//            'Attributes' => [
 //                'eduPersonTargetedID' => 'dummy',
-//            ),
+//            ],
 //            'UserID' => 'user2@example.org',
-//            'Source' => array(
+//            'Source' => [
 //                'metadata-set' => 'saml20-idp-hosted',
 //                'entityid' => 'urn:example:src:id',
-//            ),
-//            'Destination' => array(
+//            ],
+//            'Destination' => [
 //                'metadata-set' => 'saml20-sp-remote',
 //                'entityid' => 'joe',
-//            ),
-//        );
+//            ],
+//        ];
 //        $result = self::processFilter($config, $request);
 //        $attributes = $result['Attributes'];
 //        $this->assertArrayHasKey('eduPersonTargetedID', $attributes);
@@ -71,26 +69,28 @@ class Test_Core_Auth_Process_TargetedID extends TestCase
 //     */
 //    public function testNameIdGeneration()
 //    {
-//        $config = array(
+//        $config = [
 //            'nameId' => true,
-//        );
+//        ];
 //        $request = array(
-//            'Attributes' => array(
-//            ),
+//            'Attributes' => [],
 //            'UserID' => 'user2@example.org',
-//            'Source' => array(
+//            'Source' => [
 //                'metadata-set' => 'saml20-idp-hosted',
 //                'entityid' => 'urn:example:src:id',
-//            ),
-//            'Destination' => array(
+//            ],
+//            'Destination' => [
 //                'metadata-set' => 'saml20-sp-remote',
 //                'entityid' => 'joe',
-//            ),
+//            ],
 //        );
 //        $result = self::processFilter($config, $request);
 //        $attributes = $result['Attributes'];
 //        $this->assertArrayHasKey('eduPersonTargetedID', $attributes);
-//        $this->assertRegExp('#^<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2\.0:assertion" NameQualifier="urn:example:src:id" SPNameQualifier="joe" Format="urn:oasis:names:tc:SAML:2\.0:nameid-format:persistent">[0-9a-f]{40}</saml:NameID>$#', $attributes['eduPersonTargetedID'][0]);
+//        $this->assertRegExp(
+//            '#^<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2\.0:assertion" NameQualifier="urn:example:src:id" SPNameQualifier="joe" Format="urn:oasis:names:tc:SAML:2\.0:nameid-format:persistent">[0-9a-f]{40}</saml:NameID>$#',
+//            $attributes['eduPersonTargetedID'][0]
+//        );
 //    }
 //
 //    /**
@@ -98,30 +98,29 @@ class Test_Core_Auth_Process_TargetedID extends TestCase
 //     */
 //    public function testIdIsPersistent()
 //    {
-//        $config = array(
-//        );
-//        $request = array(
-//            'Attributes' => array(
+//        $config = [];
+//        $request = [
+//            'Attributes' => [
 //                'eduPersonTargetedID' => 'dummy',
-//            ),
+//            ],
 //            'UserID' => 'user2@example.org',
-//            'Source' => array(
+//            'Source' => [
 //                'metadata-set' => 'saml20-idp-hosted',
 //                'entityid' => 'urn:example:src:id',
-//            ),
-//            'Destination' => array(
+//            ],
+//            'Destination' => [
 //                'metadata-set' => 'saml20-sp-remote',
 //                'entityid' => 'joe',
-//            ),
-//        );
+//            ],
+//        ];
 //        for ($i = 0; $i < 10; ++$i) {
-//		$result = self::processFilter($config, $request);
-//		$attributes = $result['Attributes'];
-//                $tid = $attributes['eduPersonTargetedID'][0];
-//                if (isset($prevtid)) {
-//                    $this->assertEquals($prevtid, $tid);
-//                    $prevtid = $tid;
-//                }
+//            $result = self::processFilter($config, $request);
+//            $attributes = $result['Attributes'];
+//            $tid = $attributes['eduPersonTargetedID'][0];
+//            if (isset($prevtid)) {
+//                $this->assertEquals($prevtid, $tid);
+//                $prevtid = $tid;
+//            }
 //        }
 //    }
 //
@@ -130,33 +129,31 @@ class Test_Core_Auth_Process_TargetedID extends TestCase
 //     */
 //    public function testIdIsUnique()
 //    {
-//        $config = array(
-//        );
-//        $request = array(
-//            'Attributes' => array(
-//            ),
+//        $config = [];
+//        $request = [
+//            'Attributes' => [],
 //            'UserID' => 'user2@example.org',
-//            'Source' => array(
+//            'Source' => [
 //                'metadata-set' => 'saml20-idp-hosted',
 //                'entityid' => 'urn:example:src:id',
-//            ),
-//            'Destination' => array(
+//            ],
+//            'Destination' => [
 //                'metadata-set' => 'saml20-sp-remote',
 //                'entityid' => 'joe',
-//            ),
-//        );
-//	$result = self::processFilter($config, $request);
-//	$tid1 = $result['Attributes']['eduPersonTargetedID'][0];
+//            ],
+//        ];
+//        $result = self::processFilter($config, $request);
+//        $tid1 = $result['Attributes']['eduPersonTargetedID'][0];
 //
 //        $request['UserID'] = 'user3@example.org';
-//	$result = self::processFilter($config, $request);
-//	$tid2 = $result['Attributes']['eduPersonTargetedID'][0];
+//        $result = self::processFilter($config, $request);
+//        $tid2 = $result['Attributes']['eduPersonTargetedID'][0];
 //
 //        $this->assertNotEquals($tid1, $tid2);
 //
 //        $request['Destination']['entityid'] = 'urn:example.org:another-sp';
-//	$result = self::processFilter($config, $request);
-//	$tid3 = $result['Attributes']['eduPersonTargetedID'][0];
+//        $result = self::processFilter($config, $request);
+//        $tid3 = $result['Attributes']['eduPersonTargetedID'][0];
 //
 //        $this->assertNotEquals($tid2, $tid3);
 //    }
diff --git a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php
index 90816896b..317301b32 100644
--- a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php
+++ b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php
@@ -27,7 +27,8 @@ class UserPassOrgBaseTest extends \PHPUnit_Framework_TestCase
 
         // When PHP 5.4 support is dropped, replace with:
         // $mockUserPassOrgBase = $this->getMockBuilder(\SimpleSAML\Module\core\Auth\UserPassOrgBase::class)
-        $mockUserPassOrgBase = $this->getMockBuilder(get_parent_class(new \SimpleSAML\Module\ldap\Auth\Source\LDAPMulti(['AuthId' => 'my-org'], [])))
+        $multi = new \SimpleSAML\Module\ldap\Auth\Source\LDAPMulti(['AuthId' => 'my-org']);
+        $mockUserPassOrgBase = $this->getMockBuilder(get_parent_class($multi, []))
             ->setConstructorArgs([['AuthId' => 'my-org'], &$config])
             ->setMethods([])
             ->getMockForAbstractClass();
diff --git a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php
index 49b17fd61..5e0540451 100644
--- a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php
+++ b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php
@@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase;
 /**
  * Test for the SQLPermanentStorage class.
  */
-class Test_Core_Storage_SQLPermanentStorage extends TestCase
+class SQLPermanentStorageTest extends TestCase
 {
     private static $sql;
 
diff --git a/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php b/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php
index b7c502e4e..ab9bf7dbd 100644
--- a/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php
+++ b/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php
@@ -2,7 +2,7 @@
 
 use PHPUnit\Framework\TestCase;
 
-class BaseFilter_Test extends TestCase
+class BaseFilterTest extends TestCase
 {
     public function testVarExportHidesLdapPassword()
     {
diff --git a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php
index f3634818d..c1310986c 100644
--- a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php
+++ b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php
@@ -32,7 +32,7 @@ class ExitTestException extends \Exception
  * - Use introspection to make startSSO2Test available
  * - Override sendSAML2AuthnRequest() to catch the AuthnRequest being sent
  */
-class SP_Tester extends \SimpleSAML\Module\saml\Auth\Source\SP
+class SPTester extends \SimpleSAML\Module\saml\Auth\Source\SP
 {
 
     public function __construct($info, $config)
@@ -68,7 +68,7 @@ class SP_Tester extends \SimpleSAML\Module\saml\Auth\Source\SP
 /**
  * Set of test cases for \SimpleSAML\Module\saml\Auth\Source\SP.
  */
-class SP_Test extends TestCase
+class SPTest extends TestCase
 {
 
     private $idpMetadata = null;
@@ -141,7 +141,7 @@ class SP_Test extends TestCase
     {
         $info = ['AuthId' => 'default-sp'];
         $config = [];
-        $as = new SP_Tester($info, $config);
+        $as = new SPTester($info, $config);
 
         /** @var \SAML2\AuthnRequest $ar */
         $ar = null;
-- 
GitLab