@@ -207,6 +207,19 @@ public function downloadedContentShouldBe($content) {
207207 Assert::assertEquals ($ content , (string )$ this ->response ->getBody ());
208208 }
209209
210+ /**
211+ * @Then /^File "([^"]*)" should have prop "([^"]*):([^"]*)" equal to "([^"]*)"$/
212+ * @param string $file
213+ * @param string $prefix
214+ * @param string $prop
215+ * @param string $value
216+ */
217+ public function checkPropForFile ($ file , $ prefix , $ prop , $ value ) {
218+ $ elementList = $ this ->propfindFile ($ this ->currentUser , $ file , "< $ prefix: $ prop/> " );
219+ $ property = $ elementList ['/ ' .$ this ->getDavFilesPath ($ this ->currentUser ).$ file ][200 ]["{DAV:} $ prop " ];
220+ Assert::assertEquals ($ property , $ value );
221+ }
222+
210223 /**
211224 * @Then /^Downloaded content when downloading file "([^"]*)" with range "([^"]*)" should be "([^"]*)"$/
212225 * @param string $fileSource
@@ -380,6 +393,30 @@ public function listFolder($user, $path, $folderDepth, $properties = null) {
380393 return $ response ;
381394 }
382395
396+ /* Returns the elements of a report command
397+ * @param string $user
398+ * @param string $path
399+ * @param string $properties properties which needs to be included in the report
400+ * @param string $filterRules filter-rules to choose what needs to appear in the report
401+ */
402+ public function propfindFile ($ user , $ path , $ properties = '' ) {
403+ $ client = $ this ->getSabreClient ($ user );
404+
405+ $ body = '<?xml version="1.0" encoding="utf-8" ?>
406+ <d:propfind xmlns:d="DAV:"
407+ xmlns:oc="http://owncloud.org/ns"
408+ xmlns:nc="http://nextcloud.org/ns"
409+ xmlns:ocs="http://open-collaboration-services.org/ns">
410+ <d:prop>
411+ ' . $ properties . '
412+ </d:prop>
413+ </d:propfind> ' ;
414+
415+ $ response = $ client ->request ('PROPFIND ' , $ this ->makeSabrePath ($ user , $ path ), $ body );
416+ $ parsedResponse = $ client ->parseMultistatus ($ response ['body ' ]);
417+ return $ parsedResponse ;
418+ }
419+
383420 /* Returns the elements of a report command
384421 * @param string $user
385422 * @param string $path
@@ -561,25 +598,28 @@ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $d
561598 * @param string $name3
562599 * @param string $content3
563600 */
564- public function userUploadsChunkedFiles ($ user , $ name1 , $ content1 , $ name2 , $ content2 , $ name3 , $ content3 ) {
601+ public function userUploadsBulkedFiles ($ user , $ name1 , $ content1 , $ name2 , $ content2 , $ name3 , $ content3 ) {
565602 $ boundary = "boundary_azertyuiop " ;
566603
567604 $ body = "" ;
568605 $ body .= '-- ' .$ boundary ."\r\n" ;
569606 $ body .= "X-File-Path: " .$ name1 ."\r\n" ;
570607 $ body .= "X-File-MD5: f6a6263167c92de8644ac998b3c4e4d1 \r\n" ;
608+ $ body .= "X-OC-Mtime: 1111111111 \r\n" ;
571609 $ body .= "Content-Length: " .strlen ($ content1 )."\r\n" ;
572610 $ body .= "\r\n" ;
573611 $ body .= $ content1 ."\r\n" ;
574612 $ body .= '-- ' .$ boundary ."\r\n" ;
575613 $ body .= "X-File-Path: " .$ name2 ."\r\n" ;
576614 $ body .= "X-File-MD5: 87c7d4068be07d390a1fffd21bf1e944 \r\n" ;
615+ $ body .= "X-OC-Mtime: 2222222222 \r\n" ;
577616 $ body .= "Content-Length: " .strlen ($ content2 )."\r\n" ;
578617 $ body .= "\r\n" ;
579618 $ body .= $ content2 ."\r\n" ;
580619 $ body .= '-- ' .$ boundary ."\r\n" ;
581620 $ body .= "X-File-Path: " .$ name3 ."\r\n" ;
582621 $ body .= "X-File-MD5: e86a1cf0678099986a901c79086f5617 \r\n" ;
622+ $ body .= "X-File-Mtime: 3333333333 \r\n" ;
583623 $ body .= "Content-Length: " .strlen ($ content3 )."\r\n" ;
584624 $ body .= "\r\n" ;
585625 $ body .= $ content3 ."\r\n" ;
0 commit comments