コード例 #1
0
ファイル: PoolTest.php プロジェクト: jannavratil/php-rq
 /**
  * @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']);
 }
コード例 #2
0
ファイル: PoolSyncTest.php プロジェクト: gitter-badger/php-rq
 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']);
 }