summaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap/BasicStructure.php
diff options
context:
space:
mode:
Diffstat (limited to 'build/integration/features/bootstrap/BasicStructure.php')
-rw-r--r--build/integration/features/bootstrap/BasicStructure.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php
index 30d78ebd23a..a8438927731 100644
--- a/build/integration/features/bootstrap/BasicStructure.php
+++ b/build/integration/features/bootstrap/BasicStructure.php
@@ -179,6 +179,27 @@ trait BasicStructure {
}
}
+ public function sendingToWithDirectUrl($verb, $url, $body) {
+ $fullUrl = substr($this->baseUrl, 0, -5) . $url;
+ $client = new Client();
+ $options = [];
+ if ($this->currentUser === 'admin') {
+ $options['auth'] = $this->adminUser;
+ } else {
+ $options['auth'] = [$this->currentUser, $this->regularUser];
+ }
+ if ($body instanceof \Behat\Gherkin\Node\TableNode) {
+ $fd = $body->getRowsHash();
+ $options['body'] = $fd;
+ }
+
+ try {
+ $this->response = $client->send($client->createRequest($verb, $fullUrl, $options));
+ } catch (\GuzzleHttp\Exception\ClientException $ex) {
+ $this->response = $ex->getResponse();
+ }
+ }
+
public function isExpectedUrl($possibleUrl, $finalPart){
$baseUrlChopped = substr($this->baseUrl, 0, -4);
$endCharacter = strlen($baseUrlChopped) + strlen($finalPart);
@@ -321,6 +342,16 @@ trait BasicStructure {
}
/**
+ * @When User :user empties trashbin
+ * @param string $user
+ */
+ public function emptyTrashbin($user) {
+ $body = new \Behat\Gherkin\Node\TableNode([['allfiles', 'true'], ['dir', '%2F']]);
+ $this->sendingToWithDirectUrl('POST', "/index.php/apps/files_trashbin/ajax/delete.php", $body);
+ $this->theHTTPStatusCodeShouldBe('200');
+ }
+
+ /**
* @BeforeSuite
*/
public static function addFilesToSkeleton(){