getMockBuilder(LoggerInterface::class)->getMock(); $profiler = $this->getMockBuilder(IProfiler::class)->getMock(); $serverVersion = $this->createMock(ServerVersion::class); $factory = new Factory($logger, $profiler, $serverVersion, $localCache, $distributedCache, $lockingCache); $this->assertTrue(is_a($factory->createLocal(), $expectedLocalCache)); $this->assertTrue(is_a($factory->createDistributed(), $expectedDistributedCache)); $this->assertTrue(is_a($factory->createLocking(), $expectedLockingCache)); } #[\PHPUnit\Framework\Attributes\DataProvider('cacheUnavailableProvider')] public function testCacheNotAvailableException($localCache, $distributedCache): void { $this->expectException(HintException::class); $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $profiler = $this->getMockBuilder(IProfiler::class)->getMock(); $serverVersion = $this->createMock(ServerVersion::class); new Factory($logger, $profiler, $serverVersion, $localCache, $distributedCache); } public function testCreateInMemory(): void { $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $profiler = $this->getMockBuilder(IProfiler::class)->getMock(); $serverVersion = $this->createMock(ServerVersion::class); $factory = new Factory($logger, $profiler, $serverVersion, null, null, null); $cache = $factory->createInMemory(); $cache->set('test', 48); self::assertSame(48, $cache->get('test')); } }