diff --git a/modules/authfacebook/extlibinc/base_facebook.php b/modules/authfacebook/extlibinc/base_facebook.php index b656f350f28aaacba7ce6ecba13195732dc9b2c0..aa1a23efb24e0139820037d699d1809a0d82b509 100644 --- a/modules/authfacebook/extlibinc/base_facebook.php +++ b/modules/authfacebook/extlibinc/base_facebook.php @@ -828,7 +828,7 @@ abstract class BaseFacebook $response_params = json_decode($access_token_response, true); if (!isset($response_params['access_token'])) { - self::errorLog('No access token in response. ' . $access_token_response); + self::errorLog('No access token in response. '.$access_token_response); return false; } diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index dbd9a87b97ad91346b080c83fa7ff11b9370fcdc..d9b2d05e672a29ab75dfd758a808b83864f0c068 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -59,7 +59,7 @@ $allLinks = [ $current = $config->getVersion(); if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master') { if (!function_exists('curl_init')) { - $warnings[] = [ '{core:frontpage:warnings_curlmissing}' ]; + $warnings[] = ['{core:frontpage:warnings_curlmissing}']; } else { $latest = $session->getData("core:latest_simplesamlphp_version", "version"); diff --git a/tests/Utils/ClearStateTestCase.php b/tests/Utils/ClearStateTestCase.php index 2cecc16b4c5d46af5774f50ee9332737f34b2389..d7d11c8919b324b830c0b68421bc755c447703d5 100644 --- a/tests/Utils/ClearStateTestCase.php +++ b/tests/Utils/ClearStateTestCase.php @@ -2,7 +2,7 @@ namespace SimpleSAML\Test\Utils; -include(dirname(__FILE__) . '/StateClearer.php'); +include(dirname(__FILE__).'/StateClearer.php'); use PHPUnit\Framework\TestCase; diff --git a/tests/Utils/ReduceSpillOverTest.php b/tests/Utils/ReduceSpillOverTest.php index 82f82da397dd832ccd2d30b05502851c3592fbbf..c744e2a5fda3cfdb43249715a709f06527ff1a81 100644 --- a/tests/Utils/ReduceSpillOverTest.php +++ b/tests/Utils/ReduceSpillOverTest.php @@ -17,7 +17,7 @@ class ReduceSpillOverTest extends ClearStateTestCase $_SERVER['QUERY_STRING'] = 'a=b'; \SimpleSAML\Configuration::loadFromArray(['a' => 'b'], '[ARRAY]', 'simplesaml'); $this->assertEquals('b', \SimpleSAML\Configuration::getInstance()->getString('a')); - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); } /** diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4ec9274b9b08c126d52bc3286c5b9c877eed2a4e..82ed397dc1f01a6d83f49ee20bbb44c2dff15267 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,7 +1,7 @@ <?php $projectRoot = dirname(__DIR__); -require_once($projectRoot . '/vendor/autoload.php'); +require_once($projectRoot.'/vendor/autoload.php'); // Current SSP autoloader can't resolve classes from the tests folder. -include($projectRoot . '/tests/Utils/ClearStateTestCase.php'); +include($projectRoot.'/tests/Utils/ClearStateTestCase.php'); diff --git a/tests/lib/SimpleSAML/ConfigurationTest.php b/tests/lib/SimpleSAML/ConfigurationTest.php index 8f6901f5a3e1f7acb964fcd879ae8221183c14b1..474495e84443c5485883c89bfee1183d7d9269da 100644 --- a/tests/lib/SimpleSAML/ConfigurationTest.php +++ b/tests/lib/SimpleSAML/ConfigurationTest.php @@ -210,7 +210,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase public function testGetBaseDir() { $c = Configuration::loadFromArray([]); - $this->assertEquals($c->getBaseDir(), dirname(dirname(dirname(dirname(__FILE__)))) . '/'); + $this->assertEquals($c->getBaseDir(), dirname(dirname(dirname(dirname(__FILE__)))).'/'); $c = Configuration::loadFromArray([ 'basedir' => '/basedir', @@ -487,8 +487,8 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase { $c = Configuration::loadFromArray([ 'opts' => [ - 'a' => ['opt1' => 'value1'], - 'b' => ['opt2' => 'value2'], + 'a' => ['opt1' => 'value1'], + 'b' => ['opt2' => 'value2'], ], ]); $this->assertEquals($c->getConfigList('missing_opt', '--missing--'), '--missing--'); diff --git a/tests/lib/SimpleSAML/Utils/ConfigTest.php b/tests/lib/SimpleSAML/Utils/ConfigTest.php index 43525cf30c356a9fbdd4697352cd3f3814524ac9..6077a6301c45627eb860ac672343b29217ad21f0 100644 --- a/tests/lib/SimpleSAML/Utils/ConfigTest.php +++ b/tests/lib/SimpleSAML/Utils/ConfigTest.php @@ -20,7 +20,7 @@ class ConfigTest extends TestCase putenv('SIMPLESAMLPHP_CONFIG_DIR'); $configDir = Config::getConfigDir(); - $this->assertEquals($configDir, dirname(dirname(dirname(dirname(__DIR__)))) . '/config'); + $this->assertEquals($configDir, dirname(dirname(dirname(dirname(__DIR__)))).'/config'); } @@ -29,7 +29,7 @@ class ConfigTest extends TestCase */ public function testEnvVariableConfigDir() { - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); $configDir = Config::getConfigDir(); $this->assertEquals($configDir, __DIR__); @@ -40,7 +40,7 @@ class ConfigTest extends TestCase */ public function testEnvRedirectVariableConfigDir() { - putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); $configDir = Config::getConfigDir(); $this->assertEquals($configDir, __DIR__); @@ -51,8 +51,8 @@ class ConfigTest extends TestCase */ public function testEnvRedirectPriorityVariableConfigDir() { - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . dirname(__DIR__)); - putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('SIMPLESAMLPHP_CONFIG_DIR='.dirname(__DIR__)); + putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); $configDir = Config::getConfigDir(); $this->assertEquals($configDir, dirname(__DIR__)); @@ -65,13 +65,13 @@ class ConfigTest extends TestCase public function testInvalidEnvVariableConfigDirThrowsException() { // I used a random hash to ensure this test directory is always invalid - $invalidDir = __DIR__ . '/e9826ad19cbc4f5bf20c0913ffcd2ce6'; - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . $invalidDir); + $invalidDir = __DIR__.'/e9826ad19cbc4f5bf20c0913ffcd2ce6'; + putenv('SIMPLESAMLPHP_CONFIG_DIR='.$invalidDir); $this->setExpectedException( 'InvalidArgumentException', - 'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. ' . - 'Given: "' . $invalidDir . '"' + 'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. '. + 'Given: "'.$invalidDir.'"' ); Config::getConfigDir(); diff --git a/tests/lib/SimpleSAML/Utils/SystemTest.php b/tests/lib/SimpleSAML/Utils/SystemTest.php index 7363c34f671e626479c8c280a47501e6e328d930..99a77ebe08a0890f345b26583cbac427e79fb182 100644 --- a/tests/lib/SimpleSAML/Utils/SystemTest.php +++ b/tests/lib/SimpleSAML/Utils/SystemTest.php @@ -115,10 +115,10 @@ class SystemTest extends TestCase */ public function testWriteFileBasic() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); - $filename = $this->root_directory . DIRECTORY_SEPARATOR . 'test'; + $filename = $this->root_directory.DIRECTORY_SEPARATOR.'test'; System::writeFile($filename, ''); @@ -133,10 +133,10 @@ class SystemTest extends TestCase */ public function testWriteFileContents() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); - $filename = $this->root_directory . DIRECTORY_SEPARATOR . 'test'; + $filename = $this->root_directory.DIRECTORY_SEPARATOR.'test'; $contents = 'TEST'; System::writeFile($filename, $contents); @@ -155,10 +155,10 @@ class SystemTest extends TestCase */ public function testWriteFileMode() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); - $filename = $this->root_directory . DIRECTORY_SEPARATOR . 'test'; + $filename = $this->root_directory.DIRECTORY_SEPARATOR.'test'; $mode = 0666; System::writeFile($filename, '', $mode); @@ -177,7 +177,7 @@ class SystemTest extends TestCase */ public function testGetTempDirBasic() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); $res = System::getTempDir(); @@ -195,7 +195,7 @@ class SystemTest extends TestCase */ public function testGetTempDirNonExistant() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . 'nonexistant'; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.'nonexistant'; $config = $this->setConfigurationTempDir($tempdir); $res = System::getTempDir(); @@ -220,7 +220,7 @@ class SystemTest extends TestCase $bad_uid = posix_getuid() + 1; - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); chown($tempdir, $bad_uid); diff --git a/tests/lib/SimpleSAML/Utils/XMLTest.php b/tests/lib/SimpleSAML/Utils/XMLTest.php index fe3694d131830c7808f4c71b2730e2881b0a3b10..a81e6eb4b668fd1c6356abc13bf2ee3c18eb2ae6 100644 --- a/tests/lib/SimpleSAML/Utils/XMLTest.php +++ b/tests/lib/SimpleSAML/Utils/XMLTest.php @@ -135,7 +135,7 @@ class XMLTest extends TestCase $element->appendChild(new \DOMText($data2)); $res = XML::getDOMText($element); - $expected = $data1 . $data2 . $data1 . $data2; + $expected = $data1.$data2.$data1.$data2; $this->assertEquals($expected, $res); } diff --git a/tests/lib/SimpleSAML/XML/ValidatorTest.php b/tests/lib/SimpleSAML/XML/ValidatorTest.php index bc8a197a604a6264dfc10da7b8458c7a54d8c467..b274ad9a89a7d3b9612228188ae397236052afbf 100644 --- a/tests/lib/SimpleSAML/XML/ValidatorTest.php +++ b/tests/lib/SimpleSAML/XML/ValidatorTest.php @@ -202,7 +202,7 @@ NOWDOC; $result = $validator->getX509Certificate(); // getX509Certificate returns a certificate with a newline - $expected = $this->good_certificate . "\n"; + $expected = $this->good_certificate."\n"; $this->assertEquals($result, $expected); } diff --git a/tests/modules/consent/lib/Auth/Process/ConsentTest.php b/tests/modules/consent/lib/Auth/Process/ConsentTest.php index 8916ed440bd63f833bc3ab9aa6ea827704a09250..1e162314720ab0cdeda95d15f02456c15b9c8a94 100644 --- a/tests/modules/consent/lib/Auth/Process/ConsentTest.php +++ b/tests/modules/consent/lib/Auth/Process/ConsentTest.php @@ -185,9 +185,15 @@ class ConsentTest extends TestCase { $reflection = new \ReflectionClass('\SimpleSAML\Module\consent\Auth\Process\Consent'); - foreach ([ - 'includeValues', 'checked', 'focus', 'hiddenAttributes', 'noconsentattributes', 'showNoConsentAboutService' - ] as $v) { + $values = [ + 'includeValues', + 'checked', + 'focus', + 'hiddenAttributes', + 'noconsentattributes', + 'showNoConsentAboutService' + ]; + foreach ($values as $v) { $instanceVars[$v] = $reflection->getProperty($v); $instanceVars[$v]->setAccessible(true); } diff --git a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php index c1d18d72fb9ecf7f1a5dbef8a96adc5a4d3b2c48..538bd10e09464b607fa351ba0e2e2770485cf2e6 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php @@ -48,7 +48,7 @@ class AttributeCopyTest extends TestCase public function testArray() { $config = [ - 'test' => ['new1','new2'], + 'test' => ['new1', 'new2'], ]; $request = [ 'Attributes' => ['test' => ['AAP']], @@ -97,14 +97,14 @@ class AttributeCopyTest extends TestCase 'test2' => 'new2', ]; $request = [ - 'Attributes' => ['test1' => ['val1'], 'test2' => ['val2.1','val2.2']], + 'Attributes' => ['test1' => ['val1'], 'test2' => ['val2.1', 'val2.2']], ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('new1', $attributes); $this->assertEquals($attributes['new1'], ['val1']); $this->assertArrayHasKey('new2', $attributes); - $this->assertEquals($attributes['new2'], ['val2.1','val2.2']); + $this->assertEquals($attributes['new2'], ['val2.1', 'val2.2']); } /** diff --git a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php index f5cfd5b75383f8a4df557616b59919e276d928a1..01e2a6bee53060c72a1c9a3aae39e8a1b82b1267 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php @@ -42,7 +42,7 @@ class AttributeLimitTest extends TestCase 'Destination' => [ ], 'Source' => [ - 'attributes' => ['cn','mail'], + 'attributes' => ['cn', 'mail'], ], ]; @@ -139,7 +139,7 @@ class AttributeLimitTest extends TestCase 'mail' => ['user@example.org'], ], 'Destination' => [ - 'attributes' => ['cn','mail'], + 'attributes' => ['cn', 'mail'], ], 'Source' => [ ], @@ -242,7 +242,7 @@ class AttributeLimitTest extends TestCase $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); $config = [ - 'eduPersonAffiliation' => ['member','staff'] + 'eduPersonAffiliation' => ['member', 'staff'] ]; $result = self::processFilter($config, self::$request); @@ -259,7 +259,7 @@ class AttributeLimitTest extends TestCase $this->assertCount(0, $attributes); $config = [ - 'eduPersonAffiliation' => ['student','staff'] + 'eduPersonAffiliation' => ['student', 'staff'] ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; @@ -315,7 +315,7 @@ class AttributeLimitTest extends TestCase $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); $config = [ - 'eduPersonAffiliation' => ['ignoreCase' => true, 'membeR','sTaff'] + 'eduPersonAffiliation' => ['ignoreCase' => true, 'membeR', 'sTaff'] ]; $result = self::processFilter($config, self::$request); @@ -332,7 +332,7 @@ class AttributeLimitTest extends TestCase $this->assertCount(0, $attributes); $config = [ - 'eduPersonAffiliation' => ['ignoreCase' => true, 'studeNt','sTaff'] + 'eduPersonAffiliation' => ['ignoreCase' => true, 'studeNt', 'sTaff'] ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; diff --git a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php index 23904bd67cdbb02cb583ab8411d3b2c5cbbae60d..ddf07427342248d0bd30e86c8374cfbe9c44b359 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php @@ -151,7 +151,7 @@ class AttributeValueMapTest extends TestCase $attributes = $result['Attributes']; $this->assertArrayHasKey('memberOf', $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], ['someValue','member']); + $this->assertEquals($attributes['eduPersonAffiliation'], ['someValue', 'member']); } diff --git a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php index aceaf5a09dedcdd69cb47eddd661a3ab3d3e746e..52b29234c3029dcafda913c7673a8c6217395731 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php @@ -169,14 +169,14 @@ class ScopeAttributeTest extends TestCase $request = [ 'Attributes' => [ 'eduPersonPrincipalName' => ['jdoe@example.com'], - 'eduPersonAffiliation' => ['member','staff','faculty'], + 'eduPersonAffiliation' => ['member', 'staff', 'faculty'], ] ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertEquals( $attributes['eduPersonScopedAffiliation'], - ['member@example.com','staff@example.com','faculty@example.com'] + ['member@example.com', 'staff@example.com', 'faculty@example.com'] ); }