/** * @dataProvider providerAddItemsEmpty */ public function testAddItemEmpty($emptyItem = null) { $pool = new Pool($this->redis, 'test'); $pool->addItem(1); try { $pool->addItem($emptyItem); $this->fail('Expected \\PhpRQ\\Exception\\InvalidArgument to be thrown'); } catch (Exception\InvalidArgument $e) { } $this->assertSame(['1'], $this->redis->zrange('test', 0, 5)); $this->assertKeys(['test']); }
public function testAddItemSync() { $pool = new Pool($this->redis, 'test', [Base::OPT_SLAVES_SYNC_ENABLED => true, Base::OPT_SLAVES_SYNC_REQUIRED_COUNT => 5], $this->getTimeMock()); try { $pool->addItem(1); } catch (\PhpRQ\Exception\NotEnoughSlavesSynced $e) { } $this->assertSame(['1' => (string) self::TIME_MOCK], $this->redis->zrange('test', 0, 5, 'WITHSCORES')); $this->assertKeys(['test']); }