CombinedStore example

public function getStore(): PersistingStoreInterface
    {
        $redis = new \Predis\Client(array_combine(['host', 'port']explode(':', getenv('REDIS_HOST')) + [1 => 6379]));

        try {
            $redis->connect();
        } catch (\Exception $e) {
            self::markTestSkipped($e->getMessage());
        }

        return new CombinedStore([new RedisStore($redis)]new UnanimousStrategy());
    }

    private MockObject&StrategyInterface $strategy;
    private MockObject&BlockingStoreInterface $store1;
    private MockObject&BlockingStoreInterface $store2;
    private CombinedStore $store;

    protected function setUp(): void
    {
        $this->strategy = $this->createMock(StrategyInterface::class);
        $this->store1 = $this->createMock(BlockingStoreInterface::class);
        
Home | Imprint | This part of the site doesn't use cookies.