From d3087244cfdd2778d9b3d14489b12d945145e7ed Mon Sep 17 00:00:00 2001 From: Reed McLean Date: Fri, 24 Aug 2018 16:29:10 -0500 Subject: [PATCH] Allow for a verb/activity or its ID --- src/RemoteLRS.php | 7 ++++++- tests/RemoteLRSTest.php | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/RemoteLRS.php b/src/RemoteLRS.php index 9f47257..7cb428e 100644 --- a/src/RemoteLRS.php +++ b/src/RemoteLRS.php @@ -510,7 +510,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 ( diff --git a/tests/RemoteLRSTest.php b/tests/RemoteLRSTest.php index c41f4cc..177e3f1 100644 --- a/tests/RemoteLRSTest.php +++ b/tests/RemoteLRSTest.php @@ -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]);