diff --git a/tests/register.test.php b/tests/register.test.php index 6968720..8457031 100644 --- a/tests/register.test.php +++ b/tests/register.test.php @@ -2,10 +2,11 @@ beforeAll(function () { createTableForUsers(); + dbInstance()->delete('users')->execute(); }); afterEach(function () { - dbInstance()->delete('users')->where('username', 'test-user')->execute(); + dbInstance()->delete('users')->execute(); }); test('user can register an account', function (array $userData) { @@ -13,6 +14,10 @@ $success = $auth->register($userData); + if (!$success) { + $this->fail(json_encode($auth->errors())); + } + expect($success)->toBeTrue(); expect($auth->user())->toBeInstanceOf(\Leaf\Auth\User::class); expect($auth->user()->username)->toBe($userData['username']); diff --git a/tests/session.test.php b/tests/session.test.php index a8edc09..3f699eb 100644 --- a/tests/session.test.php +++ b/tests/session.test.php @@ -1,5 +1,10 @@ delete('users')->execute(); +}); + afterEach(function () { if (session_status() === PHP_SESSION_ACTIVE) { $_SESSION = []; diff --git a/tests/user.test.php b/tests/user.test.php index 0f94b3c..71eab7c 100644 --- a/tests/user.test.php +++ b/tests/user.test.php @@ -2,6 +2,7 @@ beforeAll(function () { createTableForUsers(); + dbInstance()->delete('users')->execute(); try { dbInstance()