Пример #1
0
 /**
  * @dataProvider providerAddItemsEmpty
  */
 public function testAddItemEmpty($invalidItem = null)
 {
     $queue = new Queue($this->redis, 'test');
     $queue->addItem(1);
     try {
         $queue->addItem($invalidItem);
         $this->fail('Expected \\PhpRQ\\Exception\\InvalidArgument to be thrown');
     } catch (Exception\InvalidArgument $e) {
     }
     $this->assertSame(['1'], $this->redis->lrange('test', 0, 5));
     $this->assertKeys(['test']);
 }
Пример #2
0
 public function testAddItemSync()
 {
     $queue = new Queue($this->redis, 'test', [Base::OPT_SLAVES_SYNC_ENABLED => true, Base::OPT_SLAVES_SYNC_REQUIRED_COUNT => 5]);
     try {
         $queue->addItem(1);
     } catch (\PhpRQ\Exception\NotEnoughSlavesSynced $e) {
     }
     $this->assertSame(['1'], $this->redis->lrange('test', 0, 5));
     $this->assertKeys(['test']);
 }