Skip to content

Commit 47d05d9

Browse files
Merge pull request #7 from shahghasiadil/feature/laravel-data
lint: pint formatting
2 parents 4089f48 + f0ce639 commit 47d05d9

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

src/Domain/User/Entities/User.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ class User extends Authenticatable
4040
'remember_token',
4141
];
4242

43+
44+
protected static function newFactory()
45+
{
46+
return UserFactory::new();
47+
}
48+
4349
/**
4450
* Get the attributes that should be cast.
4551
*
@@ -54,10 +60,4 @@ protected function casts(): array
5460
];
5561
}
5662

57-
58-
protected static function newFactory()
59-
{
60-
return UserFactory::new();
61-
}
62-
6363
}

src/Presentation/UserManagement/Controllers/UserController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public function update(int $id, UserFormRequest $request): UsersListData
5050
return UsersListData::from($user);
5151
}
5252

53-
public function index(): Collection {
53+
public function index(): Collection
54+
{
5455

5556
$users = $this->userService->index();
5657

tests/Feature/UserTest.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Domain\User\Entities\User;
46

5-
it('creates users', function () {
7+
it('creates users', function (): void {
68

79
User::factory()->count(5)->create();
810

@@ -13,48 +15,48 @@
1315
});
1416

1517

16-
it('retrieves all users', function () {
18+
it('retrieves all users', function (): void {
1719

1820
User::factory()->count(5)->create();
1921

2022
$response = $this->get('/api/users');
2123

2224
$response->assertStatus(200)
23-
->assertJsonStructure([
24-
'*' => ['id', 'name', 'email', 'status', 'created_at', 'updated_at']
25-
]);
25+
->assertJsonStructure([
26+
'*' => ['id', 'name', 'email', 'status', 'created_at', 'updated_at'],
27+
]);
2628

2729
$this->assertCount(5, $response->json());
2830
});
2931

30-
it('updates a user', function () {
32+
it('updates a user', function (): void {
3133

3234
$user = User::factory()->create([
3335
'name' => 'Muqtadir Khan',
3436
'email' => '[email protected]',
3537
'password' => '123456789',
36-
'status' => 'active'
38+
'status' => 'active',
3739
]);
3840

3941
$updateData = [
4042
'name' => 'Muqtadir Khan',
4143
'email' => '[email protected]',
4244
'password' => '123456756',
43-
'status' => 'suspended'
45+
'status' => 'suspended',
4446
];
4547

4648
$response = $this->put("/api/users/{$user->id}/update", $updateData);
4749

4850
$response->assertStatus(200)
49-
->assertJson([
50-
'id' => $user->id,
51-
'name' => 'Muqtadir Khan',
52-
'email' => '[email protected]'
53-
]);
51+
->assertJson([
52+
'id' => $user->id,
53+
'name' => 'Muqtadir Khan',
54+
'email' => '[email protected]',
55+
]);
5456

5557
$this->assertDatabaseHas('users', [
5658
'id' => $user->id,
5759
'name' => 'Muqtadir Khan',
58-
'email' => '[email protected]'
60+
'email' => '[email protected]',
5961
]);
6062
});

tests/Pest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
|--------------------------------------------------------------------------
57
| Test Case
@@ -27,9 +29,7 @@
2729
|
2830
*/
2931

30-
expect()->extend('toBeOne', function () {
31-
return $this->toBe(1);
32-
});
32+
expect()->extend('toBeOne', fn() => $this->toBe(1));
3333

3434
/*
3535
|--------------------------------------------------------------------------
@@ -42,7 +42,7 @@
4242
|
4343
*/
4444

45-
function something()
45+
function something(): void
4646
{
4747
// ..
4848
}

0 commit comments

Comments
 (0)