Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
d26aab7e
Commit
d26aab7e
authored
9 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
Adding missing files
parent
631303c1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
build/integration/.gitignore
+3
-0
3 additions, 0 deletions
build/integration/.gitignore
build/integration/features/bootstrap/FeatureContext.php
+91
-0
91 additions, 0 deletions
build/integration/features/bootstrap/FeatureContext.php
with
94 additions
and
0 deletions
build/integration/.gitignore
0 → 100644
+
3
−
0
View file @
d26aab7e
vendor
output
composer.lock
This diff is collapsed.
Click to expand it.
build/integration/features/bootstrap/FeatureContext.php
0 → 100644
+
91
−
0
View file @
d26aab7e
<?php
use
Behat\Behat\Context\BehatContext
;
use
GuzzleHttp\Client
;
use
GuzzleHttp\Message\ResponseInterface
;
//
// Require 3rd-party libraries here:
//
// require_once 'PHPUnit/Autoload.php';
// require_once 'PHPUnit/Framework/Assert/Functions.php';
//
/**
* Features context.
*/
class
FeatureContext
extends
BehatContext
{
/** @var string */
private
$baseUrl
=
''
;
/** @var ResponseInterface */
private
$response
=
null
;
/** @var string */
private
$currentUser
=
''
;
/** @var int */
private
$apiVersion
=
1
;
/**
* Initializes context.
* Every scenario gets it's own context object.
*
* @param array $parameters context parameters (set them up through behat.yml)
*/
public
function
__construct
(
array
$parameters
)
{
// Initialize your context here
$this
->
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
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment