/** * @param string $key * @param DateTime $endDate * @return mixed Lock\Handle or false */ public function setLock($key, DateTime $endDate) { try { $result = $this->gateway->insert(['key' => $key, 'end_datetime' => $endDate->format($this->options->getDbDateTimeFormat())]); if ($result) { return $this->createLockHandle($key); } } catch (\Exception $e) { } return false; }
public function testConfigOverrides() { $config = (require __DIR__ . '/data/beaucallongthrottle.local.php'); $config = $config['beaucallongthrottle']['BeaucalLongThrottle\\Adapter\\Db']; unset($config['options_class']); $options = new DbAdapterOptions($config); $this->assertEquals('use_transactions_another', $options->getUseTransactions()); $this->assertEquals('db_adapter_class_another', $options->getDbAdapterClass()); $this->assertEquals('db_table_another', $options->getDbTable()); $this->assertEquals('db_date_time_format_another', $options->getDbDateTimeFormat()); $this->assertEquals('clear_all_is_cheap_another', $options->getClearAllIsCheap()); }