Skip to content

Commit a48b7ba

Browse files
committed
Notificationはコメント以外にもある。
1 parent 01c66ba commit a48b7ba

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

src/lib/Models/Comment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Takuya\BacklogApiClient\Models\Traits\HasIssueId;
88
use Takuya\BacklogApiClient\Models\User;
99
use Takuya\BacklogApiClient\Models\Star;
10-
use Takuya\BacklogApiClient\Models\CommentNotification;
10+
use Takuya\BacklogApiClient\Models\Notification;
1111
class Comment extends BaseModel {
1212

1313
use HasID;
@@ -21,6 +21,6 @@ class Comment extends BaseModel {
2121
public string $updated;
2222
/** @var array | Star[] */
2323
public array $stars;
24-
/** @var array | CommentNotification[] */
24+
/** @var array | Notification[] */
2525
public array $notifications;
2626
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @property-read object $user
1515
* @property-read bool $resourceAlreadyRead
1616
*/
17-
class CommentNotification extends BaseModel {
17+
class Notification extends BaseModel {
1818

1919
/**
2020
* 連番に欠番あり。

src/lib/Models/Traits/ApiToModelMapping.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Takuya\BacklogApiClient\Models\NulabAccount;
99
use Takuya\BacklogApiClient\Models\IssueAttachment;
1010
use Takuya\BacklogApiClient\Models\SharedFile;
11-
use Takuya\BacklogApiClient\Models\CommentNotification;
11+
use Takuya\BacklogApiClient\Models\Notification;
1212
use Takuya\BacklogApiClient\Models\BaseModel;
1313

1414
trait ApiToModelMapping {
@@ -61,7 +61,7 @@ public static function attribute_mapping_list(): array {
6161
['nulabAccount', NulabAccount::class],
6262
['attachments', IssueAttachment::class],
6363
['sharedFiles', SharedFile::class],
64-
['notifications', CommentNotification::class],
64+
['notifications', Notification::class],
6565
];
6666
return $mapping;
6767
}

tests/Unit/Model/BacklogIssueModelTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Takuya\BacklogApiClient\Models\Issue;
88
use Takuya\BacklogApiClient\Models\Comment;
99
use Takuya\BacklogApiClient\Models\SharedFile;
10-
use Takuya\BacklogApiClient\Models\CommentNotification;
10+
use Takuya\BacklogApiClient\Models\Notification;
1111
use Takuya\BacklogApiClient\Models\IssueAttachment;
1212

1313
class BacklogIssueModelTest extends TestCaseBacklogModels {
@@ -61,11 +61,11 @@ public function test_get_notification_of_issue_comment () {
6161
if ( sizeof( $comment->notifications ) == 0 ) {
6262
continue;
6363
}
64-
/** @var CommentNotification $notification */
64+
/** @var Notification $notification */
6565
foreach ( $comment->notifications as $notification ) {
66-
$this->assertEquals( CommentNotification::class, get_class( $notification ) );
66+
$this->assertEquals( Notification::class, get_class( $notification ) );
6767
$this->assertEquals( User::class, get_class( $notification->user ) );
68-
$this->assertContains( $notification->reason, CommentNotification::REASON );
68+
$this->assertContains( $notification->reason, Notification::REASON );
6969
}
7070
break 3;
7171
}

tests/Unit/Model/MappingTest/RelationTests/RelationToIssueTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Takuya\BacklogApiClient\Models\Issue;
77
use tests\Unit\Model\TestCaseBacklogModels;
88
use Takuya\BacklogApiClient\Models\Comment;
9-
use Takuya\BacklogApiClient\Models\CommentNotification;
9+
use Takuya\BacklogApiClient\Models\Notification;
1010
use Takuya\BacklogApiClient\Models\Traits\RelateToIssue;
1111
use Takuya\BacklogApiClient\Models\CustomFieldSelectedValue;
1212

@@ -26,10 +26,9 @@ public function test_notification_relation_to_issue () {
2626
$api = $this->api_client();
2727
/** @var Issue $issue */
2828
/** @var Comment $comment */
29-
/** @var CommentNotification[] $notifications */
29+
/** @var Notification[] $notifications */
3030
[$notifications, $comment, $issue] = $this->find_comment_notifications();
3131
$this->assertNotEmpty( $notifications );
32-
$this->assertEquals( $notifications[0]->getIssueId(), $issue->id );
3332
// クラスへ封入がAPIレスポンスを破壊してないことの確認
3433
$this->assertEquals(
3534
json_decode( $notifications[0]->toJson() ),

0 commit comments

Comments
 (0)