diff --git a/tests/unit/HaveIBeenPwndPageControllerTest.php b/tests/unit/HaveIBeenPwndPageControllerTest.php index 9f9ba46..475a9da 100644 --- a/tests/unit/HaveIBeenPwndPageControllerTest.php +++ b/tests/unit/HaveIBeenPwndPageControllerTest.php @@ -5,10 +5,13 @@ use Firesphere\HaveIBeenPwnd\Controllers\HaveIBeenPwndPageController; use Firesphere\HaveIBeenPwnd\Models\HaveIBeenPwndPage; use SilverStripe\Core\Injector\Injector; +use SilverStripe\Dev\Debug; use SilverStripe\Dev\SapphireTest; +use SilverStripe\Security\IdentityStore; use SilverStripe\Security\Security; if (class_exists(HaveIBeenPwndPageController::class)) { + class HaveIBeenPwndPageControllerTest extends SapphireTest { public function testClassExists() @@ -26,10 +29,14 @@ public function testCheckEmail() $controller = Injector::inst()->get(HaveIBeenPwndPageController::class, $page); + // Log out. Solidly I hope Security::setCurrentUser(null); + Injector::inst()->get(IdentityStore::class)->logOut(); $response = $controller->checkEmail(); + Debug::dump($response); + // If there's no user, it should just return itself $this->assertInstanceOf(HaveIBeenPwndPageController::class, $response); }