diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2020-01-02 15:08:08 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2020-01-02 15:09:08 +0100 |
commit | d27bcabc8bc0ab41dbd2219519718b11f8f9ce94 (patch) | |
tree | ac7f309b332fa59755483309a38ed97cad767644 /tests/Unit/Models/User | |
parent | 5c54d4787fbce992658fd6cea61e9522af691a38 (diff) |
tests: code coverage cleanup
Diffstat (limited to 'tests/Unit/Models/User')
-rw-r--r-- | tests/Unit/Models/User/UserTest.php | 17 |
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 |