summaryrefslogtreecommitdiff
path: root/tests/Unit/Models/News/NewsTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2019-11-10 21:30:26 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2019-11-10 22:10:11 +0100
commitb878740f80ce7cfe2a0bc53956e3f7e4e0aa2f78 (patch)
tree4003b59c5ea2a731f8881711b95e2b736ae04626 /tests/Unit/Models/News/NewsTest.php
parent6534191d59521e1e5a88638b1c6a1c77f74dd12a (diff)
News: Bug fixes, cleanup, comments & formatting
Use more magically available methods and properties Fixed atom feed and stats not using the new model
Diffstat (limited to 'tests/Unit/Models/News/NewsTest.php')
-rw-r--r--tests/Unit/Models/News/NewsTest.php80
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/Unit/Models/News/NewsTest.php b/tests/Unit/Models/News/NewsTest.php
deleted file mode 100644
index 7309c0b0..00000000
--- a/tests/Unit/Models/News/NewsTest.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-declare(strict_types=1);
-
-use Engelsystem\Models\News\News;
-use Engelsystem\Models\User\User;
-use Engelsystem\Test\Unit\HasDatabase;
-use Engelsystem\Test\Unit\TestCase;
-
-/**
- * This class provides tests for the News model.
- */
-class NewsTest extends TestCase
-{
- use HasDatabase;
-
- /**
- * @var array
- */
- private $newsData;
-
- /**
- * @var User
- */
- private $user;
-
- /**
- * @return void
- */
- protected function setUp(): void
- {
- parent::setUp();
- $this->initDatabase();
-
- $this->user = User::make([
- 'name' => 'lorem',
- 'password' => '',
- 'email' => 'foo@bar.batz',
- 'api_key' => '',
- ]);
- $this->user->save();
-
- $this->newsData = [
- 'title' => 'test title',
- 'text' => 'test text',
- 'user_id' => $this->user->id
- ];
- }
-
- /**
- * Tests that creating a News item with default values works.
- *
- * @return void
- */
- public function testCreateDefault(): void
- {
- $news = News::create($this->newsData);
-
- $this->assertSame(1, $news->id);
- $this->assertSame($this->newsData['title'], $news->title);
- $this->assertSame($this->newsData['text'], $news->text);
- $this->assertFalse($news->is_meeting);
- }
-
- /**
- * Tests that creating a News item with all fill values works.
- *
- * @return void
- */
- public function testCreate(): void
- {
- $news = News::create(
- $this->newsData + ['is_meeting' => true,]
- );
-
- $this->assertSame(1, $news->id);
- $this->assertSame($this->newsData['title'], $news->title);
- $this->assertSame($this->newsData['text'], $news->text);
- $this->assertTrue($news->is_meeting);
- }
-}