@@ -20,6 +20,7 @@ trait WebDav {
2020 /** @var int */
2121 private $ storedFileID = null ;
2222 private array $ trashedFiles = [];
23+ protected array $ lastShareData = [];
2324
2425 /**
2526 * @Given /^using dav path "([^"]*)"$/
@@ -141,7 +142,7 @@ public function downloadFileWithRange($fileSource, $range) {
141142 * @param string $range
142143 */
143144 public function downloadPublicFileWithRange ($ range ) {
144- $ token = $ this ->lastShareData -> data -> token ;
145+ $ token = $ this ->lastShareData [ ' token ' ] ;
145146 $ fullUrl = $ this ->baseUrl . 'public.php/webdav ' ;
146147
147148 $ client = new GClient ();
@@ -151,15 +152,19 @@ public function downloadPublicFileWithRange($range) {
151152 'Range ' => $ range
152153 ];
153154
154- $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
155+ try {
156+ $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
157+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
158+ $ this ->response = $ e ->getResponse ();
159+ }
155160 }
156161
157162 /**
158163 * @When /^Downloading last public shared file inside a folder "([^"]*)" with range "([^"]*)"$/
159164 * @param string $range
160165 */
161166 public function downloadPublicFileInsideAFolderWithRange ($ path , $ range ) {
162- $ token = $ this ->lastShareData -> data -> token ;
167+ $ token = $ this ->lastShareData [ ' token ' ] ;
163168 $ fullUrl = $ this ->baseUrl . 'public.php/webdav ' . "$ path " ;
164169
165170 $ client = new GClient ();
@@ -170,7 +175,11 @@ public function downloadPublicFileInsideAFolderWithRange($path, $range) {
170175 ];
171176 $ options ['auth ' ] = [$ token , '' ];
172177
173- $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
178+ try {
179+ $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
180+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
181+ $ this ->response = $ e ->getResponse ();
182+ }
174183 }
175184
176185 /**
@@ -190,8 +199,13 @@ public function downloadedContentShouldBe($content) {
190199 */
191200 public function checkPropForFile ($ file , $ prefix , $ prop , $ value ) {
192201 $ elementList = $ this ->propfindFile ($ this ->currentUser , $ file , "< $ prefix: $ prop/> " );
193- $ property = $ elementList ['/ ' . $ this ->getDavFilesPath ($ this ->currentUser ) . $ file ][200 ]["{DAV:} $ prop " ];
194- Assert::assertEquals ($ property , $ value );
202+ if ($ prefix === 'oc ' ) {
203+ $ prefix = '{http://owncloud.org/ns} ' ;
204+ } else {
205+ $ prefix = '{DAV:} ' ;
206+ }
207+ $ property = $ elementList ['/ ' . $ this ->getDavFilesPath ($ this ->currentUser ) . $ file ][200 ]["$ prefix$ prop " ];
208+ Assert::assertEquals ($ value , $ property );
195209 }
196210
197211 /**
0 commit comments