Ejemplo n.º 1
0
 public function testConfigOverrides()
 {
     $config = (require __DIR__ . '/data/beaucallongthrottle.local.php');
     $options = new ThrottleOptions($config['beaucallongthrottle']['throttle']);
     $this->assertEquals('separator_another', $options->getSeparator());
     $this->assertEquals('adapter_class_another', $options->getAdapterClass());
     $this->assertEquals('verify_lock_another', $options->getVerifyLock());
 }
 /**
  * @expectedException BeaucalLongThrottle\Exception\OptionException
  * @expectedExceptionMessage Separator is not set
  */
 public function testSeparatorNotSet()
 {
     $dbOptions = new ThrottleDbAdapterOptions();
     $dbOptions->setRegexCounts(['/^whatever/' => 99]);
     $gateway = new TableGateway($dbOptions->getDbTable(), $this->getAdapter());
     $throttleDbAdapter = new ThrottleDbMultipleAdapter($gateway, $dbOptions, new LockHandleFactory());
     $throttleOptions = new ThrottleOptions();
     $throttleOptions->setSeparator('');
     $throttle = new Throttle($throttleDbAdapter, $throttleOptions);
     $throttle->takeLock('ok', new DateTimeUnit(6, 'days'));
 }