From 80ca03081ec9f93859ad42feafb44557e53d2385 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Mon, 30 Aug 2021 21:31:03 +0200 Subject: [PATCH] Raise coverage --- tests/lib/SimpleSAML/Store/RedisStoreTest.php | 1 - tests/lib/SimpleSAML/Store/SQLStoreTest.php | 1 - .../lib/SimpleSAML/Store/StoreFactoryTest.php | 22 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/lib/SimpleSAML/Store/RedisStoreTest.php b/tests/lib/SimpleSAML/Store/RedisStoreTest.php index 94b5560a2..7bc70076f 100644 --- a/tests/lib/SimpleSAML/Store/RedisStoreTest.php +++ b/tests/lib/SimpleSAML/Store/RedisStoreTest.php @@ -7,7 +7,6 @@ namespace SimpleSAML\Test\Store; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\MockObject\MockObject; use Predis\Client; -use ReflectionClass; use SimpleSAML\Configuration; use SimpleSAML\Store; use SimpleSAML\Store\StoreFactory; diff --git a/tests/lib/SimpleSAML/Store/SQLStoreTest.php b/tests/lib/SimpleSAML/Store/SQLStoreTest.php index b6166ae3f..d8e43b732 100644 --- a/tests/lib/SimpleSAML/Store/SQLStoreTest.php +++ b/tests/lib/SimpleSAML/Store/SQLStoreTest.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace SimpleSAML\Test\Store; use PHPUnit\Framework\TestCase; -use ReflectionClass; use SimpleSAML\Configuration; use SimpleSAML\Store; use SimpleSAML\Store\StoreFactory; diff --git a/tests/lib/SimpleSAML/Store/StoreFactoryTest.php b/tests/lib/SimpleSAML/Store/StoreFactoryTest.php index 756864211..e1f332831 100644 --- a/tests/lib/SimpleSAML/Store/StoreFactoryTest.php +++ b/tests/lib/SimpleSAML/Store/StoreFactoryTest.php @@ -4,7 +4,9 @@ declare(strict_types=1); namespace SimpleSAML\Test; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +use Predis\Client; use ReflectionClass; use SimpleSAML\Configuration; use SimpleSAML\Error\CriticalConfigurationError; @@ -65,6 +67,26 @@ class StoreFactoryTest extends TestCase } + /** + * @test + */ + public function redisStore(): void + { + Configuration::loadFromArray([ + 'store.type' => 'redis', + 'store.redis.prefix' => 'phpunit_', + ], '[ARRAY]', 'simplesaml'); + + $store = StoreFactory::getInstance(); + $store->redis = $this->getMockBuilder(Client::class) + ->setMethods(['get', 'set', 'setex', 'del', 'disconnect', '__destruct']) + ->disableOriginalConstructor() + ->getMock(); + + $this->assertInstanceOf(Store\RedisStore::class, $store); + } + + /** * @test */ -- GitLab