Skip to content

Commit 2bee590

Browse files
committed
Test only: minor statement tests around ids
1 parent 9cba2f3 commit 2bee590

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

tests/RemoteLRSTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,29 @@ public function testSaveStatement() {
8080
$this->assertSame($response->content, $statement, 'content');
8181
}
8282

83+
public function testSaveStatementStamped() {
84+
$lrs = new RemoteLRS(self::$endpoint, self::$version, self::$username, self::$password);
85+
$statement = new Statement(
86+
[
87+
'actor' => [
88+
'mbox' => COMMON_MBOX
89+
],
90+
'verb' => [
91+
'id' => COMMON_VERB_ID
92+
],
93+
'object' => new Activity([
94+
'id' => COMMON_ACTIVITY_ID
95+
])
96+
]
97+
);
98+
$statement->stamp();
99+
100+
$response = $lrs->saveStatement($statement);
101+
$this->assertInstanceOf('TinCan\LRSResponse', $response);
102+
$this->assertTrue($response->success, 'success');
103+
$this->assertSame($response->content, $statement, 'content');
104+
}
105+
83106
public function testSaveStatements() {
84107
$lrs = new RemoteLRS(self::$endpoint, self::$version, self::$username, self::$password);
85108
$statements = [

tests/StatementTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ public function testFromJSONInvalidMalformed() {
7070
$obj = Statement::fromJSON('{id:"some value"}');
7171
}
7272

73+
public function testConstructionFromArrayWithId() {
74+
$id = Util::getUUID();
75+
$cfg = [
76+
'id' => $id,
77+
'actor' => [
78+
'mbox' => COMMON_MBOX,
79+
],
80+
'verb' => [
81+
'id' => COMMON_VERB_ID,
82+
],
83+
'object' => [
84+
'id' => COMMON_ACTIVITY_ID,
85+
],
86+
];
87+
$obj = new Statement($cfg);
88+
89+
$this->assertSame($obj->getId(), $id, 'id');
90+
}
91+
7392
public function testStamp() {
7493
$obj = new Statement();
7594
$obj->stamp();

0 commit comments

Comments
 (0)