summaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap/CommentsContext.php
diff options
context:
space:
mode:
Diffstat (limited to 'build/integration/features/bootstrap/CommentsContext.php')
-rw-r--r--build/integration/features/bootstrap/CommentsContext.php53
1 files changed, 26 insertions, 27 deletions
diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php
index 651e8c5eedf..ce05b56689d 100644
--- a/build/integration/features/bootstrap/CommentsContext.php
+++ b/build/integration/features/bootstrap/CommentsContext.php
@@ -52,7 +52,7 @@ class CommentsContext implements \Behat\Behat\Context\Context {
$client = new \GuzzleHttp\Client();
try {
$client->delete(
- $this->baseUrl.'/remote.php/webdav/myFileToComment.txt',
+ $this->baseUrl . '/remote.php/webdav/myFileToComment.txt',
[
'auth' => [
'user0',
@@ -73,7 +73,7 @@ class CommentsContext implements \Behat\Behat\Context\Context {
* @return int
*/
private function getFileIdForPath($path) {
- $url = $this->baseUrl.'/remote.php/webdav/'.$path;
+ $url = $this->baseUrl . '/remote.php/webdav/' . $path;
$context = stream_context_create(array(
'http' => array(
'method' => 'PROPFIND',
@@ -100,10 +100,10 @@ class CommentsContext implements \Behat\Behat\Context\Context {
* @param int $statusCode
* @throws \Exception
*/
- public function postsACommentWithContentOnTheFileNamedItShouldReturn($user, $content, $fileName, $statusCode) {
+ public function postsACommentWithContentOnTheFileNamedItShouldReturn($user, $content, $fileName, $statusCode) {
$fileId = $this->getFileIdForPath($fileName);
$this->fileId = (int)$fileId;
- $url = $this->baseUrl.'/remote.php/dav/comments/files/'.$fileId.'/';
+ $url = $this->baseUrl . '/remote.php/dav/comments/files/' . $fileId . '/';
$client = new \GuzzleHttp\Client();
try {
@@ -124,8 +124,8 @@ class CommentsContext implements \Behat\Behat\Context\Context {
$res = $e->getResponse();
}
- if($res->getStatusCode() !== (int)$statusCode) {
- throw new \Exception("Response status code was not $statusCode (".$res->getStatusCode().")");
+ if ($res->getStatusCode() !== (int)$statusCode) {
+ throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")");
}
}
@@ -139,11 +139,11 @@ class CommentsContext implements \Behat\Behat\Context\Context {
*/
public function asLoadloadAllTheCommentsOfTheFileNamedItShouldReturn($user, $fileName, $statusCode) {
$fileId = $this->getFileIdForPath($fileName);
- $url = $this->baseUrl.'/remote.php/dav/comments/files/'.$fileId.'/';
+ $url = $this->baseUrl . '/remote.php/dav/comments/files/' . $fileId . '/';
try {
$client = new \GuzzleHttp\Client();
- $res = $client->createRequest(
+ $res = $client->request(
'REPORT',
$url,
[
@@ -162,16 +162,15 @@ class CommentsContext implements \Behat\Behat\Context\Context {
],
]
);
- $res = $client->send($res);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$res = $e->getResponse();
}
- if($res->getStatusCode() !== (int)$statusCode) {
- throw new \Exception("Response status code was not $statusCode (".$res->getStatusCode().")");
+ if ($res->getStatusCode() !== (int)$statusCode) {
+ throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")");
}
- if($res->getStatusCode() === 207) {
+ if ($res->getStatusCode() === 207) {
$service = new Sabre\Xml\Service();
$this->response = $service->parse($res->getBody()->getContents());
$this->commentId = (int)$this->response[0]['value'][2]['value'][0]['value'][0]['value'];
@@ -191,11 +190,11 @@ class CommentsContext implements \Behat\Behat\Context\Context {
$options = [];
$options['auth'] = [$user, '123456'];
$fd = $body->getRowsHash();
- $options['body'] = $fd;
+ $options['form_params'] = $fd;
$options['headers'] = [
'OCS-APIREQUEST' => 'true',
];
- $client->send($client->createRequest($verb, $this->baseUrl.'/ocs/v1.php/'.$url, $options));
+ $client->request($verb, $this->baseUrl . '/ocs/v1.php/' . $url, $options);
}
/**
@@ -205,7 +204,7 @@ class CommentsContext implements \Behat\Behat\Context\Context {
* @throws \Exception
*/
public function asDeleteTheCreatedCommentItShouldReturn($user, $statusCode) {
- $url = $this->baseUrl.'/remote.php/dav/comments/files/'.$this->fileId.'/'.$this->commentId;
+ $url = $this->baseUrl . '/remote.php/dav/comments/files/' . $this->fileId . '/' . $this->commentId;
$client = new \GuzzleHttp\Client();
try {
@@ -225,8 +224,8 @@ class CommentsContext implements \Behat\Behat\Context\Context {
$res = $e->getResponse();
}
- if($res->getStatusCode() !== (int)$statusCode) {
- throw new \Exception("Response status code was not $statusCode (".$res->getStatusCode().")");
+ if ($res->getStatusCode() !== (int)$statusCode) {
+ throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")");
}
}
@@ -239,14 +238,14 @@ class CommentsContext implements \Behat\Behat\Context\Context {
public function theResponseShouldContainAPropertyWithValue($key, $value) {
$keys = $this->response[0]['value'][2]['value'][0]['value'];
$found = false;
- foreach($keys as $singleKey) {
- if($singleKey['name'] === '{http://owncloud.org/ns}'.substr($key, 3)) {
- if($singleKey['value'] === $value) {
+ foreach ($keys as $singleKey) {
+ if ($singleKey['name'] === '{http://owncloud.org/ns}' . substr($key, 3)) {
+ if ($singleKey['value'] === $value) {
$found = true;
}
}
}
- if($found === false) {
+ if ($found === false) {
throw new \Exception("Cannot find property $key with $value");
}
}
@@ -257,8 +256,8 @@ class CommentsContext implements \Behat\Behat\Context\Context {
* @throws \Exception
*/
public function theResponseShouldContainOnlyComments($number) {
- if(count($this->response) !== (int)$number) {
- throw new \Exception("Found more comments than $number (".count($this->response).")");
+ if (count($this->response) !== (int)$number) {
+ throw new \Exception("Found more comments than $number (" . count($this->response) . ")");
}
}
@@ -277,18 +276,18 @@ class CommentsContext implements \Behat\Behat\Context\Context {
<d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
<d:set>
<d:prop>
- <oc:message>'.$text.'</oc:message>
+ <oc:message>' . $text . '</oc:message>
</d:prop>
</d:set>
</d:propertyupdate>';
try {
- $res = $client->send($client->createRequest('PROPPATCH', $this->baseUrl.'/remote.php/dav/comments/files/' . $this->fileId . '/' . $this->commentId, $options));
+ $res = $client->request('PROPPATCH', $this->baseUrl . '/remote.php/dav/comments/files/' . $this->fileId . '/' . $this->commentId, $options);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$res = $e->getResponse();
}
- if($res->getStatusCode() !== (int)$statusCode) {
- throw new \Exception("Response status code was not $statusCode (".$res->getStatusCode().")");
+ if ($res->getStatusCode() !== (int)$statusCode) {
+ throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")");
}
}