@@ -374,6 +374,44 @@ public function testMoreStatementsWithAttachments() {
374374 $ this ->assertInstanceOf ('TinCan\StatementsResult ' , $ response ->content , 'content ' );
375375 }
376376
377+ public function testRetrieveStatementWithFileUrlAttachments () {
378+ $ lrs = new RemoteLRS (self ::$ endpoint , self ::$ version , self ::$ username , self ::$ password );
379+ $ attachments = new Attachment ();
380+ $ pdfUrl = 'http://www.adlnet.gov/wp-content/uploads/2013/10/xAPI_v1.0.1-2013-10-01.pdf ' ;
381+ // Store Attachments in and retrieve them from the LRS
382+ $ attachments
383+ ->setUsageType ('http://adlnet.gov/expapi/activities/media ' )
384+ ->setDisplay (['en-US ' => 'Test PDF document ' ])
385+ ->setContentType ('application/pdf ' )
386+ ->setLength (filesize ('tests/files/attachment.pdf ' ))
387+ ->setSha2 (hash_file ('sha256 ' , 'tests/files/attachment.pdf ' )) // hash of the attachment data
388+ ->setFileUrl ($ pdfUrl )
389+ ->setDescription (['en-US ' => 'A test document used in an Attachments object example. ' ]);
390+
391+ // Compose statement for sending to the LRS
392+ $ statement = new Statement (
393+ [
394+ 'actor ' => [
395+ 'mbox ' => COMMON_MBOX
396+ ],
397+ 'verb ' => [
398+ 'id ' => COMMON_VERB_ID
399+ ],
400+ 'object ' => new Activity ([
401+ 'id ' => COMMON_ACTIVITY_ID
402+ ])
403+ ]
404+ );
405+ $ statement ->setAttachments ([$ attachments ]);
406+ $ saveResponse = $ lrs ->saveStatement ($ statement );
407+ $ statementResponse = $ lrs ->retrieveStatement ($ saveResponse ->content ->getId (), ['attachments ' => true ]);
408+
409+ $ this ->assertInstanceOf ('TinCan\LRSResponse ' , $ statementResponse );
410+ $ this ->assertTrue ($ statementResponse ->success );
411+ $ this ->assertInstanceOf ('TinCan\Statement ' , $ statementResponse ->content );
412+ $ this ->assertEquals ($ pdfUrl , $ statementResponse ->content ->getAttachments ()[0 ]->getFileUrl ());
413+ }
414+
377415 public function testRetrieveStateIds () {
378416 $ lrs = new RemoteLRS (self ::$ endpoint , self ::$ version , self ::$ username , self ::$ password );
379417 $ response = $ lrs ->retrieveStateIds (
0 commit comments