Skip to content

Commit b9300db

Browse files
authored
Refactor tests (#20)
* Update AccountControllerTest.php * Update LoginControllerTest.php * Update UserTest.php
1 parent 9fdac12 commit b9300db

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

tests/Feature/Controllers/AccountControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
);
1818
});
1919

20-
test("Guests can't edit any accounts", function () {
20+
test("Guests can't edit accounts", function () {
2121
get(route('account.edit'))->assertRedirect(route('login'));
2222
});
2323

@@ -43,7 +43,8 @@
4343
'email' => 'tim@test.com',
4444
'password' => 'newPassword#123',
4545
])
46-
->assertRedirect();
46+
->assertRedirect()
47+
->assertSessionHas('message', 'Your account has been updated.');
4748

4849
$user->refresh();
4950

@@ -55,7 +56,7 @@
5556
expect(Hash::check('newPassword#123', $user->password))->toBeTrue();
5657
});
5758

58-
test("Guests can't update any details", function () {
59+
test("Guests can't update details", function () {
5960
patch(route('account.update'), [
6061
'name' => 'Tim Drake',
6162
'email' => 'tim@test.com',

tests/Feature/Controllers/LoginControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
'email' => $user->email,
6464
'password' => 'test',
6565
])
66-
->assertsessionHasErrors('email');
66+
->assertsessionHasErrors();
6767

6868
assertGuest();
6969
});

tests/Integration/UserTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,6 @@
33
use App\Models\User;
44
use Illuminate\Support\Facades\Hash;
55

6-
it('has a first name', function () {
7-
$firstName = 'Jim';
8-
9-
$user = User::factory()->create([
10-
'first_name' => $firstName,
11-
]);
12-
13-
expect($user)->first_name->toBe($firstName);
14-
});
15-
16-
it('has a last name', function () {
17-
$lastName = 'Gordon';
18-
19-
$user = User::factory()->create([
20-
'last_name' => $lastName,
21-
]);
22-
23-
expect($user)->last_name->toBe($lastName);
24-
});
25-
266
it("can update it's password", function () {
277
$user = User::factory()->create([
288
'password' => 'oldPassword#123',

0 commit comments

Comments
 (0)