diff options
Diffstat (limited to 'tests/Unit/Controllers')
-rw-r--r-- | tests/Unit/Controllers/Metrics/StatsTest.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/Unit/Controllers/Metrics/StatsTest.php b/tests/Unit/Controllers/Metrics/StatsTest.php index 54add688..146c44a0 100644 --- a/tests/Unit/Controllers/Metrics/StatsTest.php +++ b/tests/Unit/Controllers/Metrics/StatsTest.php @@ -6,6 +6,7 @@ use Carbon\Carbon; use Engelsystem\Controllers\Metrics\Stats; use Engelsystem\Models\LogEntry; use Engelsystem\Models\News; +use Engelsystem\Models\Question; use Engelsystem\Models\User\PasswordReset; use Engelsystem\Models\User\PersonalData; use Engelsystem\Models\User\State; @@ -92,6 +93,24 @@ class StatsTest extends TestCase } /** + * @covers \Engelsystem\Controllers\Metrics\Stats::questions + */ + public function testQuestions() + { + $this->addUsers(); + $questionsData = ['text' => 'Lorem Ipsum', 'user_id' => 1]; + + (new Question($questionsData))->save(); + (new Question($questionsData))->save(); + (new Question($questionsData + ['answerer_id' => 2, 'answer' => 'Dolor sit!']))->save(); + + $stats = new Stats($this->database); + $this->assertEquals(3, $stats->questions()); + $this->assertEquals(2, $stats->questions(false)); + $this->assertEquals(1, $stats->questions(true)); + } + + /** * @covers \Engelsystem\Controllers\Metrics\Stats::arrivedUsers */ public function testArrivedUsers() |