Move to behat helper library

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-05-25 18:18:07 +02:00
parent 7eb4cdaecb
commit 1b02e7fb25
13 changed files with 128 additions and 307 deletions

View File

@@ -2,12 +2,14 @@
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use JuliusHaertl\NextcloudBehat\Context\ServerContext;
require_once __DIR__ . '/../../vendor/autoload.php';
class CommentContext implements Context {
use RequestTrait;
/** @var ServerContext */
protected $serverContext;
/** @var BoardContext */
protected $boardContext;
@@ -15,6 +17,7 @@ class CommentContext implements Context {
public function gatherContexts(BeforeScenarioScope $scope) {
$environment = $scope->getEnvironment();
$this->serverContext = $environment->getContext(ServerContext::class);
$this->boardContext = $environment->getContext('BoardContext');
}
@@ -23,7 +26,7 @@ class CommentContext implements Context {
*/
public function postACommentWithContentOnTheCard($content) {
$card = $this->boardContext->getLastUsedCard();
$this->requestContext->sendOCSRequest('POST', '/apps/deck/api/v1.0/cards/' . $card['id'] . '/comments', [
$this->serverContext->sendOCSRequest('POST', '/apps/deck/api/v1.0/cards/' . $card['id'] . '/comments', [
'message' => $content,
'parentId' => null
]);