public function testGetCountToProcess() { $time = time(); $this->redis->zadd('test', [1 => $time - 5, 2 => $time - 3, 3 => $time + 5]); $pool = new Pool($this->redis, 'test'); $this->assertSame(2, $pool->getCountToProcess()); $this->assertKeys(['test']); }
/** * @param int $processTimeOffset * @param int $expectedCount * * @dataProvider providerGetCountToProcess */ public function testGetCountToProcess($processTimeOffset, $expectedCount) { $this->redis->zadd('test', [1 => self::TIME_MOCK - 10, 2 => self::TIME_MOCK - 5, 3 => self::TIME_MOCK - 3, 4 => self::TIME_MOCK, 5 => self::TIME_MOCK + 5]); $options = [Pool::OPT_PROCESS_TIME_OFFSET => $processTimeOffset]; $pool = new Pool($this->redis, 'test', $options, $this->getTimeMock()); $this->assertSame($expectedCount, $pool->getCountToProcess()); $this->assertKeys(['test']); }