summaryrefslogtreecommitdiff
path: root/tests/Unit/Models/NewsTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2020-01-02 15:08:08 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2020-01-02 15:09:08 +0100
commitd27bcabc8bc0ab41dbd2219519718b11f8f9ce94 (patch)
treeac7f309b332fa59755483309a38ed97cad767644 /tests/Unit/Models/NewsTest.php
parent5c54d4787fbce992658fd6cea61e9522af691a38 (diff)
tests: code coverage cleanup
Diffstat (limited to 'tests/Unit/Models/NewsTest.php')
-rw-r--r--tests/Unit/Models/NewsTest.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/Unit/Models/NewsTest.php b/tests/Unit/Models/NewsTest.php
index 18ca2d9a..ca933686 100644
--- a/tests/Unit/Models/NewsTest.php
+++ b/tests/Unit/Models/NewsTest.php
@@ -47,7 +47,7 @@ class NewsTest extends TestCase
/**
* Tests that creating a News item with default values works.
*
- * @return void
+ * @covers \Engelsystem\Models\News
*/
public function testCreateDefault(): void
{
@@ -61,9 +61,24 @@ class NewsTest extends TestCase
}
/**
+ * Tests that accessing the NewsComments of a News works.
+ *
+ * @covers \Engelsystem\Models\News::comments
+ */
+ public function testNewsComments(): void
+ {
+ $news = (new News())->create($this->newsData);
+ $comment = $news->comments()->create(['text' => 'test comment', 'user_id' => $this->user->id]);
+
+ $comments = $news->comments;
+ $this->assertCount(1, $comments);
+ $this->assertEquals($comment->toArray(), $news->comments->first()->toArray());
+ }
+
+ /**
* Tests that creating a News item with all fill values works.
*
- * @return void
+ * @covers \Engelsystem\Models\News
*/
public function testCreate(): void
{