Skip to content

Commit dd0f24e

Browse files
committed
Added read attribute to Reply entity
1 parent 381e895 commit dd0f24e

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/PSS/Entities/Reply.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,9 @@ class Reply
2525
* @var array
2626
*/
2727
public $attachments = [];
28+
29+
/**
30+
* @var bool
31+
*/
32+
public $read;
2833
}

src/PSS/ReplyClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ protected function serializeReply($item)
121121
$reply->author = new Entities\Author($item->author);
122122
$reply->description = $item->description;
123123
$reply->createdAt = DateTime::createFromFormat(DateTime::ISO8601, $item->created_at);
124+
$reply->read = $item->read;
124125

125126
foreach ($item->attachments as $attachment) {
126127
$reply->attachments[] = new Entities\Attachment($attachment);

tests/PssClientTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public function gets_replies()
9595
'description' => 'Test',
9696
'created_at' => '2000-01-01T00:00:00+00',
9797
'attachments' => [],
98+
'read' => false,
9899
]],
99100
'meta' => [
100101
'pagination' => [
@@ -125,6 +126,7 @@ public function gets_replies()
125126
$this->assertEquals(1, $reply->id);
126127
$this->assertEquals(1, $reply->author->id);
127128
$this->assertEquals('Jonny Test', $reply->author->name);
129+
$this->assertFalse($reply->read);
128130
$this->assertEquals('Test', $reply->description);
129131
$this->assertInstanceOf(DateTime::class, $reply->createdAt);
130132
$this->assertEquals('2000-01-01 00:00:00', $reply->createdAt->format('Y-m-d H:i:s'));
@@ -153,7 +155,8 @@ public function gets_replies_with_attachments()
153155
[
154156
'name' => 'test-file2.txt',
155157
],
156-
]
158+
],
159+
'read' => true,
157160
]],
158161
'meta' => [
159162
'pagination' => [
@@ -304,6 +307,7 @@ public function gets_one_reply()
304307
'description' => 'test',
305308
'attachments' => [],
306309
'created_at' => '2000-01-01T00:00:00+00',
310+
'read' => true,
307311
],
308312
'meta' => ''
309313
])),
@@ -318,5 +322,6 @@ public function gets_one_reply()
318322
$this->assertEquals('C485939', $reply->id);
319323
$this->assertEquals('test', $reply->description);
320324
$this->assertInstanceOf(DateTime::class, $reply->createdAt);
325+
$this->assertTrue($reply->read);
321326
}
322327
}

0 commit comments

Comments
 (0)