1
tests/data/test.txt
Normal file
1
tests/data/test.txt
Normal file
@@ -0,0 +1 @@
|
||||
Hello world
|
||||
@@ -4,9 +4,11 @@ default:
|
||||
paths:
|
||||
- '%paths.base%/../features/'
|
||||
contexts:
|
||||
- FeatureContext:
|
||||
- ServerContext:
|
||||
baseUrl: http://localhost:8080/index.php/ocs/
|
||||
admin:
|
||||
- admin
|
||||
- admin
|
||||
regular_user_password: 123456
|
||||
regular_user_password: 123456
|
||||
- BoardContext:
|
||||
baseUrl: http://localhost:8080/
|
||||
|
||||
@@ -10,27 +10,36 @@ Feature: acl
|
||||
And group "group1" exists
|
||||
Given user "user1" belongs to group "group1"
|
||||
|
||||
Scenario: Request the main frontend page
|
||||
Given Logging in using web as "user0"
|
||||
When Sending a "GET" to "/index.php/apps/deck" without requesttoken
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
Scenario: Fetch the board list
|
||||
Given Logging in using web as "user0"
|
||||
When Sending a "GET" to "/index.php/apps/deck/boards" with requesttoken
|
||||
Then the HTTP status code should be "200"
|
||||
And the Content-Type should be "application/json; charset=utf-8"
|
||||
When fetching the board list
|
||||
Then the response should have a status code "200"
|
||||
And the response Content-Type should be "application/json; charset=utf-8"
|
||||
|
||||
Scenario: Fetch board details of owned board
|
||||
Given Logging in using web as "admin"
|
||||
And creates a board named "MyPrivateAdminBoard" with color "fafafa"
|
||||
When "admin" fetches the board named "MyPrivateAdminBoard"
|
||||
Then the HTTP status code should be "200"
|
||||
And the Content-Type should be "application/json; charset=utf-8"
|
||||
When fetches the board named "MyPrivateAdminBoard"
|
||||
Then the response should have a status code "200"
|
||||
And the response Content-Type should be "application/json; charset=utf-8"
|
||||
|
||||
Scenario: Fetch board details of an other users board
|
||||
Given Logging in using web as "admin"
|
||||
And creates a board named "MyPrivateAdminBoard" with color "fafafa"
|
||||
When "user0" fetches the board named "MyPrivateAdminBoard"
|
||||
Then the HTTP status code should be "403"
|
||||
And the Content-Type should be "application/json; charset=utf-8"
|
||||
Given Logging in using web as "user0"
|
||||
When fetches the board named "MyPrivateAdminBoard"
|
||||
Then the response should have a status code "403"
|
||||
And the response Content-Type should be "application/json; charset=utf-8"
|
||||
|
||||
Scenario: Share a board
|
||||
Given Logging in using web as "user0"
|
||||
And creates a board named "Shared board" with color "fafafa"
|
||||
And shares the board with user "user1"
|
||||
Then the HTTP status code should be "200"
|
||||
Given Logging in using web as "user1"
|
||||
When fetches the board named "Shared board"
|
||||
And the current user should have read permissions on the board
|
||||
And the current user should have write permissions on the board
|
||||
And the current user should have share permissions on the board
|
||||
And the current user should have manage permissions on the board
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
125
tests/integration/features/bootstrap/BoardContext.php
Normal file
125
tests/integration/features/bootstrap/BoardContext.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Client;
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
class BoardContext implements Context {
|
||||
use RequestTrait;
|
||||
|
||||
/** @var array Last board response */
|
||||
private $board = null;
|
||||
/** @var array last stack response */
|
||||
private $stack = null;
|
||||
/** @var array last card response */
|
||||
private $card = null;
|
||||
|
||||
/**
|
||||
* @Given /^creates a board named "([^"]*)" with color "([^"]*)"$/
|
||||
*/
|
||||
public function createsABoardNamedWithColor($title, $color) {
|
||||
$this->sendJSONrequest('POST', '/index.php/apps/deck/boards', [
|
||||
'title' => $title,
|
||||
'color' => $color
|
||||
]);
|
||||
$this->response->getBody()->seek(0);
|
||||
$this->board = json_decode((string)$this->response->getBody(), true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^fetches the board named "([^"]*)"$/
|
||||
*/
|
||||
public function fetchesTheBoardNamed($boardName) {
|
||||
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards/' . $this->board['id'], []);
|
||||
$this->response->getBody()->seek(0);
|
||||
$this->board = json_decode((string)$this->response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When shares the board with user :user
|
||||
*/
|
||||
public function sharesTheBoardWithUser($user)
|
||||
{
|
||||
$this->sendJSONrequest('POST', '/index.php/apps/deck/boards/' . $this->board['id'] . '/acl', [
|
||||
'type' => 0,
|
||||
'participant' => $user,
|
||||
'permissionEdit' => true,
|
||||
'permissionShare' => true,
|
||||
'permissionManage' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @When /^fetching the board list$/
|
||||
*/
|
||||
public function fetchingTheBoardList() {
|
||||
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards');
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^fetching the board with id "([^"]*)"$/
|
||||
*/
|
||||
public function fetchingTheBoardWithId($id) {
|
||||
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards/' . $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^create a stack named "([^"]*)"$/
|
||||
*/
|
||||
public function createAStackNamed($name) {
|
||||
$this->sendJSONrequest('POST', '/index.php/apps/deck/stacks', [
|
||||
'title' => $name,
|
||||
'boardId' => $this->board['id']
|
||||
]);
|
||||
$this->response->getBody()->seek(0);
|
||||
$this->stack = json_decode((string)$this->response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^create a card named "([^"]*)"$/
|
||||
*/
|
||||
public function createACardNamed($name) {
|
||||
$this->sendJSONrequest('POST', '/index.php/apps/deck/cards', [
|
||||
'title' => $name,
|
||||
'stackId' => $this->stack['id']
|
||||
]);
|
||||
$this->response->getBody()->seek(0);
|
||||
$this->card = json_decode((string)$this->response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have read permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveReadPermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_READ']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have write permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveWritePermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_EDIT']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have share permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveSharePermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_SHARE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have manage permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveManagePermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_MANAGE']);
|
||||
}
|
||||
|
||||
}
|
||||
96
tests/integration/features/bootstrap/CardContext.php
Normal file
96
tests/integration/features/bootstrap/CardContext.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Client;
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
class BoardContext implements Context {
|
||||
use RequestTrait;
|
||||
|
||||
/** @var array Last board response */
|
||||
private $board = null;
|
||||
|
||||
/**
|
||||
* @Given /^creates a board named "([^"]*)" with color "([^"]*)"$/
|
||||
*/
|
||||
public function createsABoardNamedWithColor($title, $color) {
|
||||
$this->sendJSONrequest('POST', '/index.php/apps/deck/boards', [
|
||||
'title' => $title,
|
||||
'color' => $color
|
||||
]);
|
||||
$this->response->getBody()->seek(0);
|
||||
$this->board = json_decode((string)$this->response->getBody(), true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^fetches the board named "([^"]*)"$/
|
||||
*/
|
||||
public function fetchesTheBoardNamed($boardName) {
|
||||
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards/' . $this->board['id'], []);
|
||||
$this->response->getBody()->seek(0);
|
||||
$this->board = json_decode((string)$this->response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When shares the board with user :user
|
||||
*/
|
||||
public function sharesTheBoardWithUser($user)
|
||||
{
|
||||
$this->sendJSONrequest('POST', '/index.php/apps/deck/boards/' . $this->board['id'] . '/acl', [
|
||||
'type' => 0,
|
||||
'participant' => $user,
|
||||
'permissionEdit' => true,
|
||||
'permissionShare' => true,
|
||||
'permissionManage' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have read permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveReadPermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_READ']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have write permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveWritePermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_EDIT']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have share permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveSharePermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_SHARE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the current user should have manage permissions on the board$/
|
||||
*/
|
||||
public function theCurrentUserShouldHaveManagePermissionsOnTheBoard() {
|
||||
Assert::assertTrue($this->board['permissions']['PERMISSION_MANAGE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^fetching the board list$/
|
||||
*/
|
||||
public function fetchingTheBoardList() {
|
||||
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards');
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^fetching the board with id "([^"]*)"$/
|
||||
*/
|
||||
public function fetchingTheBoardWithId($id) {
|
||||
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards/' . $id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Client;
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
class FeatureContext implements Context {
|
||||
use WebDav;
|
||||
|
||||
/** @var string */
|
||||
private $mappedUserId;
|
||||
|
||||
private $lastInsertIds = [];
|
||||
|
||||
/**
|
||||
* @BeforeSuite
|
||||
*/
|
||||
public static function addFilesToSkeleton() {
|
||||
}
|
||||
/**
|
||||
* @When :user requests the deck list
|
||||
*/
|
||||
/**
|
||||
* @When Sending a :method to :url with JSON
|
||||
*/
|
||||
public function sendingAToWithJSON($method, $url, \Behat\Gherkin\Node\PyStringNode $data) {
|
||||
$this->sendJSONrequest($method, $url, json_decode($data));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @When :user creates a new deck with name :name
|
||||
*/
|
||||
public function createsANewDeckWithName($user, $content) {
|
||||
$client = new GuzzleHttp\Client();
|
||||
$this->response = $client->post(
|
||||
'http://localhost:8080/index.php/apps/deck/boards',
|
||||
[
|
||||
'form_params' => [
|
||||
'name' => $name,
|
||||
],
|
||||
'auth' => [
|
||||
$this->mappedUserId,
|
||||
'test',
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should have a status code :code
|
||||
* @param string $code
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function theResponseShouldHaveAStatusCode($code) {
|
||||
$currentCode = $this->response->getStatusCode();
|
||||
if ($currentCode !== (int)$code) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf(
|
||||
'Expected %s as code got %s',
|
||||
$code,
|
||||
$currentCode
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should be a JSON array with the following mandatory values
|
||||
* @param TableNode $table
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function theResponseShouldBeAJsonArrayWithTheFollowingMandatoryValues(TableNode $table) {
|
||||
$expectedValues = $table->getColumnsHash();
|
||||
$realResponseArray = json_decode($this->response->getBody()->getContents(), true);
|
||||
|
||||
foreach ($expectedValues as $value) {
|
||||
if ((string)$realResponseArray[$value['key']] !== (string)$value['value']) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf(
|
||||
'Expected %s for key %s got %s',
|
||||
(string)$value['value'],
|
||||
$value['key'],
|
||||
(string)$realResponseArray[$value['key']]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should be a JSON array with a length of :length
|
||||
* @param int $length
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function theResponseShouldBeAJsonArrayWithALengthOf($length) {
|
||||
$realResponseArray = json_decode($this->response->getBody()->getContents(), true);
|
||||
PHPUnit_Framework_Assert::assertEquals($realResponseArray, "foo");
|
||||
if ((int)count($realResponseArray) !== (int)$length) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf(
|
||||
'Expected %d as length got %d',
|
||||
$length,
|
||||
count($realResponseArray)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should get:$/
|
||||
*
|
||||
* @param PyStringNode $string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function iShouldGet(PyStringNode $string) {
|
||||
if ((string) $string !== trim($this->cliOutput)) {
|
||||
throw new Exception(sprintf(
|
||||
'Expected "%s" but received "%s".',
|
||||
$string,
|
||||
$this->cliOutput
|
||||
));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private function sendJSONrequest($method, $url, $data) {
|
||||
$baseUrl = substr($this->baseUrl, 0, -5);
|
||||
|
||||
$client = new Client;
|
||||
try {
|
||||
$this->response = $client->request(
|
||||
$method,
|
||||
$baseUrl . $url,
|
||||
[
|
||||
'cookies' => $this->cookieJar,
|
||||
'json' => $data,
|
||||
'headers' => [
|
||||
'requesttoken' => $this->requestToken
|
||||
]
|
||||
]
|
||||
);
|
||||
} catch (ClientException $e) {
|
||||
$this->response = $e->getResponse();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^creates a board named "([^"]*)" with color "([^"]*)"$/
|
||||
*/
|
||||
public function createsABoardNamedWithColor($title, $color) {
|
||||
$this->sendJSONrequest('POST', '/index.php/apps/deck/boards', [
|
||||
'title' => $title,
|
||||
'color' => $color
|
||||
]
|
||||
);
|
||||
$response = json_decode($this->response->getBody()->getContents(), true);
|
||||
$this->lastInsertIds[$title] = $response['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^"([^"]*)" fetches the board named "([^"]*)"$/
|
||||
*/
|
||||
public function fetchesTheBoardNamed($user, $boardName) {
|
||||
$this->loggingInUsingWebAs($user);
|
||||
$id = $this->lastInsertIds[$boardName];
|
||||
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards/'.$id, []);
|
||||
}
|
||||
}
|
||||
127
tests/integration/features/bootstrap/RequestTrait.php
Normal file
127
tests/integration/features/bootstrap/RequestTrait.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Client;
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use GuzzleHttp\Cookie\CookieJar;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
trait RequestTrait {
|
||||
|
||||
private $baseUrl;
|
||||
private $adminUser;
|
||||
private $regularUser;
|
||||
private $cookieJar;
|
||||
|
||||
private $response;
|
||||
|
||||
public function __construct($baseUrl, $admin = 'admin', $regular_user_password = '123456') {
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->adminUser = $admin;
|
||||
$this->regularUser = $regular_user_password;
|
||||
}
|
||||
|
||||
/** @var ServerContext */
|
||||
private $serverContext;
|
||||
|
||||
/** @BeforeScenario */
|
||||
public function gatherContexts(BeforeScenarioScope $scope)
|
||||
{
|
||||
$environment = $scope->getEnvironment();
|
||||
|
||||
$this->serverContext = $environment->getContext('ServerContext');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should have a status code :code
|
||||
* @param string $code
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function theResponseShouldHaveStatusCode($code) {
|
||||
$currentCode = $this->response->getStatusCode();
|
||||
if ($currentCode !== (int)$code) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf(
|
||||
'Expected %s as code got %s',
|
||||
$code,
|
||||
$currentCode
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the response Content-Type should be "([^"]*)"$/
|
||||
* @param string $contentType
|
||||
*/
|
||||
public function theResponseContentTypeShouldbe($contentType) {
|
||||
Assert::assertEquals($contentType, $this->response->getHeader('Content-Type')[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should be a JSON array with the following mandatory values
|
||||
* @param TableNode $table
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function theResponseShouldBeAJsonArrayWithTheFollowingMandatoryValues(TableNode $table) {
|
||||
$this->response->getBody()->seek(0);
|
||||
$expectedValues = $table->getColumnsHash();
|
||||
$realResponseArray = json_decode($this->response->getBody()->getContents(), true);
|
||||
foreach ($expectedValues as $value) {
|
||||
if ((string)$realResponseArray[$value['key']] !== (string)$value['value']) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf(
|
||||
'Expected %s for key %s got %s',
|
||||
(string)$value['value'],
|
||||
$value['key'],
|
||||
(string)$realResponseArray[$value['key']]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the response should be a JSON array with a length of :length
|
||||
* @param int $length
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function theResponseShouldBeAJsonArrayWithALengthOf($length) {
|
||||
$this->response->getBody()->seek(0);
|
||||
$realResponseArray = json_decode($this->response->getBody()->getContents(), true);
|
||||
if ((int)count($realResponseArray) !== (int)$length) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf(
|
||||
'Expected %d as length got %d',
|
||||
$length,
|
||||
count($realResponseArray)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function sendJSONrequest($method, $url, $data = []) {
|
||||
|
||||
$client = new Client;
|
||||
try {
|
||||
$this->response = $client->request(
|
||||
$method,
|
||||
$this->baseUrl . $url,
|
||||
[
|
||||
'cookies' => $this->serverContext->getCookieJar(),
|
||||
'json' => $data,
|
||||
'headers' => [
|
||||
'requesttoken' => $this->serverContext->getReqestToken()
|
||||
]
|
||||
]
|
||||
);
|
||||
} catch (ClientException $e) {
|
||||
$this->response = $e->getResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
tests/integration/features/bootstrap/ServerContext.php
Normal file
33
tests/integration/features/bootstrap/ServerContext.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Client;
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use GuzzleHttp\Cookie\CookieJar;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
class ServerContext implements Context {
|
||||
use WebDav;
|
||||
|
||||
/** @var string */
|
||||
private $mappedUserId;
|
||||
|
||||
private $lastInsertIds = [];
|
||||
|
||||
/**
|
||||
* @BeforeSuite
|
||||
*/
|
||||
public static function addFilesToSkeleton() {
|
||||
}
|
||||
|
||||
public function getCookieJar(): CookieJar {
|
||||
return $this->cookieJar;
|
||||
}
|
||||
|
||||
public function getReqestToken(): string {
|
||||
return $this->requestToken;
|
||||
}
|
||||
}
|
||||
@@ -10,27 +10,21 @@ Feature: decks
|
||||
|
||||
Scenario: Fetch the board list
|
||||
Given Logging in using web as "admin"
|
||||
When Sending a "GET" to "/index.php/apps/deck/boards" with requesttoken
|
||||
Then the HTTP status code should be "200"
|
||||
And the Content-Type should be "application/json; charset=utf-8"
|
||||
When fetching the board list
|
||||
Then the response should have a status code "200"
|
||||
And the response Content-Type should be "application/json; charset=utf-8"
|
||||
|
||||
Scenario: Fetch board details of a nonexisting board
|
||||
Given Logging in using web as "admin"
|
||||
When Sending a "GET" to "/index.php/apps/deck/boards/13379" with requesttoken
|
||||
Then the HTTP status code should be "403"
|
||||
And the Content-Type should be "application/json; charset=utf-8"
|
||||
When fetching the board with id "99999999"
|
||||
Then the response should have a status code "403"
|
||||
And the response Content-Type should be "application/json; charset=utf-8"
|
||||
|
||||
Scenario: Create a new board
|
||||
Given Logging in using web as "admin"
|
||||
When Sending a "POST" to "/index.php/apps/deck/boards" with JSON
|
||||
"""
|
||||
{
|
||||
"title": "MyBoard",
|
||||
"color": "000000"
|
||||
}
|
||||
"""
|
||||
Then the HTTP status code should be "200"
|
||||
And the Content-Type should be "application/json; charset=utf-8"
|
||||
When creates a board named "MyBoard" with color "000000"
|
||||
Then the response should have a status code "200"
|
||||
And the response Content-Type should be "application/json; charset=utf-8"
|
||||
And the response should be a JSON array with the following mandatory values
|
||||
|key|value|
|
||||
|title|MyBoard|
|
||||
|
||||
19
tests/integration/features/sharing.feature
Normal file
19
tests/integration/features/sharing.feature
Normal file
@@ -0,0 +1,19 @@
|
||||
Feature: File sharing
|
||||
|
||||
Background:
|
||||
Given user "admin" exists
|
||||
And user "user0" exists
|
||||
And user "user1" exists
|
||||
#And user "user2" exists
|
||||
#Given group "group0" exists
|
||||
#And group "group1" exists
|
||||
#Given user "user1" belongs to group "group1"
|
||||
|
||||
Scenario: Share a file with a card
|
||||
Given Logging in using web as "admin"
|
||||
And creates a board named "Shared board" with color "fafafa"
|
||||
And shares the board with user "user1"
|
||||
Then the HTTP status code should be "200"
|
||||
Given Logging in using web as "user1"
|
||||
And create a stack named "Stack"
|
||||
And create a card named "Test"
|
||||
@@ -36,7 +36,7 @@ echo $PHPPID
|
||||
|
||||
export TEST_SERVER_URL="http://localhost:$PORT/ocs/"
|
||||
|
||||
vendor/bin/behat
|
||||
vendor/bin/behat $SCENARIO_TO_RUN
|
||||
RESULT=$?
|
||||
|
||||
kill $PHPPID
|
||||
|
||||
Reference in New Issue
Block a user