Move to behat helper library
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -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
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user