From 43ab8b4a2970531fbb4e62b505136d9b8058dd39 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Mon, 30 Aug 2021 20:49:49 +0200 Subject: [PATCH] Cleanup --- lib/SimpleSAML/Store/StoreFactory.php | 2 +- tests/lib/SimpleSAML/Store/RedisStoreTest.php | 16 -------------- tests/lib/SimpleSAML/Store/SQLStoreTest.php | 22 ------------------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/lib/SimpleSAML/Store/StoreFactory.php b/lib/SimpleSAML/Store/StoreFactory.php index d3b0f49cc..f3aa7ea76 100644 --- a/lib/SimpleSAML/Store/StoreFactory.php +++ b/lib/SimpleSAML/Store/StoreFactory.php @@ -70,7 +70,7 @@ abstract class StoreFactory implements Utils\ClearableState $c ); } - /** @var \SimpleSAML\Store|false */ + /** @var \SimpleSAML\Store\StoreInterface|false */ self::$instance = new $className(); } diff --git a/tests/lib/SimpleSAML/Store/RedisStoreTest.php b/tests/lib/SimpleSAML/Store/RedisStoreTest.php index 1a149e27d..94b5560a2 100644 --- a/tests/lib/SimpleSAML/Store/RedisStoreTest.php +++ b/tests/lib/SimpleSAML/Store/RedisStoreTest.php @@ -112,7 +112,6 @@ class RedisStoreTest extends TestCase ], '[ARRAY]', 'simplesaml'); $this->assertInstanceOf(Store\RedisStore::class, $this->store); - $this->clearInstance($config, Configuration::class); } @@ -128,7 +127,6 @@ class RedisStoreTest extends TestCase ], '[ARRAY]', 'simplesaml'); $this->assertInstanceOf(Store\RedisStore::class, $this->store); - $this->clearInstance($config, Configuration::class); } @@ -201,18 +199,4 @@ class RedisStoreTest extends TestCase $this->assertNull($res); } - - - /** - * @param \SimpleSAML\Configuration $service - * @param class-string $className - */ - protected function clearInstance(Configuration $service, string $className): void - { - $reflectedClass = new ReflectionClass($className); - $reflectedInstance = $reflectedClass->getProperty('instance'); - $reflectedInstance->setAccessible(true); - $reflectedInstance->setValue($service, []); - $reflectedInstance->setAccessible(false); - } } diff --git a/tests/lib/SimpleSAML/Store/SQLStoreTest.php b/tests/lib/SimpleSAML/Store/SQLStoreTest.php index 675e112ae..b6166ae3f 100644 --- a/tests/lib/SimpleSAML/Store/SQLStoreTest.php +++ b/tests/lib/SimpleSAML/Store/SQLStoreTest.php @@ -144,26 +144,4 @@ class SQLStoreTest extends TestCase $this->assertNull($value); } - - - /** - */ - protected function tearDown(): void - { - $this->clearInstance(Configuration::getInstance(), Configuration::class); - } - - - /** - * @param \SimpleSAML\Configuration $service - * @param class-string $className - */ - protected function clearInstance(Configuration $service, string $className): void - { - $reflectedClass = new ReflectionClass($className); - $reflectedInstance = $reflectedClass->getProperty('instance'); - $reflectedInstance->setAccessible(true); - $reflectedInstance->setValue($service, []); - $reflectedInstance->setAccessible(false); - } } -- GitLab