From d26aab7e05cde33265fe857b92a1d0faa80ea6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Aug 2015 15:47:21 +0200 Subject: [PATCH] Adding missing files --- build/integration/.gitignore | 3 + .../features/bootstrap/FeatureContext.php | 91 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 build/integration/.gitignore create mode 100644 build/integration/features/bootstrap/FeatureContext.php diff --git a/build/integration/.gitignore b/build/integration/.gitignore new file mode 100644 index 0000000000..18b981bf7e --- /dev/null +++ b/build/integration/.gitignore @@ -0,0 +1,3 @@ +vendor +output +composer.lock diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php new file mode 100644 index 0000000000..e1185debbc --- /dev/null +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -0,0 +1,91 @@ +baseUrl = $parameters['baseUrl']; + $this->adminUser = $parameters['admin']; + } + + /** + * @When /^sending "([^"]*)" to "([^"]*)"$/ + */ + public function sendingTo($verb, $url) { + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php" . $url; + $client = new Client(); + // TODO: get admin user from config + $options = []; + if ($this->currentUser === 'admin') { + $options['auth'] = $this->adminUser; + } + + try { + $this->response = $client->send($client->createRequest($verb, $fullUrl, $options)); + } catch (\GuzzleHttp\Exception\ClientException $ex) { + $this->response = $ex->getResponse(); + } + } + + /** + * @Then /^the status code should be "([^"]*)"$/ + */ + public function theStatusCodeShouldBe($statusCode) { + PHPUnit_Framework_Assert::assertEquals($statusCode, $this->response->getStatusCode()); + } + + /** + * @Given /^As an "([^"]*)"$/ + */ + public function asAn($user) { + $this->currentUser = $user; + } + + /** + * @Given /^using api version "([^"]*)"$/ + */ + public function usingApiVersion($version) { + $this->apiVersion = $version; + } + + /** + * @Given /^user "([^"]*)" exists$/ + */ + public function userExists($user) { + throw new \Behat\Behat\Exception\PendingException(); + } + +}