From c138bc68fd1f16f00310a0525231b7c2e83ce0a4 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Thu, 5 Oct 2023 11:42:59 +0545 Subject: [PATCH] fix steps --- tests/TestHelpers/HttpRequestHelper.php | 2 ++ tests/acceptance/features/bootstrap/WebDav.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/TestHelpers/HttpRequestHelper.php b/tests/TestHelpers/HttpRequestHelper.php index aab62600d..f9b7d39f9 100644 --- a/tests/TestHelpers/HttpRequestHelper.php +++ b/tests/TestHelpers/HttpRequestHelper.php @@ -657,6 +657,8 @@ class HttpRequestHelper { * @return array */ public static function parseResponseAsXml(ResponseInterface $response):array { + // rewind so that we can reparse it if it was parsed already + $response->getBody()->rewind(); $body = $response->getBody()->getContents(); $parsedResponse = []; if ($body && \substr($body, 0, 1) === '<') { diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index b9908dbac..64b59e00e 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -3702,7 +3702,7 @@ trait WebDav { $admin, __METHOD__ . "The provided user is not admin but '" . $admin . "'" ); - $response = $this->createFolder($user, $destination, true); + $response = $this->createFolder($admin, $destination, true); $this->theHTTPStatusCodeShouldBe( ["201", "204"], "HTTP status code was not 201 or 204 while trying to create folder '$destination' for admin '$admin'", @@ -4825,10 +4825,11 @@ trait WebDav { * @throws Exception */ public function theDavElementShouldBe(string $element, string $message):void { + $resXmlArray = HttpRequestHelper::parseResponseAsXml($this->getResponse()); WebDavAssert::assertDavResponseElementIs( $element, $message, - $this->responseXml, + $resXmlArray, __METHOD__ ); }