summaryrefslogtreecommitdiff
path: root/tests/Unit/Models/User
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Models/User')
-rw-r--r--tests/Unit/Models/User/UserTest.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/Unit/Models/User/UserTest.php b/tests/Unit/Models/User/UserTest.php
index fd8e2396..7f56d0c4 100644
--- a/tests/Unit/Models/User/UserTest.php
+++ b/tests/Unit/Models/User/UserTest.php
@@ -5,6 +5,7 @@ namespace Engelsystem\Test\Unit\Models;
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use Engelsystem\Models\BaseModel;
use Engelsystem\Models\News;
+use Engelsystem\Models\NewsComment;
use Engelsystem\Models\Question;
use Engelsystem\Models\User\Contact;
use Engelsystem\Models\User\HasUserModel;
@@ -149,6 +150,22 @@ class UserTest extends TestCase
}
/**
+ * Tests that accessing the NewsComments of an User works.
+ *
+ * @covers \Engelsystem\Models\User\User::newsComments
+ */
+ public function testNewsComments(): void
+ {
+ ($user = new User($this->data))->save();
+ $newsComment = NewsComment::create(['news_id' => 0, 'text' => 'test comment', 'user_id' => $user->id]);
+ $comments = $user->newsComments;
+
+ $this->assertCount(1, $comments);
+ $comment = $comments->first();
+ $this->assertSame($newsComment->id, $comment->id);
+ }
+
+ /**
* @covers \Engelsystem\Models\User\User::questionsAsked
*/
public function testQuestionsAsked(): void