Skip to content

Commit

Permalink
Merge pull request #101 from reedmclean/ActivityAndVerbIDs
Browse files Browse the repository at this point in the history
Allow for a verb/activity or its ID when querying for statements
  • Loading branch information
reedmclean authored Dec 17, 2018
2 parents 0abbc06 + d308724 commit 5d620d4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/RemoteLRS.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,12 @@ private function _queryStatementsRequestParams($query) {
) as $k
) {
if (isset($query[$k])) {
$result[$k] = $query[$k]->getId();
if (is_string($query[$k])) {
$result[$k] = $query[$k];
}
else {
$result[$k] = $query[$k]->getId();
}
}
}
foreach (
Expand Down
18 changes: 18 additions & 0 deletions tests/RemoteLRSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,24 @@ public function testQueryStatements() {
$this->assertInstanceOf('TinCan\StatementsResult', $response->content);
}

public function testQueryStatementsWithActivityId() {
$lrs = new RemoteLRS(self::$endpoint, self::$version, self::$username, self::$password);
$response = $lrs->queryStatements(['activity' => COMMON_ACTIVITY_ID]);

$this->assertInstanceOf('TinCan\LRSResponse', $response);
$this->assertTrue($response->success, 'success');
$this->assertInstanceOf('TinCan\StatementsResult', $response->content);
}

public function testQueryStatementsWithVerbId() {
$lrs = new RemoteLRS(self::$endpoint, self::$version, self::$username, self::$password);
$response = $lrs->queryStatements(['verb' => COMMON_VERB_ID]);

$this->assertInstanceOf('TinCan\LRSResponse', $response);
$this->assertTrue($response->success, 'success');
$this->assertInstanceOf('TinCan\StatementsResult', $response->content);
}

public function testQueryStatementsWithAttachments() {
$lrs = new RemoteLRS(self::$endpoint, self::$version, self::$username, self::$password);
$response = $lrs->queryStatements(['limit' => 4, 'attachments' => true]);
Expand Down

0 comments on commit 5d620d4

Please sign in to comment.