/** * Validates hash */ protected function guardValidHash() { $hash = $this->params()->fromRoute('hash'); if (!$hash || $this->config->getHash() != $hash) { throw new RuntimeException(sprintf('Invalid hash: %s', $hash)); } }
/** * @param $route * @param array $params * @param array $options * * @return string */ public function buildRoute($route, $params = [], $options = []) { $params['hash'] = $this->config->getHash(); $options['name'] = $route; $options['force_canonical'] = true; $options['uri'] = $this->uri; return $this->router->assemble($params, $options); }
/** * @test */ public function it_should_convert_config_to_options() { $this->assertEquals($this->config->getApi()->getUserId(), 'userid'); $this->assertEquals($this->config->getApi()->getUserKey(), 'userkey'); $this->assertEquals($this->config->getNotify()->getFormat(), 'xml'); $this->assertEquals($this->config->getNotify()->getNotifyRoute(), 'encodingcom/notify'); $this->assertEquals($this->config->getNotify()->getNotifyService(), 'custom-notify-service-key'); $this->assertEquals($this->config->getLocalTunnel()->isEnabled(), false); $this->assertEquals($this->config->getLocalTunnel()->getHost(), 'subdomain.ngrok.com'); $this->assertEquals($this->config->getHash(), 'hash'); }