@@ -442,17 +442,13 @@ public function userUploadsAFileWithContentToUsingTus(
442442 string $ destination
443443 ): void {
444444 $ temporaryFileName = $ this ->writeDataToTempFile ($ content );
445- try {
446- $ this ->uploadFileUsingTus (
447- $ user ,
448- \basename ($ temporaryFileName ),
449- $ destination
450- );
451- $ this ->featureContext ->setLastUploadDeleteTime (\time ());
452- } catch (Exception $ e ) {
453- Assert::assertStringContainsString ('TusPhp\Exception\FileException: Unable to create resource ' , (string )$ e );
454- }
445+ $ response = $ this ->uploadFileUsingTus (
446+ $ user ,
447+ \basename ($ temporaryFileName ),
448+ $ destination
449+ );
455450 \unlink ($ temporaryFileName );
451+ $ this ->featureContext ->setResponse ($ response );
456452 }
457453
458454 /**
@@ -479,7 +475,7 @@ public function userUploadsAFileWithContentInChunksUsingTus(
479475 string $ destination
480476 ): void {
481477 $ temporaryFileName = $ this ->writeDataToTempFile ($ content );
482- $ this ->uploadFileUsingTus (
478+ $ response = $ this ->uploadFileUsingTus (
483479 $ user ,
484480 \basename ($ temporaryFileName ),
485481 $ destination ,
@@ -489,6 +485,7 @@ public function userUploadsAFileWithContentInChunksUsingTus(
489485 );
490486 $ this ->featureContext ->setLastUploadDeleteTime (\time ());
491487 \unlink ($ temporaryFileName );
488+ $ this ->featureContext ->setResponse ($ response );
492489 }
493490
494491 /**
@@ -512,14 +509,19 @@ public function userHasUploadedFileWithMtimeUsingTUS(
512509 $ mtime = new DateTime ($ mtime );
513510 $ mtime = $ mtime ->format ('U ' );
514511 $ user = $ this ->featureContext ->getActualUsername ($ user );
515- $ this ->uploadFileUsingTus (
512+ $ response = $ this ->uploadFileUsingTus (
516513 $ user ,
517514 $ source ,
518515 $ destination ,
519516 null ,
520517 ['mtime ' => $ mtime ]
521518 );
522519 $ this ->featureContext ->setLastUploadDeleteTime (\time ());
520+ $ this ->featureContext ->theHTTPStatusCodeShouldBe (
521+ ["201 " , "204 " ],
522+ "Failed to upload file ' $ source' for user ' $ user' " ,
523+ $ response
524+ );
523525 }
524526
525527 /**
@@ -543,14 +545,15 @@ public function userUploadsFileWithContentToWithMtimeUsingTUS(
543545 $ mtime = new DateTime ($ mtime );
544546 $ mtime = $ mtime ->format ('U ' );
545547 $ user = $ this ->featureContext ->getActualUsername ($ user );
546- $ this ->uploadFileUsingTus (
548+ $ response = $ this ->uploadFileUsingTus (
547549 $ user ,
548550 $ source ,
549551 $ destination ,
550552 null ,
551553 ['mtime ' => $ mtime ]
552554 );
553555 $ this ->featureContext ->setLastUploadDeleteTime (\time ());
556+ $ this ->featureContext ->setResponse ($ response );
554557 }
555558
556559 /**
@@ -628,7 +631,7 @@ public function userUploadsWithCreatesWithUpload(
628631 string $ content
629632 ): void {
630633 $ temporaryFileName = $ this ->writeDataToTempFile ($ content );
631- $ this ->uploadFileUsingTus (
634+ $ response = $ this ->uploadFileUsingTus (
632635 $ user ,
633636 \basename ($ temporaryFileName ),
634637 $ source ,
@@ -639,6 +642,7 @@ public function userUploadsWithCreatesWithUpload(
639642 );
640643 $ this ->featureContext ->setLastUploadDeleteTime (\time ());
641644 \unlink ($ temporaryFileName );
645+ $ this ->featureContext ->setResponse ($ response );
642646 }
643647
644648 /**
0 commit comments