public function testRetrieveStatement() { $lrs = new RemoteLRS(self::$endpoint, self::$version, self::$username, self::$password); $saveResponse = $lrs->saveStatement(['actor' => ['mbox' => COMMON_MBOX], 'verb' => ['id' => COMMON_VERB_ID], 'object' => new TinCan\Activity(['id' => COMMON_ACTIVITY_ID])]); if ($saveResponse->success) { $response = $lrs->retrieveStatement($saveResponse->content->getId()); $this->assertInstanceOf('TinCan\\LRSResponse', $response); $this->assertTrue($response->success); $this->assertInstanceOf('TinCan\\Statement', $response->content); } else { // TODO: skipped? throw? } }
public function testRetrieveStatementWithAttachments() { $lrs = new RemoteLRS(self::$endpoint, self::$version, self::$username, self::$password); $content = json_encode(['foo' => 'bar']); $saveResponse = $lrs->saveStatement(['actor' => ['mbox' => COMMON_MBOX], 'verb' => ['id' => COMMON_VERB_ID], 'object' => new TinCan\Activity(['id' => COMMON_ACTIVITY_ID]), 'attachments' => [new TinCan\Attachment(['usageType' => 'http://id.tincanapi.com/attachment/supporting_media', 'display' => ['en-US' => 'Test Display'], 'contentType' => 'application/json', 'content' => $content])]]); $this->assertTrue($saveResponse->success, 'save succeeded'); $response = $lrs->retrieveStatement($saveResponse->content->getId(), ['attachments' => true]); $this->assertInstanceOf('TinCan\\LRSResponse', $response); $this->assertTrue($response->success); $this->assertInstanceOf('TinCan\\Statement', $response->content); $this->assertTrue(count($response->content->getAttachments()) === 1, 'attachment count'); $this->assertSame($content, $response->content->getAttachments()[0]->getContent(), 'attachment content'); }