Skip to content

Commit da2dd79

Browse files
authored
Merge pull request #18720 from marcusmoore/pint-tests
Apply pint to tests directory
2 parents bb72dab + cc8f59d commit da2dd79

304 files changed

Lines changed: 3082 additions & 3305 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.git-blame-ignore-revs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ c1a93e3ac890ed1fc1c27ba6c431f6b58ff661d6
6060

6161
# Pint: Database
6262
b5a46a370f85c6e87c8a9fa4a4593424bb027712
63+
64+
# Pint: Tests
65+
d84eb43278177a9bcdfffe04c94d933eb49f2c48
66+
446f5f3cefdc1837a65fd4bc983741b29f821a78

tests/Concerns/TestsFullMultipleCompaniesSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
interface TestsFullMultipleCompaniesSupport
66
{
7-
public function testAdheresToFullMultipleCompaniesSupportScoping();
7+
public function test_adheres_to_full_multiple_companies_support_scoping();
88
}

tests/Concerns/TestsPermissionsRequirement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
interface TestsPermissionsRequirement
66
{
7-
public function testRequiresPermission();
7+
public function test_requires_permission();
88
}

tests/CreatesApplication.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
namespace Tests;
44

55
use Illuminate\Contracts\Console\Kernel;
6+
use Illuminate\Foundation\Application;
67

78
trait CreatesApplication
89
{
910
/**
1011
* Creates the application.
1112
*
12-
* @return \Illuminate\Foundation\Application
13+
* @return Application
1314
*/
1415
public function createApplication()
1516
{
@@ -19,4 +20,4 @@ public function createApplication()
1920

2021
return $app;
2122
}
22-
}
23+
}

