From 9c3872bf783ab772808baab7c675390b0201b2f0 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 9 Jan 2019 23:39:42 +0000 Subject: [PATCH] Add UserCounterTest --- tests/src/Kernel/Service/UserCounterTest.php | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/src/Kernel/Service/UserCounterTest.php diff --git a/tests/src/Kernel/Service/UserCounterTest.php b/tests/src/Kernel/Service/UserCounterTest.php new file mode 100644 index 0000000..92fa881 --- /dev/null +++ b/tests/src/Kernel/Service/UserCounterTest.php @@ -0,0 +1,50 @@ +userCounter = $this->container->get(UserCounter::class); + } + + /** @test */ + public function active_users_are_counted() { + $this->createUser(['status' => 1]); + $this->createUser(['status' => 1]); + + $this->assertEquals(2, $this->userCounter->getActiveUserCount()); + } + + /** @test */ + public function blocked_users_are_not_counted() { + $this->createUser(['status' => 1]); + $this->createUser(['status' => 0]); + + $this->assertEquals(1, $this->userCounter->getActiveUserCount()); + } + +}