diff options
Diffstat (limited to 'tests/Unit/Controllers/Metrics')
-rw-r--r-- | tests/Unit/Controllers/Metrics/StatsTest.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/Unit/Controllers/Metrics/StatsTest.php b/tests/Unit/Controllers/Metrics/StatsTest.php index d13c2693..15447be8 100644 --- a/tests/Unit/Controllers/Metrics/StatsTest.php +++ b/tests/Unit/Controllers/Metrics/StatsTest.php @@ -5,6 +5,7 @@ namespace Engelsystem\Test\Unit\Controllers\Metrics; use Carbon\Carbon; use Engelsystem\Controllers\Metrics\Stats; use Engelsystem\Models\LogEntry; +use Engelsystem\Models\Message; use Engelsystem\Models\News; use Engelsystem\Models\Question; use Engelsystem\Models\User\PasswordReset; @@ -132,6 +133,21 @@ class StatsTest extends TestCase } /** + * @covers \Engelsystem\Controllers\Metrics\Stats::messages + */ + public function testMessages() + { + $this->addUsers(); + + (new Message(['user_id' => 1, 'receiver_id' => 2, 'text' => 'Ohi?']))->save(); + (new Message(['user_id' => 4, 'receiver_id' => 1, 'text' => 'Testing stuff?']))->save(); + (new Message(['user_id' => 2, 'receiver_id' => 3, 'text' => 'Nope!', 'read' => true]))->save(); + + $stats = new Stats($this->database); + $this->assertEquals(3, $stats->messages()); + } + + /** * @covers \Engelsystem\Controllers\Metrics\Stats::sessions */ public function testSessions() |