tests/Feature/Accessories/Api/AccessoriesForSelectListTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class AccessoriesForSelectListTest extends TestCase implements TestsFullMultipleCompaniesSupport
1212
{
13-
public function testAdheresToFullMultipleCompaniesSupportScoping()
13+
public function test_adheres_to_full_multiple_companies_support_scoping()
1414
{
1515
[$companyA, $companyB] = Company::factory()->count(2)->create();
1616

@@ -45,7 +45,7 @@ public function testAdheresToFullMultipleCompaniesSupportScoping()
4545
->assertResponseContainsInResults($accessoryB);
4646
}
4747

48-
public function testCanGetAccessoriesForSelectList()
48+
public function test_can_get_accessories_for_select_list()
4949
{
5050
[$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();
5151

tests/Feature/Accessories/Api/AccessoryFilesTest.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class AccessoryFilesTest extends TestCase
1111
{
12-
public function testAccessoryApiAcceptsFileUpload()
12+
public function test_accessory_api_accepts_file_upload()
1313
{
1414
// Upload a file to a model
1515

@@ -19,17 +19,17 @@ public function testAccessoryApiAcceptsFileUpload()
1919
// Create a superuser to run this as
2020
$user = User::factory()->superuser()->create();
2121

22-
//Upload a file
22+
// Upload a file
2323
$this->actingAsForApi($user)
2424
->post(
2525
route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [
26-
'file' => [UploadedFile::fake()->create("test.jpg", 100)]
26+
'file' => [UploadedFile::fake()->create('test.jpg', 100)],
2727
]
2828
)
2929
->assertOk();
3030
}
3131

32-
public function testAccessoryApiListsFiles()
32+
public function test_accessory_api_lists_files()
3333
{
3434
// List all files on a model
3535

@@ -47,13 +47,13 @@ public function testAccessoryApiListsFiles()
4747
->assertOk()
4848
->assertJsonStructure(
4949
[
50-
'rows',
51-
'total',
50+
'rows',
51+
'total',
5252
]
5353
);
5454
}
5555

56-
public function testAccessoryFailsIfInvalidTypePassedInUrl()
56+
public function test_accessory_fails_if_invalid_type_passed_in_url()
5757
{
5858
// List all files on a model
5959

@@ -71,7 +71,7 @@ public function testAccessoryFailsIfInvalidTypePassedInUrl()
7171
->assertStatus(404);
7272
}
7373

74-
public function testAccessoryFailsIfInvalidIdPassedInUrl()
74+
public function test_accessory_fails_if_invalid_id_passed_in_url()
7575
{
7676
// List all files on a model
7777

@@ -90,7 +90,7 @@ public function testAccessoryFailsIfInvalidIdPassedInUrl()
9090
->assertStatusMessageIs('error');
9191
}
9292

93-
public function testAccessoryApiDownloadsFile()
93+
public function test_accessory_api_downloads_file()
9494
{
9595
// Download a file from a model
9696

@@ -104,30 +104,30 @@ public function testAccessoryApiDownloadsFile()
104104
$this->actingAsForApi($user)
105105
->post(
106106
route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [
107-
'file' => [UploadedFile::fake()->create("test.jpg", 100)],
107+
'file' => [UploadedFile::fake()->create('test.jpg', 100)],
108108
]
109109
)
110110
->assertOk()
111111
->assertJsonStructure(
112112
[
113-
'status',
114-
'messages',
113+
'status',
114+
'messages',
115115
]
116116
);
117117

118118
// Upload a file with notes
119119
$this->actingAsForApi($user)
120120
->post(
121121
route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [
122-
'file' => [UploadedFile::fake()->create("test.jpg", 100)],
123-
'notes' => 'manual'
122+
'file' => [UploadedFile::fake()->create('test.jpg', 100)],
123+
'notes' => 'manual',
124124
]
125125
)
126126
->assertOk()
127127
->assertJsonStructure(
128128
[
129-
'status',
130-
'messages',
129+
'status',
130+
'messages',
131131
]
132132
);
133133

@@ -139,19 +139,19 @@ public function testAccessoryApiDownloadsFile()
139139
->assertOk()
140140
->assertJsonStructure(
141141
[
142-
'total',
143-
'rows'=>[
144-
'*' => [
145-
'id',
146-
'filename',
147-
'url',
148-
'created_by',
149-
'created_at',
150-
'deleted_at',
151-
'note',
152-
'available_actions'
153-
]
154-
]
142+
'total',
143+
'rows' => [
144+
'*' => [
145+
'id',
146+
'filename',
147+
'url',
148+
'created_by',
149+
'created_at',
150+
'deleted_at',
151+
'note',
152+
'available_actions',
153+
],
154+
],
155155
]
156156
)
157157
->assertJsonPath('rows.0.note', null)
@@ -162,16 +162,16 @@ public function testAccessoryApiDownloadsFile()
162162
->get(
163163
route(
164164
'api.files.show', [
165-
'object_type' => 'accessories',
166-
'id' => $accessory->id,
167-
'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],
165+
'object_type' => 'accessories',
166+
'id' => $accessory->id,
167+
'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],
168168
]
169169
)
170170
)
171171
->assertOk();
172172
}
173173

174-
public function testAccessoryApiDeletesFile()
174+
public function test_accessory_api_deletes_file()
175175
{
176176
// Delete a file from a model
177177

@@ -181,11 +181,11 @@ public function testAccessoryApiDeletesFile()
181181
// Create a superuser to run this as
182182
$user = User::factory()->superuser()->create();
183183

184-
//Upload a file
184+
// Upload a file
185185
$this->actingAsForApi($user)
186186
->post(
187187
route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [
188-
'file' => [UploadedFile::fake()->create("test.jpg", 100)]
188+
'file' => [UploadedFile::fake()->create('test.jpg', 100)],
189189
]
190190
)
191191
->assertOk();
@@ -202,18 +202,18 @@ public function testAccessoryApiDeletesFile()
202202
->delete(
203203
route(
204204
'api.files.destroy', [
205-
'object_type' => 'accessories',
206-
'id' => $accessory->id,
207-
'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],
205+
'object_type' => 'accessories',
206+
'id' => $accessory->id,
207+
'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],
208208
]
209209
)
210210
)
211211
->assertOk()
212212
->assertJsonStructure(
213213
[
214-
'status',
215-
'messages',
214+
'status',
215+
'messages',
216216
]
217217
);
218218
}
219-
}
219+
}

tests/Feature/Accessories/Api/DeleteAccessoriesTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class DeleteAccessoriesTest extends TestCase implements TestsFullMultipleCompaniesSupport, TestsPermissionsRequirement
1414
{
15-
public function testRequiresPermission()
15+
public function test_requires_permission()
1616
{
1717
$accessory = Accessory::factory()->create();
1818

@@ -23,7 +23,7 @@ public function testRequiresPermission()
2323
$this->assertNotSoftDeleted($accessory);
2424
}
2525

26-
public function testAdheresToFullMultipleCompaniesSupportScoping()
26+
public function test_adheres_to_full_multiple_companies_support_scoping()
2727
{
2828
[$companyA, $companyB] = Company::factory()->count(2)->create();
2929

@@ -56,13 +56,13 @@ public function testAdheresToFullMultipleCompaniesSupportScoping()
5656

5757
public static function checkedOutAccessories()
5858
{
59-
yield 'checked out to user' => [fn() => Accessory::factory()->checkedOutToUser()->create()];
60-
yield 'checked out to asset' => [fn() => Accessory::factory()->checkedOutToAsset()->create()];
61-
yield 'checked out to location' => [fn() => Accessory::factory()->checkedOutToLocation()->create()];
59+
yield 'checked out to user' => [fn () => Accessory::factory()->checkedOutToUser()->create()];
60+
yield 'checked out to asset' => [fn () => Accessory::factory()->checkedOutToAsset()->create()];
61+
yield 'checked out to location' => [fn () => Accessory::factory()->checkedOutToLocation()->create()];
6262
}
6363

6464
#[DataProvider('checkedOutAccessories')]
65-
public function testCannotDeleteAccessoryThatHasCheckouts($data)
65+
public function test_cannot_delete_accessory_that_has_checkouts($data)
6666
{
6767
$accessory = $data();
6868

@@ -73,7 +73,7 @@ public function testCannotDeleteAccessoryThatHasCheckouts($data)
7373
$this->assertNotSoftDeleted($accessory);
7474
}
7575

76-
public function testCanDeleteAccessory()
76+
public function test_can_delete_accessory()
7777
{
7878
$accessory = Accessory::factory()->create();
7979

tests/Feature/Accessories/Api/IndexAccessoryCheckoutsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class IndexAccessoryCheckoutsTest extends TestCase implements TestsFullMultipleCompaniesSupport, TestsPermissionsRequirement
1313
{
14-
public function testRequiresPermission()
14+
public function test_requires_permission()
1515
{
1616
$accessory = Accessory::factory()->create();
1717

@@ -20,7 +20,7 @@ public function testRequiresPermission()
2020
->assertForbidden();
2121
}
2222

23-
public function testAdheresToFullMultipleCompaniesSupportScoping()
23+
public function test_adheres_to_full_multiple_companies_support_scoping()
2424
{
2525
[$companyA, $companyB] = Company::factory()->count(2)->create();
2626

@@ -46,7 +46,7 @@ public function testAdheresToFullMultipleCompaniesSupportScoping()
4646
->assertOk();
4747
}
4848

49-
public function testCanGetAccessoryCheckouts()
49+
public function test_can_get_accessory_checkouts()
5050
{
5151
[$userA, $userB] = User::factory()->count(2)->create();
5252

@@ -62,7 +62,7 @@ public function testCanGetAccessoryCheckouts()
6262
->assertJsonPath('rows.1.assigned_to.id', $userB->id);
6363
}
6464

65-
public function testCanGetAccessoryCheckoutsWithOffsetAndLimitInQueryString()
65+
public function test_can_get_accessory_checkouts_with_offset_and_limit_in_query_string()
6666
{
6767
[$userA, $userB, $userC] = User::factory()->count(3)->create();
6868

tests/Feature/Accessories/Api/IndexAccessoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
class IndexAccessoryTest extends TestCase implements TestsFullMultipleCompaniesSupport, TestsPermissionsRequirement
1313
{
14-
public function testRequiresPermission()
14+
public function test_requires_permission()
1515
{
1616
$this->actingAsForApi(User::factory()->create())
1717
->getJson(route('api.accessories.index'))
1818
->assertForbidden();
1919
}
2020

21-
public function testAdheresToFullMultipleCompaniesSupportScoping()
21+
public function test_adheres_to_full_multiple_companies_support_scoping()
2222
{
2323
[$companyA, $companyB] = Company::factory()->count(2)->create();
2424

@@ -54,7 +54,7 @@ public function testAdheresToFullMultipleCompaniesSupportScoping()
5454
->assertResponseContainsInRows($accessoryC);
5555
}
5656

57-
public function testCanGetAccessories()
57+
public function test_can_get_accessories()
5858
{
5959
$user = User::factory()->viewAccessories()->create();
6060

tests/Feature/Accessories/Api/ShowAccessoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class ShowAccessoryTest extends TestCase implements TestsFullMultipleCompaniesSupport, TestsPermissionsRequirement
1313
{
14-
public function testRequiresPermission()
14+
public function test_requires_permission()
1515
{
1616
$accessory = Accessory::factory()->create();
1717

@@ -20,7 +20,7 @@ public function testRequiresPermission()
2020
->assertForbidden();
2121
}
2222

23-
public function testAdheresToFullMultipleCompaniesSupportScoping()
23+
public function test_adheres_to_full_multiple_companies_support_scoping()
2424
{
2525
[$companyA, $companyB] = Company::factory()->count(2)->create();
2626

@@ -44,7 +44,7 @@ public function testAdheresToFullMultipleCompaniesSupportScoping()
4444
]);
4545
}
4646

47-
public function testCanGetSingleAccessory()
47+
public function test_can_get_single_accessory()
4848
{
4949
$accessory = Accessory::factory()->checkedOutToUser()->create(['name' => 'My Accessory']);
5050

0 commit comments

Comments
 (0)