A free open source IT asset/license management system
Run pint on tests
Marcus Moore446f5f3cefdc
diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.phpindex 8d8a77e99d..18f982511c 100644--- a/tests/CreatesApplication.php+++ b/tests/CreatesApplication.php@@ -3,13 +3,14 @@namespace Tests;use Illuminate\Contracts\Console\Kernel;+use Illuminate\Foundation\Application;trait CreatesApplication{/*** Creates the application.*- * @return \Illuminate\Foundation\Application+ * @return Application*/public function createApplication(){@@ -19,4 +20,4 @@ trait CreatesApplicationreturn $app;}-}\ No newline at end of file+}diff --git a/tests/Feature/Accessories/Api/AccessoriesForSelectListTest.php b/tests/Feature/Accessories/Api/AccessoriesForSelectListTest.phpindex 7bd939342e..5053562fcc 100644--- a/tests/Feature/Accessories/Api/AccessoriesForSelectListTest.php+++ b/tests/Feature/Accessories/Api/AccessoriesForSelectListTest.php@@ -45,7 +45,7 @@ class AccessoriesForSelectListTest extends TestCase implements TestsFullMultiple->assertResponseContainsInResults($accessoryB);}- public function testCanGetAccessoriesForSelectList()+ public function test_can_get_accessories_for_select_list(){[$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();diff --git a/tests/Feature/Accessories/Api/AccessoryFilesTest.php b/tests/Feature/Accessories/Api/AccessoryFilesTest.phpindex fd6bc5d492..6c2d2020d9 100644--- a/tests/Feature/Accessories/Api/AccessoryFilesTest.php+++ b/tests/Feature/Accessories/Api/AccessoryFilesTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class AccessoryFilesTest extends TestCase{- public function testAccessoryApiAcceptsFileUpload()+ public function test_accessory_api_accepts_file_upload(){// Upload a file to a model@@ -19,17 +19,17 @@ class AccessoryFilesTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testAccessoryApiListsFiles()+ public function test_accessory_api_lists_files(){// List all files on a model@@ -47,13 +47,13 @@ class AccessoryFilesTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testAccessoryFailsIfInvalidTypePassedInUrl()+ public function test_accessory_fails_if_invalid_type_passed_in_url(){// List all files on a model@@ -71,7 +71,7 @@ class AccessoryFilesTest extends TestCase->assertStatus(404);}- public function testAccessoryFailsIfInvalidIdPassedInUrl()+ public function test_accessory_fails_if_invalid_id_passed_in_url(){// List all files on a model@@ -90,7 +90,7 @@ class AccessoryFilesTest extends TestCase->assertStatusMessageIs('error');}- public function testAccessoryApiDownloadsFile()+ public function test_accessory_api_downloads_file(){// Download a file from a model@@ -104,14 +104,14 @@ class AccessoryFilesTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -119,15 +119,15 @@ class AccessoryFilesTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],- 'notes' => 'manual'+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],+ 'notes' => 'manual',])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -139,19 +139,19 @@ class AccessoryFilesTest extends TestCase->assertOk()->assertJsonStructure([- 'total',- 'rows'=>[- '*' => [- 'id',- 'filename',- 'url',- 'created_by',- 'created_at',- 'deleted_at',- 'note',- 'available_actions'- ]- ]+ 'total',+ 'rows' => [+ '*' => [+ 'id',+ 'filename',+ 'url',+ 'created_by',+ 'created_at',+ 'deleted_at',+ 'note',+ 'available_actions',+ ],+ ],])->assertJsonPath('rows.0.note', null)@@ -162,16 +162,16 @@ class AccessoryFilesTest extends TestCase->get(route('api.files.show', [- 'object_type' => 'accessories',- 'id' => $accessory->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'accessories',+ 'id' => $accessory->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk();}- public function testAccessoryApiDeletesFile()+ public function test_accessory_api_deletes_file(){// Delete a file from a model@@ -181,11 +181,11 @@ class AccessoryFilesTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'accessories', 'id' => $accessory->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -202,18 +202,18 @@ class AccessoryFilesTest extends TestCase->delete(route('api.files.destroy', [- 'object_type' => 'accessories',- 'id' => $accessory->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'accessories',+ 'id' => $accessory->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);}-}\ No newline at end of file+}diff --git a/tests/Feature/Accessories/Api/DeleteAccessoriesTest.php b/tests/Feature/Accessories/Api/DeleteAccessoriesTest.phpindex 3bf04c0872..9ca650dda1 100644--- a/tests/Feature/Accessories/Api/DeleteAccessoriesTest.php+++ b/tests/Feature/Accessories/Api/DeleteAccessoriesTest.php@@ -56,13 +56,13 @@ class DeleteAccessoriesTest extends TestCase implements TestsFullMultipleCompanipublic static function checkedOutAccessories(){- yield 'checked out to user' => [fn() => Accessory::factory()->checkedOutToUser()->create()];- yield 'checked out to asset' => [fn() => Accessory::factory()->checkedOutToAsset()->create()];- yield 'checked out to location' => [fn() => Accessory::factory()->checkedOutToLocation()->create()];+ yield 'checked out to user' => [fn () => Accessory::factory()->checkedOutToUser()->create()];+ yield 'checked out to asset' => [fn () => Accessory::factory()->checkedOutToAsset()->create()];+ yield 'checked out to location' => [fn () => Accessory::factory()->checkedOutToLocation()->create()];}#[DataProvider('checkedOutAccessories')]- public function testCannotDeleteAccessoryThatHasCheckouts($data)+ public function test_cannot_delete_accessory_that_has_checkouts($data){$accessory = $data();@@ -73,7 +73,7 @@ class DeleteAccessoriesTest extends TestCase implements TestsFullMultipleCompani$this->assertNotSoftDeleted($accessory);}- public function testCanDeleteAccessory()+ public function test_can_delete_accessory(){$accessory = Accessory::factory()->create();diff --git a/tests/Feature/Accessories/Api/IndexAccessoryCheckoutsTest.php b/tests/Feature/Accessories/Api/IndexAccessoryCheckoutsTest.phpindex 49a804b487..269a2f0377 100644--- a/tests/Feature/Accessories/Api/IndexAccessoryCheckoutsTest.php+++ b/tests/Feature/Accessories/Api/IndexAccessoryCheckoutsTest.php@@ -46,7 +46,7 @@ class IndexAccessoryCheckoutsTest extends TestCase implements TestsFullMultipleC->assertOk();}- public function testCanGetAccessoryCheckouts()+ public function test_can_get_accessory_checkouts(){[$userA, $userB] = User::factory()->count(2)->create();@@ -62,7 +62,7 @@ class IndexAccessoryCheckoutsTest extends TestCase implements TestsFullMultipleC->assertJsonPath('rows.1.assigned_to.id', $userB->id);}- public function testCanGetAccessoryCheckoutsWithOffsetAndLimitInQueryString()+ public function test_can_get_accessory_checkouts_with_offset_and_limit_in_query_string(){[$userA, $userB, $userC] = User::factory()->count(3)->create();diff --git a/tests/Feature/Accessories/Api/IndexAccessoryTest.php b/tests/Feature/Accessories/Api/IndexAccessoryTest.phpindex 01eda38221..e210513170 100644--- a/tests/Feature/Accessories/Api/IndexAccessoryTest.php+++ b/tests/Feature/Accessories/Api/IndexAccessoryTest.php@@ -54,7 +54,7 @@ class IndexAccessoryTest extends TestCase implements TestsFullMultipleCompaniesS->assertResponseContainsInRows($accessoryC);}- public function testCanGetAccessories()+ public function test_can_get_accessories(){$user = User::factory()->viewAccessories()->create();diff --git a/tests/Feature/Accessories/Api/ShowAccessoryTest.php b/tests/Feature/Accessories/Api/ShowAccessoryTest.phpindex d8126cf1a6..af51169574 100644--- a/tests/Feature/Accessories/Api/ShowAccessoryTest.php+++ b/tests/Feature/Accessories/Api/ShowAccessoryTest.php@@ -44,7 +44,7 @@ class ShowAccessoryTest extends TestCase implements TestsFullMultipleCompaniesSu]);}- public function testCanGetSingleAccessory()+ public function test_can_get_single_accessory(){$accessory = Accessory::factory()->checkedOutToUser()->create(['name' => 'My Accessory']);diff --git a/tests/Feature/Accessories/Api/StoreAccessoryTest.php b/tests/Feature/Accessories/Api/StoreAccessoryTest.phpindex ed9bfa2384..53693a5d00 100644--- a/tests/Feature/Accessories/Api/StoreAccessoryTest.php+++ b/tests/Feature/Accessories/Api/StoreAccessoryTest.php@@ -44,7 +44,7 @@ class StoreAccessoryTest extends TestCase implements TestsFullMultipleCompaniesS]);}- public function testValidation()+ public function test_validation(){$this->actingAsForApi(User::factory()->createAccessories()->create())->postJson(route('api.accessories.store'), [@@ -58,7 +58,7 @@ class StoreAccessoryTest extends TestCase implements TestsFullMultipleCompaniesS]);}- public function testCanStoreAccessory()+ public function test_can_store_accessory(){$category = Category::factory()->forAccessories()->create();$company = Company::factory()->create();diff --git a/tests/Feature/Accessories/Api/UpdateAccessoryTest.php b/tests/Feature/Accessories/Api/UpdateAccessoryTest.phpindex 0162b0dae4..df783eb4fc 100644--- a/tests/Feature/Accessories/Api/UpdateAccessoryTest.php+++ b/tests/Feature/Accessories/Api/UpdateAccessoryTest.php@@ -55,7 +55,7 @@ class UpdateAccessoryTest extends TestCase implements TestsFullMultipleCompanies$this->assertEquals('New Name', $accessoryC->fresh()->name);}- public function testCanUpdateAccessoryViaPatch()+ public function test_can_update_accessory_via_patch(){[$categoryA, $categoryB] = Category::factory()->count(2)->create();[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Feature/Accessories/Ui/AccessoriesIndexTest.php b/tests/Feature/Accessories/Ui/AccessoriesIndexTest.phpindex 8055513e72..21c1d6ef9e 100644--- a/tests/Feature/Accessories/Ui/AccessoriesIndexTest.php+++ b/tests/Feature/Accessories/Ui/AccessoriesIndexTest.php@@ -15,16 +15,15 @@ class AccessoriesIndexTest extends TestCase implements TestsPermissionsRequireme->assertForbidden();}-- public function testRendersAccessoriesIndexPage()+ public function test_renders_accessories_index_page(){$this->actingAs(User::factory()->viewAccessories()->create())->get(route('accessories.index'))->assertOk()->assertViewIs('accessories.index');}-- public function testPageRenders()++ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('accessories.index'))diff --git a/tests/Feature/Accessories/Ui/CreateAccessoriesTest.php b/tests/Feature/Accessories/Ui/CreateAccessoriesTest.phpindex f5cffd1be2..da2f49ec36 100644--- a/tests/Feature/Accessories/Ui/CreateAccessoriesTest.php+++ b/tests/Feature/Accessories/Ui/CreateAccessoriesTest.php@@ -12,14 +12,14 @@ use Tests\TestCase;class CreateAccessoriesTest extends TestCase{- public function testRequiresPermissionToViewCreateAccessoryPage()+ public function test_requires_permission_to_view_create_accessory_page(){$this->actingAs(User::factory()->create())->get(route('accessories.create'))->assertForbidden();}- public function testCreateAccessoryPageRenders()+ public function test_create_accessory_page_renders(){$this->actingAs(User::factory()->createAccessories()->create())->get(route('accessories.create'))@@ -27,14 +27,14 @@ class CreateAccessoriesTest extends TestCase->assertViewIs('accessories.edit');}- public function testRequiresPermissionToCreateAccessory()+ public function test_requires_permission_to_create_accessory(){$this->actingAs(User::factory()->create())->post(route('accessories.store'))->assertForbidden();}- public function testValidDataRequiredToCreateAccessory()+ public function test_valid_data_required_to_create_accessory(){$this->actingAs(User::factory()->createAccessories()->create())->post(route('accessories.store'), [@@ -47,7 +47,7 @@ class CreateAccessoriesTest extends TestCase]);}- public function testCanCreateAccessory()+ public function test_can_create_accessory(){$category = Category::factory()->create();$company = Company::factory()->create();diff --git a/tests/Feature/Accessories/Ui/CreateAccessoryWithFullMultipleCompanySupportTest.php b/tests/Feature/Accessories/Ui/CreateAccessoryWithFullMultipleCompanySupportTest.phpindex a606db3fe2..139138947e 100644--- a/tests/Feature/Accessories/Ui/CreateAccessoryWithFullMultipleCompanySupportTest.php+++ b/tests/Feature/Accessories/Ui/CreateAccessoryWithFullMultipleCompanySupportTest.php@@ -13,7 +13,7 @@ class CreateAccessoryWithFullMultipleCompanySupportTest extends TestCaseuse ProvidesDataForFullMultipleCompanySupportTesting;#[DataProvider('dataForFullMultipleCompanySupportTesting')]- public function testAdheresToFullMultipleCompaniesSupportScoping($data)+ public function test_adheres_to_full_multiple_companies_support_scoping($data){['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();diff --git a/tests/Feature/Accessories/Ui/DeleteAccessoryTest.php b/tests/Feature/Accessories/Ui/DeleteAccessoryTest.phpindex 45ebbf71f7..6badc84d95 100644--- a/tests/Feature/Accessories/Ui/DeleteAccessoryTest.php+++ b/tests/Feature/Accessories/Ui/DeleteAccessoryTest.php@@ -10,14 +10,14 @@ use Tests\TestCase;class DeleteAccessoryTest extends TestCase{- public function testRequiresPermissionToDeleteAccessory()+ public function test_requires_permission_to_delete_accessory(){$this->actingAs(User::factory()->create())->delete(route('accessories.destroy', Accessory::factory()->create()->id))->assertForbidden();}- public function testCannotDeleteAccessoryFromAnotherCompany()+ public function test_cannot_delete_accessory_from_another_company(){$this->settings->enableMultipleFullCompanySupport();@@ -32,13 +32,13 @@ class DeleteAccessoryTest extends TestCasepublic static function checkedOutAccessories(){- yield 'checked out to user' => [fn() => Accessory::factory()->checkedOutToUser()->create()];- yield 'checked out to asset' => [fn() => Accessory::factory()->checkedOutToAsset()->create()];- yield 'checked out to location' => [fn() => Accessory::factory()->checkedOutToLocation()->create()];+ yield 'checked out to user' => [fn () => Accessory::factory()->checkedOutToUser()->create()];+ yield 'checked out to asset' => [fn () => Accessory::factory()->checkedOutToAsset()->create()];+ yield 'checked out to location' => [fn () => Accessory::factory()->checkedOutToLocation()->create()];}#[DataProvider('checkedOutAccessories')]- public function testCannotDeleteAccessoryThatHasCheckouts($data)+ public function test_cannot_delete_accessory_that_has_checkouts($data){$accessory = $data();@@ -50,7 +50,7 @@ class DeleteAccessoryTest extends TestCase$this->assertFalse($accessory->refresh()->trashed(), 'Accessory should not be deleted');}- public function testCanDeleteAccessory()+ public function test_can_delete_accessory(){$accessory = Accessory::factory()->create();diff --git a/tests/Feature/Accessories/Ui/EditAccessoryTest.php b/tests/Feature/Accessories/Ui/EditAccessoryTest.phpindex ce880602e9..9babf3578d 100644--- a/tests/Feature/Accessories/Ui/EditAccessoryTest.php+++ b/tests/Feature/Accessories/Ui/EditAccessoryTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class EditAccessoryTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('accessories.edit', Accessory::factory()->create()->id))diff --git a/tests/Feature/Accessories/Ui/ShowAccessoryTest.php b/tests/Feature/Accessories/Ui/ShowAccessoryTest.phpindex 0247b8846b..42457fced9 100644--- a/tests/Feature/Accessories/Ui/ShowAccessoryTest.php+++ b/tests/Feature/Accessories/Ui/ShowAccessoryTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class ShowAccessoryTest extends TestCase{- public function testRequiresPermissionToViewAccessory()+ public function test_requires_permission_to_view_accessory(){$this->actingAs(User::factory()->create())->get(route('accessories.show', Accessory::factory()->create()))->assertForbidden();}- public function testCannotViewAccessoryFromAnotherCompany()+ public function test_cannot_view_accessory_from_another_company(){$this->settings->enableMultipleFullCompanySupport();@@ -29,7 +29,7 @@ class ShowAccessoryTest extends TestCase->assertStatus(302);}- public function testCanViewAccessory()+ public function test_can_view_accessory(){$accessory = Accessory::factory()->create();@@ -39,8 +39,8 @@ class ShowAccessoryTest extends TestCase->assertViewIs('accessories.view')->assertViewHas(['accessory' => $accessory]);}-- public function testPageRenders()++ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('accessories.show', Accessory::factory()->create()))@@ -48,7 +48,7 @@ class ShowAccessoryTest extends TestCase}- public function testHandlesAccessoryCreatorNotExisting()+ public function test_handles_accessory_creator_not_existing(){$accessory = Accessory::factory()->create(['created_by' => 999999]);diff --git a/tests/Feature/Accessories/Ui/UpdateAccessoryTest.php b/tests/Feature/Accessories/Ui/UpdateAccessoryTest.phpindex 8c482b4f14..f57daaf89b 100644--- a/tests/Feature/Accessories/Ui/UpdateAccessoryTest.php+++ b/tests/Feature/Accessories/Ui/UpdateAccessoryTest.php@@ -13,14 +13,14 @@ use Tests\TestCase;class UpdateAccessoryTest extends TestCase{- public function testRequiresPermissionToSeeEditAccessoryPage()+ public function test_requires_permission_to_see_edit_accessory_page(){$this->actingAs(User::factory()->create())->get(route('accessories.edit', Accessory::factory()->create()))->assertForbidden();}- public function testEditAccessoryPageRenders()+ public function test_edit_accessory_page_renders(){$this->actingAs(User::factory()->editAccessories()->create())->get(route('accessories.edit', Accessory::factory()->create()->id))@@ -28,7 +28,7 @@ class UpdateAccessoryTest extends TestCase->assertViewIs('accessories.edit');}- public function testDoesNotShowEditAccessoryPageFromAnotherCompany()+ public function test_does_not_show_edit_accessory_page_from_another_company(){$this->settings->enableMultipleFullCompanySupport();@@ -41,7 +41,7 @@ class UpdateAccessoryTest extends TestCase->assertRedirect(route('accessories.index'));}- public function testCannotSetQuantityToAmountLowerThanWhatIsCheckedOut()+ public function test_cannot_set_quantity_to_amount_lower_than_what_is_checked_out(){$accessory = Accessory::factory()->create(['qty' => 2]);$accessory->checkouts()->create(['assigned_to' => User::factory()->create()->id, 'qty' => 1]);@@ -70,7 +70,7 @@ class UpdateAccessoryTest extends TestCase]);}- public function testCanUpdateAccessory()+ public function test_can_update_accessory(){[$companyA, $companyB] = Company::factory()->count(2)->create();[$categoryA, $categoryB] = Category::factory()->count(2)->create();@@ -86,7 +86,7 @@ class UpdateAccessoryTest extends TestCase->for($locationA)->create(['min_amt' => 1,- 'qty' => 5+ 'qty' => 5,]);$this->actingAs(User::factory()->editAccessories()->create())diff --git a/tests/Feature/ApiRateLimitTest.php b/tests/Feature/ApiRateLimitTest.phpindex f96624b6ae..9538050b78 100644--- a/tests/Feature/ApiRateLimitTest.php+++ b/tests/Feature/ApiRateLimitTest.php@@ -7,8 +7,7 @@ use Tests\TestCase;class ApiRateLimitTest extends TestCase{-- public function testRateLimit()+ public function test_rate_limit(){config(['app.api_throttle_per_minute' => 10]);$this->actingAsForApi(User::factory()->create())@@ -18,7 +17,7 @@ class ApiRateLimitTest extends TestCase->assertHeader('X-Ratelimit-Remaining', 9);}- public function testRateLimitDecreasesRemaining()+ public function test_rate_limit_decreases_remaining(){$this->markTestSkipped('This test is flappy and keeps screwing up the test results.');config(['app.api_throttle_per_minute' => 5]);@@ -40,7 +39,7 @@ class ApiRateLimitTest extends TestCase->assertHeader('Retry-After', 60);}- public function testRateLimitDecreasesRemainingOverSixty()+ public function test_rate_limit_decreases_remaining_over_sixty(){$this->markTestSkipped('This test is flappy and keeps screwing up the test results.');config(['app.api_throttle_per_minute' => 80]);@@ -61,5 +60,4 @@ class ApiRateLimitTest extends TestCase->assertStatus(200)->assertHeader('Retry-After', 60);}-}diff --git a/tests/Feature/AssetModels/Api/AssetModelFilesTest.php b/tests/Feature/AssetModels/Api/AssetModelFilesTest.phpindex 9294921617..f1ae05897b 100644--- a/tests/Feature/AssetModels/Api/AssetModelFilesTest.php+++ b/tests/Feature/AssetModels/Api/AssetModelFilesTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class AssetModelFilesTest extends TestCase{- public function testAssetModelApiAcceptsFileUpload()+ public function test_asset_model_api_accepts_file_upload(){// Upload a file to a model@@ -19,17 +19,17 @@ class AssetModelFilesTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'models', 'id' => $model->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testAssetModelApiListsFiles()+ public function test_asset_model_api_lists_files(){// List all files on a model@@ -47,13 +47,13 @@ class AssetModelFilesTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testAssetModelFailsIfInvalidTypePassedInUrl()+ public function test_asset_model_fails_if_invalid_type_passed_in_url(){// List all files on a model@@ -71,7 +71,7 @@ class AssetModelFilesTest extends TestCase->assertStatus(404);}- public function testAssetModelFailsIfInvalidIdPassedInUrl()+ public function test_asset_model_fails_if_invalid_id_passed_in_url(){// List all files on a model@@ -90,7 +90,7 @@ class AssetModelFilesTest extends TestCase->assertStatusMessageIs('error');}- public function testAssetModelApiDownloadsFile()+ public function test_asset_model_api_downloads_file(){// Download a file from a model@@ -104,14 +104,14 @@ class AssetModelFilesTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'models', 'id' => $model->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -119,15 +119,15 @@ class AssetModelFilesTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'models', 'id' => $model->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],- 'notes' => 'manual'+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],+ 'notes' => 'manual',])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -139,19 +139,19 @@ class AssetModelFilesTest extends TestCase->assertOk()->assertJsonStructure([- 'total',- 'rows'=>[- '*' => [- 'id',- 'filename',- 'url',- 'created_by',- 'created_at',- 'deleted_at',- 'note',- 'available_actions'- ]- ]+ 'total',+ 'rows' => [+ '*' => [+ 'id',+ 'filename',+ 'url',+ 'created_by',+ 'created_at',+ 'deleted_at',+ 'note',+ 'available_actions',+ ],+ ],])->assertJsonPath('rows.0.note', null)@@ -162,16 +162,16 @@ class AssetModelFilesTest extends TestCase->get(route('api.files.show', [- 'object_type' => 'models',- 'id' => $model->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'models',+ 'id' => $model->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk();}- public function testAssetModelApiDeletesFile()+ public function test_asset_model_api_deletes_file(){// Delete a file from a model@@ -181,11 +181,11 @@ class AssetModelFilesTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'models', 'id' => $model->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -202,18 +202,18 @@ class AssetModelFilesTest extends TestCase->delete(route('api.files.destroy', [- 'object_type' => 'models',- 'id' => $model->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'models',+ 'id' => $model->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);}-}\ No newline at end of file+}diff --git a/tests/Feature/AssetModels/Api/CreateAssetModelsTest.php b/tests/Feature/AssetModels/Api/CreateAssetModelsTest.phpindex 2928d926f6..7203cc88af 100644--- a/tests/Feature/AssetModels/Api/CreateAssetModelsTest.php+++ b/tests/Feature/AssetModels/Api/CreateAssetModelsTest.php@@ -5,26 +5,23 @@ namespace Tests\Feature\AssetModels\Api;use App\Models\AssetModel;use App\Models\Category;use App\Models\User;-use Illuminate\Testing\Fluent\AssertableJson;use Tests\TestCase;class CreateAssetModelsTest extends TestCase{--- public function testRequiresPermissionToCreateAssetModel()+ public function test_requires_permission_to_create_asset_model(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.models.store'))->assertForbidden();}- public function testCanCreateAssetModelWithAssetModelType()+ public function test_can_create_asset_model_with_asset_model_type(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.models.store'), ['name' => 'Test AssetModel',- 'category_id' => Category::factory()->assetLaptopCategory()->create()->id+ 'category_id' => Category::factory()->assetLaptopCategory()->create()->id,])->assertOk()->assertStatusMessageIs('success')@@ -37,7 +34,7 @@ class CreateAssetModelsTest extends TestCase$this->assertEquals('Test AssetModel', $model->name);}- public function testCannotCreateAssetModelWithoutCategory()+ public function test_cannot_create_asset_model_without_category(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.models.store'), [@@ -48,7 +45,7 @@ class CreateAssetModelsTest extends TestCase->assertStatusMessageIs('error')->assertJson(['messages' => [- 'category_id' => ['The category id field is required.'],+ 'category_id' => ['The category id field is required.'],],])->json();@@ -57,48 +54,47 @@ class CreateAssetModelsTest extends TestCase}- public function testUniquenessAcrossModelNameAndModelNumber()+ public function test_uniqueness_across_model_name_and_model_number(){- AssetModel::factory()->create(['name' => 'Test Model', 'model_number'=>'1234']);+ AssetModel::factory()->create(['name' => 'Test Model', 'model_number' => '1234']);$this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.models.store'), ['name' => 'Test Model','model_number' => '1234',- 'category_id' => Category::factory()->assetLaptopCategory()->create()->id+ 'category_id' => Category::factory()->assetLaptopCategory()->create()->id,])->assertStatus(200)->assertOk()->assertStatusMessageIs('error')->assertJson(['messages' => [- 'name' => ['The name must be unique across models and model number. '],- 'model_number' => ['The model number must be unique across models and name. '],+ 'name' => ['The name must be unique across models and model number. '],+ 'model_number' => ['The model number must be unique across models and name. '],],])->json();}- public function testUniquenessAcrossModelNameAndModelNumberWithBlankModelNumber()+ public function test_uniqueness_across_model_name_and_model_number_with_blank_model_number(){AssetModel::factory()->create(['name' => 'Test Model']);$this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.models.store'), ['name' => 'Test Model',- 'category_id' => Category::factory()->assetLaptopCategory()->create()->id+ 'category_id' => Category::factory()->assetLaptopCategory()->create()->id,])->assertStatus(200)->assertOk()->assertStatusMessageIs('error')->assertJson(['messages' => [- 'name' => ['The name must be unique across models and model number. '],+ 'name' => ['The name must be unique across models and model number. '],],])->json();}-}diff --git a/tests/Feature/AssetModels/Api/DeleteAssetModelsTest.php b/tests/Feature/AssetModels/Api/DeleteAssetModelsTest.phpindex b80877cb06..8db335a36c 100644--- a/tests/Feature/AssetModels/Api/DeleteAssetModelsTest.php+++ b/tests/Feature/AssetModels/Api/DeleteAssetModelsTest.php@@ -21,7 +21,7 @@ class DeleteAssetModelsTest extends TestCase implements TestsPermissionsRequirem$this->assertNotSoftDeleted($assetModel);}- public function testCannotDeleteAssetModelThatStillHasAssociatedAssets()+ public function test_cannot_delete_asset_model_that_still_has_associated_assets(){$assetModel = Asset::factory()->create()->model;@@ -32,7 +32,7 @@ class DeleteAssetModelsTest extends TestCase implements TestsPermissionsRequirem$this->assertNotSoftDeleted($assetModel);}- public function testCanDeleteAssetModel()+ public function test_can_delete_asset_model(){$assetModel = AssetModel::factory()->create();diff --git a/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php b/tests/Feature/AssetModels/Api/IndexAssetModelsTest.phpindex 26e4dd75b1..c55ec57b39 100644--- a/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php+++ b/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php@@ -2,7 +2,6 @@namespace Tests\Feature\AssetModels\Api;-use App\Models\Company;use App\Models\AssetModel;use App\Models\User;use Illuminate\Testing\Fluent\AssertableJson;@@ -10,19 +9,19 @@ use Tests\TestCase;class IndexAssetModelsTest extends TestCase{- public function testViewingAssetModelIndexRequiresAuthentication()+ public function test_viewing_asset_model_index_requires_authentication(){$this->getJson(route('api.models.index'))->assertRedirect();}- public function testViewingAssetModelIndexRequiresPermission()+ public function test_viewing_asset_model_index_requires_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.models.index'))->assertForbidden();}- public function testAssetModelIndexReturnsExpectedAssetModels()+ public function test_asset_model_index_returns_expected_asset_models(){AssetModel::factory()->count(3)->create();@@ -39,10 +38,10 @@ class IndexAssetModelsTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}- public function testAssetModelIndexSearchReturnsExpectedAssetModels()+ public function test_asset_model_index_search_returns_expected_asset_models(){AssetModel::factory()->count(3)->create();AssetModel::factory()->count(1)->create(['name' => 'Test Model']);@@ -61,7 +60,6 @@ class IndexAssetModelsTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 1)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 1)->etc());}-}diff --git a/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.php b/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.phpindex c5ec212650..76aeb5492e 100644--- a/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.php+++ b/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.php@@ -9,8 +9,7 @@ use Tests\TestCase;class UpdateAssetModelsTest extends TestCase{-- public function testRequiresPermissionToEditAssetModel()+ public function test_requires_permission_to_edit_asset_model(){$model = AssetModel::factory()->create();$this->actingAsForApi(User::factory()->create())@@ -18,7 +17,7 @@ class UpdateAssetModelsTest extends TestCase->assertForbidden();}- public function testCanUpdateAssetModelViaPatch()+ public function test_can_update_asset_model_via_patch(){$model = AssetModel::factory()->create();@@ -37,7 +36,7 @@ class UpdateAssetModelsTest extends TestCase}- public function testCannotUpdateAssetModelViaPatchWithAccessoryCategory()+ public function test_cannot_update_asset_model_via_patch_with_accessory_category(){$category = Category::factory()->forAccessories()->create();$model = AssetModel::factory()->create();@@ -57,7 +56,7 @@ class UpdateAssetModelsTest extends TestCase$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');}- public function testCannotUpdateAssetModelViaPatchWithLicenseCategory()+ public function test_cannot_update_asset_model_via_patch_with_license_category(){$category = Category::factory()->forLicenses()->create();$model = AssetModel::factory()->create();@@ -77,7 +76,7 @@ class UpdateAssetModelsTest extends TestCase$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');}- public function testCannotUpdateAssetModelViaPatchWithConsumableCategory()+ public function test_cannot_update_asset_model_via_patch_with_consumable_category(){$category = Category::factory()->forConsumables()->create();$model = AssetModel::factory()->create();@@ -97,7 +96,7 @@ class UpdateAssetModelsTest extends TestCase$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');}- public function testCannotUpdateAssetModelViaPatchWithComponentCategory()+ public function test_cannot_update_asset_model_via_patch_with_component_category(){$category = Category::factory()->forComponents()->create();$model = AssetModel::factory()->create();@@ -116,5 +115,4 @@ class UpdateAssetModelsTest extends TestCase$this->assertNotEquals('Test Model', $model->name, 'Name was not updated');$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');}-}diff --git a/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.php b/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.phpindex 20772253a8..22e9b52c10 100644--- a/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.php+++ b/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.php@@ -9,24 +9,24 @@ use Tests\TestCase;class CreateAssetModelsTest extends TestCase{- public function testPermissionRequiredToCreateAssetModel()+ public function test_permission_required_to_create_asset_model(){$this->actingAs(User::factory()->create())->post(route('models.store'), ['name' => 'Test Model',- 'category_id' => Category::factory()->create()->id+ 'category_id' => Category::factory()->create()->id,])->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('models.create'))->assertOk();}- public function testUserCanCreateAssetModels()+ public function test_user_can_create_asset_models(){$this->assertFalse(AssetModel::where('name', 'Test Model')->exists());@@ -34,21 +34,21 @@ class CreateAssetModelsTest extends TestCase->from(route('models.create'))->post(route('models.store'), ['name' => 'Test Model',- 'category_id' => Category::factory()->create()->id+ 'category_id' => Category::factory()->create()->id,])->assertRedirect(route('models.index'));$this->assertTrue(AssetModel::where('name', 'Test Model')->exists());}- public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType()+ public function test_user_cannot_use_accessory_category_type_as_asset_model_category_type(){$response = $this->actingAs(User::factory()->superuser()->create())->from(route('models.create'))->post(route('models.store'), ['name' => 'Test Invalid Model Category',- 'category_id' => Category::factory()->forAccessories()->create()->id+ 'category_id' => Category::factory()->forAccessories()->create()->id,]);$response->assertStatus(302);$response->assertRedirect(route('models.create'));@@ -59,38 +59,38 @@ class CreateAssetModelsTest extends TestCase}- public function testUniquenessAcrossModelNameAndModelNumber()+ public function test_uniqueness_across_model_name_and_model_number(){- AssetModel::factory()->create(['name' => 'Test Model', 'model_number'=>'1234']);+ AssetModel::factory()->create(['name' => 'Test Model', 'model_number' => '1234']);$response = $this->actingAs(User::factory()->superuser()->create())->from(route('models.create'))->post(route('models.store'), ['name' => 'Test Model','model_number' => '1234',- 'category_id' => Category::factory()->create()->id+ 'category_id' => Category::factory()->create()->id,])->assertStatus(302)- ->assertSessionHasErrors(['name','model_number'])+ ->assertSessionHasErrors(['name', 'model_number'])->assertRedirect(route('models.create'))- ->assertInvalid(['name','model_number']);+ ->assertInvalid(['name', 'model_number']);$this->followRedirects($response)->assertSee(trans('general.error'));}- public function testUniquenessAcrossModelNameAndModelNumberWithoutModelNumber()+ public function test_uniqueness_across_model_name_and_model_number_without_model_number(){- AssetModel::factory()->create(['name' => 'Test Model', 'model_number'=> null]);+ AssetModel::factory()->create(['name' => 'Test Model', 'model_number' => null]);$response = $this->actingAs(User::factory()->superuser()->create())->from(route('models.create'))->post(route('models.store'), ['name' => 'Test Model','model_number' => null,- 'category_id' => Category::factory()->create()->id+ 'category_id' => Category::factory()->create()->id,])->assertStatus(302)->assertSessionHasErrors(['name'])@@ -100,5 +100,4 @@ class CreateAssetModelsTest extends TestCase$this->followRedirects($response)->assertSee(trans('general.error'));}-}diff --git a/tests/Feature/AssetModels/Ui/IndexAssetModelsTest.php b/tests/Feature/AssetModels/Ui/IndexAssetModelsTest.phpindex 495de30f0a..4fceea79dd 100644--- a/tests/Feature/AssetModels/Ui/IndexAssetModelsTest.php+++ b/tests/Feature/AssetModels/Ui/IndexAssetModelsTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class IndexAssetModelsTest extends TestCase{- public function testPermissionRequiredToViewAssetModelList()+ public function test_permission_required_to_view_asset_model_list(){$this->actingAs(User::factory()->create())->get(route('models.index'))->assertForbidden();}- public function testUserCanListAssetModels()+ public function test_user_can_list_asset_models(){$this->actingAs(User::factory()->superuser()->create())->get(route('models.index'))diff --git a/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.php b/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.phpindex 739112f59e..de982aa65a 100644--- a/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.php+++ b/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowAssetModelsTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('models.show', AssetModel::factory()->create()))diff --git a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.phpindex a46ecb849d..5436464301 100644--- a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php+++ b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php@@ -11,7 +11,7 @@ use Tests\TestCase;class UpdateAssetModelsTest extends TestCase{- public function testPermissionRequiredToUpdateAssetModel()+ public function test_permission_required_to_update_asset_model(){$this->actingAs(User::factory()->create())->put(route('models.update', ['model' => AssetModel::factory()->create()]), [@@ -21,14 +21,14 @@ class UpdateAssetModelsTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('models.edit', AssetModel::factory()->create()))->assertOk();}- public function testUserCanEditAssetModels()+ public function test_user_can_edit_asset_models(){$category = Category::factory()->forAssets()->create();$model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]);@@ -48,7 +48,7 @@ class UpdateAssetModelsTest extends TestCase}- public function testUserCannotChangeAssetModelCategoryType()+ public function test_user_cannot_change_asset_model_category_type(){$category = Category::factory()->forAssets()->create();$model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]);diff --git a/tests/Feature/Assets/Api/AssetFilesTest.php b/tests/Feature/Assets/Api/AssetFilesTest.phpindex ff87958170..c731055644 100644--- a/tests/Feature/Assets/Api/AssetFilesTest.php+++ b/tests/Feature/Assets/Api/AssetFilesTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class AssetFilesTest extends TestCase{- public function testAssetApiAcceptsFileUpload()+ public function test_asset_api_accepts_file_upload(){// Upload a file to an asset@@ -19,17 +19,17 @@ class AssetFilesTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'assets', 'id' => $asset->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testAssetApiListsFiles()+ public function test_asset_api_lists_files(){// List all files on an asset@@ -45,13 +45,13 @@ class AssetFilesTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testAssetApiDownloadsFile()+ public function test_asset_api_downloads_file(){// Download a file from an asset@@ -61,11 +61,11 @@ class AssetFilesTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'assets', 'id' => $asset->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -76,7 +76,7 @@ class AssetFilesTest extends TestCase->assertOk();}- public function testAssetApiDeletesFile()+ public function test_asset_api_deletes_file(){// Delete a file from an asset@@ -86,11 +86,11 @@ class AssetFilesTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'assets', 'id' => $asset->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -103,4 +103,4 @@ class AssetFilesTest extends TestCase->assertOk();}-}\ No newline at end of file+}diff --git a/tests/Feature/Assets/Api/AssetIndexTest.php b/tests/Feature/Assets/Api/AssetIndexTest.phpindex 6f1efa54fe..c780a4aef1 100644--- a/tests/Feature/Assets/Api/AssetIndexTest.php+++ b/tests/Feature/Assets/Api/AssetIndexTest.php@@ -11,7 +11,7 @@ use Tests\TestCase;class AssetIndexTest extends TestCase{- public function testAssetApiIndexReturnsExpectedAssets()+ public function test_asset_api_index_returns_expected_assets(){Asset::factory()->count(3)->create();@@ -28,29 +28,28 @@ class AssetIndexTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}- public function testAssetApiIndexReturnsDisplayUpcomingAuditsDue()+ public function test_asset_api_index_returns_display_upcoming_audits_due(){Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->format('Y-m-d')]);-$this->actingAsForApi(User::factory()->superuser()->create())->getJson(route('api.assets.list-upcoming', ['action' => 'audits', 'upcoming_status' => 'due']))- ->assertOk()- ->assertJsonStructure([- 'total',- 'rows',- ])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertOk()+ ->assertJsonStructure([+ 'total',+ 'rows',+ ])+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}- public function testAssetApiIndexReturnsOverdueForAudit()+ public function test_asset_api_index_returns_overdue_for_audit(){Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->subDays(1)->format('Y-m-d')]);-+$this->actingAsForApi(User::factory()->superuser()->create())->getJson(route('api.assets.list-upcoming', ['action' => 'audits', 'upcoming_status' => 'overdue']))@@ -59,15 +58,14 @@ class AssetIndexTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}-- public function testAssetApiIndexReturnsDueOrOverdueForAudit()+ public function test_asset_api_index_returns_due_or_overdue_for_audit(){Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->format('Y-m-d')]);Asset::factory()->count(2)->create(['next_audit_date' => Carbon::now()->subDays(1)->format('Y-m-d')]);-+$this->actingAsForApi(User::factory()->superuser()->create())->getJson(route('api.assets.list-upcoming', ['action' => 'audits', 'upcoming_status' => 'due-or-overdue']))@@ -76,15 +74,13 @@ class AssetIndexTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 5)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 5)->etc());}--- public function testAssetApiIndexReturnsDueForExpectedCheckin()+ public function test_asset_api_index_returns_due_for_expected_checkin(){Asset::factory()->count(3)->create(['assigned_to' => '1', 'assigned_type' => User::class, 'expected_checkin' => Carbon::now()->format('Y-m-d')]);-+$this->actingAsForApi(User::factory()->superuser()->create())->getJson(route('api.assets.list-upcoming', ['action' => 'checkins', 'upcoming_status' => 'due'])@@ -93,14 +89,14 @@ class AssetIndexTest extends TestCase->assertJsonStructure(['total','rows',- ])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ])+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}- public function testAssetApiIndexReturnsOverdueForExpectedCheckin()+ public function test_asset_api_index_returns_overdue_for_expected_checkin(){Asset::factory()->count(3)->create(['assigned_to' => '1', 'assigned_type' => User::class, 'expected_checkin' => Carbon::now()->subDays(1)->format('Y-m-d')]);-+$this->actingAsForApi(User::factory()->superuser()->create())->getJson(route('api.assets.list-upcoming', ['action' => 'checkins', 'upcoming_status' => 'overdue']))->assertOk()@@ -108,14 +104,14 @@ class AssetIndexTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}- public function testAssetApiIndexReturnsDueOrOverdueForExpectedCheckin()+ public function test_asset_api_index_returns_due_or_overdue_for_expected_checkin(){Asset::factory()->count(3)->create(['assigned_to' => '1', 'assigned_type' => User::class, 'expected_checkin' => Carbon::now()->subDays(1)->format('Y-m-d')]);Asset::factory()->count(2)->create(['assigned_to' => '1', 'assigned_type' => User::class, 'expected_checkin' => Carbon::now()->format('Y-m-d')]);-+$this->actingAsForApi(User::factory()->superuser()->create())->getJson(route('api.assets.list-upcoming', ['action' => 'checkins', 'upcoming_status' => 'due-or-overdue']))->assertOk()@@ -123,10 +119,10 @@ class AssetIndexTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 5)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 5)->etc());}- public function testAssetApiIndexAdheresToCompanyScoping()+ public function test_asset_api_index_adheres_to_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();@@ -185,7 +181,7 @@ class AssetIndexTest extends TestCase});}- public function testReturnsResultViaFilter()+ public function test_returns_result_via_filter(){Asset::factory()->count(3)->create(['name' => 'MY AWESOME ASSET NAME']);@@ -198,6 +194,6 @@ class AssetIndexTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}}diff --git a/tests/Feature/Assets/Api/AssetNotesTest.php b/tests/Feature/Assets/Api/AssetNotesTest.phpindex b3076c2852..d9304c5af7 100644--- a/tests/Feature/Assets/Api/AssetNotesTest.php+++ b/tests/Feature/Assets/Api/AssetNotesTest.php@@ -9,31 +9,31 @@ use Tests\TestCase;class AssetNotesTest extends TestCase{- public function testThatANonExistentAssetIdReturnsError()- {+ public function test_that_a_non_existent_asset_id_returns_error()+ {$this->actingAsForApi(User::factory()->editAssets()->create())->postJson(route('api.notes.store', ['asset' => 123456789]))->assertStatusMessageIs('error');}- public function testRequiresPermissionToAddNoteToAssetAsset()+ public function test_requires_permission_to_add_note_to_asset_asset(){$asset = Asset::factory()->create();$this->actingAsForApi(User::factory()->create())->postJson(route('api.notes.store', $asset), [- 'note' => 'test'+ 'note' => 'test',])->assertForbidden();}- public function testAssetNoteIsSaved()+ public function test_asset_note_is_saved(){$asset = Asset::factory()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->postJson(route('api.notes.store', $asset), [- 'note' => 'This is a test note.'+ 'note' => 'This is a test note.',])->assertStatusMessageIs('success')->assertJson([@@ -45,7 +45,7 @@ class AssetNotesTest extends TestCase])->assertStatus(200);- $note = ActionLog::where('item_id', $asset->id)+ $note = Actionlog::where('item_id', $asset->id)->where('action_type', 'note added')->first();@@ -53,7 +53,7 @@ class AssetNotesTest extends TestCase$this->assertEquals('This is a test note.', $note->note, 'The note content does not match.');}- public function testAssetNotesAreRetrievable()+ public function test_asset_notes_are_retrievable(){$asset = Asset::factory()->create();@@ -80,8 +80,8 @@ class AssetNotesTest extends TestCase'item_id' => $assetNote->item_id,'item_type' => Asset::class,'action_type' => 'note added',- ]- ]+ ],+ ],],]);}diff --git a/tests/Feature/Assets/Api/AssetsForSelectListTest.php b/tests/Feature/Assets/Api/AssetsForSelectListTest.phpindex de797651e4..d177d0f706 100644--- a/tests/Feature/Assets/Api/AssetsForSelectListTest.php+++ b/tests/Feature/Assets/Api/AssetsForSelectListTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class AssetsForSelectListTest extends TestCase{- public function testAssetsCanBeSearchedForByAssetTag()+ public function test_assets_can_be_searched_for_by_asset_tag(){Asset::factory()->create(['asset_tag' => '0001']);Asset::factory()->create(['asset_tag' => '0002']);@@ -21,11 +21,11 @@ class AssetsForSelectListTest extends TestCase$results = collect($response->json('results'));$this->assertEquals(2, $results->count());- $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, '0001')));- $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, '0002')));+ $this->assertTrue($results->pluck('text')->contains(fn ($text) => str_contains($text, '0001')));+ $this->assertTrue($results->pluck('text')->contains(fn ($text) => str_contains($text, '0002')));}- public function testAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled()+ public function test_assets_are_scoped_to_company_when_multiple_company_support_enabled(){[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Feature/Assets/Api/AuditAssetTest.php b/tests/Feature/Assets/Api/AuditAssetTest.phpindex b114cf8503..29b6c0300f 100644--- a/tests/Feature/Assets/Api/AuditAssetTest.php+++ b/tests/Feature/Assets/Api/AuditAssetTest.php@@ -3,26 +3,19 @@namespace Tests\Feature\Assets\Api;use App\Models\Asset;-use App\Models\AssetModel;-use App\Models\Company;-use App\Models\Location;-use App\Models\Statuslabel;-use App\Models\Supplier;use App\Models\User;-use App\Models\CustomField;-use Illuminate\Support\Facades\Crypt;use Tests\TestCase;class AuditAssetTest extends TestCase{- public function testThatANonExistentAssetIdReturnsError()+ public function test_that_a_non_existent_asset_id_returns_error(){$this->actingAsForApi(User::factory()->auditAssets()->create())->postJson(route('api.asset.audit', 123456789))->assertStatusMessageIs('error');}- public function testRequiresPermissionToAuditAsset()+ public function test_requires_permission_to_audit_asset(){$asset = Asset::factory()->create();$this->actingAsForApi(User::factory()->create())@@ -30,7 +23,7 @@ class AuditAssetTest extends TestCase->assertForbidden();}- public function testLegacyAssetAuditIsSaved()+ public function test_legacy_asset_audit_is_saved(){$asset = Asset::factory()->create();$this->actingAsForApi(User::factory()->auditAssets()->create())@@ -41,38 +34,35 @@ class AuditAssetTest extends TestCase->assertStatusMessageIs('success')->assertJson([- 'messages' =>trans('admin/hardware/message.audit.success'),+ 'messages' => trans('admin/hardware/message.audit.success'),'payload' => ['id' => $asset->id,'asset_tag' => $asset->asset_tag,- 'note' => 'test'+ 'note' => 'test',],])->assertStatus(200);}-- public function testAssetAuditIsSaved()+ public function test_asset_audit_is_saved(){$asset = Asset::factory()->create();$this->actingAsForApi(User::factory()->auditAssets()->create())->postJson(route('api.asset.audit', $asset), [- 'note' => 'test'+ 'note' => 'test',])->assertStatusMessageIs('success')->assertJson([- 'messages' =>trans('admin/hardware/message.audit.success'),+ 'messages' => trans('admin/hardware/message.audit.success'),'payload' => ['id' => $asset->id,'asset_tag' => $asset->asset_tag,- 'note' => 'test'+ 'note' => 'test',],])->assertStatus(200);$this->assertHasTheseActionLogs($asset, ['create', 'audit']);}--}diff --git a/tests/Feature/Assets/Api/CheckinCheckoutCounters.php b/tests/Feature/Assets/Api/CheckinCheckoutCounters.phpindex f8ead72674..b22370eba5 100644--- a/tests/Feature/Assets/Api/CheckinCheckoutCounters.php+++ b/tests/Feature/Assets/Api/CheckinCheckoutCounters.php@@ -17,22 +17,21 @@ use Tests\TestCase;class CheckinCheckoutCounters extends TestCase{#[Test]- function counters()+ public function counters(){- //make an admin who can check in and out stuff+ // make an admin who can check in and out stuff$admin = User::factory()->superuser()->create();- //make a user+ // make a user$user = User::factory()->create();- //need a model for the asset+ // need a model for the asset$model = AssetModel::factory()->create();- //need a status for the asset, too+ // need a status for the asset, too$status = Statuslabel::factory()->readyToDeploy()->create();-- //make an asset using the API (this is for the API after all!)+ // make an asset using the API (this is for the API after all!)$response = $this->actingAsForApi($admin)->postJson(route('api.assets.store'), ['asset_tag' => 'random_string',@@ -42,13 +41,12 @@ class CheckinCheckoutCounters extends TestCase->assertStatusMessageIs('success')->json();-- //check the counters+ // check the counters$asset = Asset::find($response['payload']['id']);$this->assertEquals(0, $asset->checkin_counter);$this->assertEquals(0, $asset->checkout_counter);- //do a checkout+ // do a checkout$this->actingAsForApi($admin)->postJson(route('api.asset.checkout', $asset), ['checkout_to_type' => 'user',@@ -61,11 +59,11 @@ class CheckinCheckoutCounters extends TestCase->assertOk();$asset->refresh();- //check the counters. both.+ // check the counters. both.$this->assertEquals(0, $asset->checkin_counter);- $this->assertEquals(1, $asset->checkout_counter); //why does _this_ fail?!+ $this->assertEquals(1, $asset->checkout_counter); // why does _this_ fail?!- //do a checkin+ // do a checkin$this->actingAsForApi(User::factory()->checkinAssets()->create())->postJson(route('api.asset.checkin', $asset), ['name' => 'Changed Name',@@ -73,9 +71,9 @@ class CheckinCheckoutCounters extends TestCase])->assertOk();- //check the counters, again.+ // check the counters, again.$asset->refresh();- $this->assertEquals(1, $asset->checkin_counter); //wait, _this_ fails too?! WTH?- $this->assertEquals(1, $asset->checkout_counter); //okay, _nothing_ works. Now I'm confused.+ $this->assertEquals(1, $asset->checkin_counter); // wait, _this_ fails too?! WTH?+ $this->assertEquals(1, $asset->checkout_counter); // okay, _nothing_ works. Now I'm confused.}}diff --git a/tests/Feature/Assets/Api/DeleteAssetsTest.php b/tests/Feature/Assets/Api/DeleteAssetsTest.phpindex a94e9f7ccd..20a06981e9 100644--- a/tests/Feature/Assets/Api/DeleteAssetsTest.php+++ b/tests/Feature/Assets/Api/DeleteAssetsTest.php@@ -53,12 +53,12 @@ class DeleteAssetsTest extends TestCase implements TestsFullMultipleCompaniesSup$this->assertSoftDeleted($assetC);}- public function testCannotDeleteAssetThatIsCheckedOut()+ public function test_cannot_delete_asset_that_is_checked_out(){$this->markTestSkipped('This behavior is not functioning yet.');}- public function testCanDeleteAsset()+ public function test_can_delete_asset(){$asset = Asset::factory()->create();diff --git a/tests/Feature/Assets/Api/RequestableAssetTest.php b/tests/Feature/Assets/Api/RequestableAssetTest.phpindex d24913ad66..4a48c06e1e 100644--- a/tests/Feature/Assets/Api/RequestableAssetTest.php+++ b/tests/Feature/Assets/Api/RequestableAssetTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class RequestableAssetTest extends TestCase{- public function testViewingRequestableAssetsRequiresCorrectPermission()+ public function test_viewing_requestable_assets_requires_correct_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.assets.requestable'))->assertForbidden();}- public function testReturnsRequestableAssets()+ public function test_returns_requestable_assets(){$requestableAsset = Asset::factory()->requestable()->create(['asset_tag' => 'requestable']);$nonRequestableAsset = Asset::factory()->nonrequestable()->create(['asset_tag' => 'non-requestable']);@@ -28,7 +28,7 @@ class RequestableAssetTest extends TestCase->assertResponseDoesNotContainInRows($nonRequestableAsset, 'asset_tag');}- public function testRequestableAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled()+ public function test_requestable_assets_are_scoped_to_company_when_multiple_company_support_enabled(){[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Feature/Assets/Api/StoreAssetTest.php b/tests/Feature/Assets/Api/StoreAssetTest.phpindex 29d643e1bb..bb4f934718 100644--- a/tests/Feature/Assets/Api/StoreAssetTest.php+++ b/tests/Feature/Assets/Api/StoreAssetTest.php@@ -18,15 +18,14 @@ use Tests\TestCase;class StoreAssetTest extends TestCase{-- public function testRequiresPermissionToCreateAsset()+ public function test_requires_permission_to_create_asset(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.assets.store'))->assertForbidden();}- public function testAllAssetAttributesAreStored()+ public function test_all_asset_attributes_are_stored(){$company = Company::factory()->create();$location = Location::factory()->create();@@ -88,7 +87,7 @@ class StoreAssetTest extends TestCase$this->assertHasTheseActionLogs($asset, ['create', 'checkout']);}- public function testSetsLastAuditDateToMidnightOfProvidedDate()+ public function test_sets_last_audit_date_to_midnight_of_provided_date(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [@@ -104,7 +103,7 @@ class StoreAssetTest extends TestCase$this->assertEquals('2023-09-03 00:00:00', $asset->last_audit_date);}- public function testLastAuditDateCanBeNull()+ public function test_last_audit_date_can_be_null(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [@@ -120,7 +119,7 @@ class StoreAssetTest extends TestCase$this->assertNull($asset->last_audit_date);}- public function testNonDateUsedForLastAuditDateReturnsValidationError()+ public function test_non_date_used_for_last_audit_date_returns_validation_error(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [@@ -135,7 +134,7 @@ class StoreAssetTest extends TestCase$this->assertNotNull($response->json('messages.last_audit_date'));}- public function testSaveWithArchivedStatusAndUserReturnsValidationError()+ public function test_save_with_archived_status_and_user_returns_validation_error(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [@@ -150,7 +149,7 @@ class StoreAssetTest extends TestCase$this->assertNotNull($response->json('messages.status_id'));}- public function testSaveWithPendingStatusAndUserReturnsValidationError()+ public function test_save_with_pending_status_and_user_returns_validation_error(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [@@ -161,13 +160,13 @@ class StoreAssetTest extends TestCase])->assertOk()->assertJson([- 'messages' => ['status_id' => [trans('admin/hardware/form.asset_not_deployable')]]+ 'messages' => ['status_id' => [trans('admin/hardware/form.asset_not_deployable')]],]);$this->assertNotNull($response->json('messages.status_id'));}- public function testSaveWithAssignedToChecksOut()+ public function test_save_with_assigned_to_checks_out(){$user = User::factory()->create();$response = $this->actingAsForApi(User::factory()->superuser()->create())@@ -185,17 +184,16 @@ class StoreAssetTest extends TestCase$this->assertEquals($user->id, $asset->assigned_to);$this->assertEquals('Asset created successfully. :)', $response->json('messages'));- $this->assertHasTheseActionLogs($asset, ['create'/*, 'checkout'*/]); // TODO - this _should_ be the two actions+ $this->assertHasTheseActionLogs($asset, ['create'/* , 'checkout' */]); // TODO - this _should_ be the two actions}-- public function testSaveWithNoAssignedTypeReturnsValidationError()+ public function test_save_with_no_assigned_type_returns_validation_error(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), ['asset_tag' => '1235','assigned_to' => '1',-// 'assigned_type' => User::class, //deliberately omit assigned_type+ // 'assigned_type' => User::class, //deliberately omit assigned_type'model_id' => AssetModel::factory()->create()->id,'status_id' => Statuslabel::factory()->readyToDeploy()->create()->id,])@@ -204,37 +202,37 @@ class StoreAssetTest extends TestCase$this->assertNotNull($response->json('messages.assigned_type'));}- public function testSaveWithBadAssignedTypeReturnsValidationError()+ public function test_save_with_bad_assigned_type_returns_validation_error(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [- 'asset_tag' => '1235',- 'assigned_to' => '1',- 'assigned_type' => 'nonsense_string', //deliberately bad assigned_type- 'model_id' => AssetModel::factory()->create()->id,- 'status_id' => Statuslabel::factory()->readyToDeploy()->create()->id,+ 'asset_tag' => '1235',+ 'assigned_to' => '1',+ 'assigned_type' => 'nonsense_string', // deliberately bad assigned_type+ 'model_id' => AssetModel::factory()->create()->id,+ 'status_id' => Statuslabel::factory()->readyToDeploy()->create()->id,])->assertOk()->assertStatusMessageIs('error');$this->assertNotNull($response->json('messages.assigned_type'));}- public function testSaveWithAssignedTypeAndNoAssignedToReturnsValidationError()+ public function test_save_with_assigned_type_and_no_assigned_to_returns_validation_error(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [- 'asset_tag' => '1235',- //'assigned_to' => '1', //deliberately omit assigned_to+ 'asset_tag' => '1235',+ // 'assigned_to' => '1', //deliberately omit assigned_to'assigned_type' => User::class,- 'model_id' => AssetModel::factory()->create()->id,- 'status_id' => Statuslabel::factory()->readyToDeploy()->create()->id,+ 'model_id' => AssetModel::factory()->create()->id,+ 'status_id' => Statuslabel::factory()->readyToDeploy()->create()->id,])->assertOk()->assertStatusMessageIs('error');$this->assertNotNull($response->json('messages.assigned_to'));}- public function testSaveWithPendingStatusWithoutUserIsSuccessful()+ public function test_save_with_pending_status_without_user_is_successful(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [@@ -246,8 +244,7 @@ class StoreAssetTest extends TestCase->assertStatusMessageIs('success');}-- public function testArchivedDepreciateAndPhysicalCanBeNull()+ public function test_archived_depreciate_and_physical_can_be_null(){$model = AssetModel::factory()->ipadModel()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -260,7 +257,7 @@ class StoreAssetTest extends TestCase'status_id' => $status->id,'archive' => null,'depreciate' => null,- 'physical' => null+ 'physical' => null,])->assertOk()->assertStatusMessageIs('success')@@ -272,7 +269,7 @@ class StoreAssetTest extends TestCase$this->assertEquals(0, $asset->depreciate);}- public function testArchivedDepreciateAndPhysicalCanBeEmpty()+ public function test_archived_depreciate_and_physical_can_be_empty(){$model = AssetModel::factory()->ipadModel()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -285,7 +282,7 @@ class StoreAssetTest extends TestCase'status_id' => $status->id,'archive' => '','depreciate' => '',- 'physical' => ''+ 'physical' => '',])->assertOk()->assertStatusMessageIs('success')@@ -297,7 +294,7 @@ class StoreAssetTest extends TestCase$this->assertEquals(0, $asset->depreciate);}- public function testAssetEolDateIsCalculatedIfPurchaseDateSet()+ public function test_asset_eol_date_is_calculated_if_purchase_date_set(){$model = AssetModel::factory()->mbp13Model()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -318,7 +315,7 @@ class StoreAssetTest extends TestCase$this->assertEquals('2024-01-01', $asset->asset_eol_date);}- public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet()+ public function test_asset_eol_date_is_not_calculated_if_purchase_date_not_set(){$model = AssetModel::factory()->mbp13Model()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -338,7 +335,7 @@ class StoreAssetTest extends TestCase$this->assertNull($asset->asset_eol_date);}- public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet()+ public function test_asset_eol_explicit_is_set_if_asset_eol_date_is_explicitly_set(){$model = AssetModel::factory()->mbp13Model()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -360,7 +357,7 @@ class StoreAssetTest extends TestCase$this->assertTrue($asset->eol_explicit);}- public function testAssetGetsAssetTagWithAutoIncrement()+ public function test_asset_gets_asset_tag_with_auto_increment(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -380,7 +377,7 @@ class StoreAssetTest extends TestCase$this->assertNotNull($asset->asset_tag);}- public function testAssetCreationFailsWithNoAssetTagOrAutoIncrement()+ public function test_asset_creation_fails_with_no_asset_tag_or_auto_increment(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -396,7 +393,7 @@ class StoreAssetTest extends TestCase->assertStatusMessageIs('error');}- public function testStoresPeriodAsDecimalSeparatorForPurchaseCost()+ public function test_stores_period_as_decimal_separator_for_purchase_cost(){$this->settings->set(['default_currency' => 'USD',@@ -418,7 +415,7 @@ class StoreAssetTest extends TestCase$this->assertEquals(12.34, $asset->purchase_cost);}- public function testStoresPeriodAsCommaSeparatorForPurchaseCost()+ public function test_stores_period_as_comma_separator_for_purchase_cost(){$this->settings->set(['default_currency' => 'EUR',@@ -440,7 +437,7 @@ class StoreAssetTest extends TestCase$this->assertEquals(12.34, $asset->purchase_cost);}- public function testUniqueSerialNumbersIsEnforcedWhenEnabled()+ public function test_unique_serial_numbers_is_enforced_when_enabled(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -468,7 +465,7 @@ class StoreAssetTest extends TestCase->assertStatusMessageIs('error');}- public function testUniqueSerialNumbersIsNotEnforcedWhenDisabled()+ public function test_unique_serial_numbers_is_not_enforced_when_disabled(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -496,7 +493,7 @@ class StoreAssetTest extends TestCase->assertStatusMessageIs('success');}- public function testAssetTagsMustBeUniqueWhenUndeleted()+ public function test_asset_tags_must_be_unique_when_undeleted(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -523,7 +520,7 @@ class StoreAssetTest extends TestCase->assertStatusMessageIs('error');}- public function testAssetTagsCanBeDuplicatedIfDeleted()+ public function test_asset_tags_can_be_duplicated_if_deleted(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -541,7 +538,7 @@ class StoreAssetTest extends TestCase->assertStatusMessageIs('success')->json();- Asset::find($response['payload']['id'])->delete();+ Asset::find($response['payload']['id'])->delete();$this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.assets.store'), [@@ -553,7 +550,7 @@ class StoreAssetTest extends TestCase->assertStatusMessageIs('success');}- public function testAnAssetCanBeCheckedOutToUserOnStore()+ public function test_an_asset_can_be_checked_out_to_user_on_store(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -621,7 +618,7 @@ class StoreAssetTest extends TestCase/** @link https://app.shortcut.com/grokability/story/29181 */#[DataProvider('checkoutTargets')]- public function testAssignedFieldValidationCannotBeArray($data)+ public function test_assigned_field_validation_cannot_be_array($data){['key' => $key, 'value' => $value] = $data();@@ -638,7 +635,7 @@ class StoreAssetTest extends TestCase});}- public function testAnAssetCanBeCheckedOutToLocationOnStore()+ public function test_an_asset_can_be_checked_out_to_location_on_store(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -665,7 +662,7 @@ class StoreAssetTest extends TestCase$this->assertHasTheseActionLogs($asset, ['create', 'checkout']);}- public function testAnAssetCanBeCheckedOutToAssetOnStore()+ public function test_an_asset_can_be_checked_out_to_asset_on_store(){$model = AssetModel::factory()->create();$status = Statuslabel::factory()->readyToDeploy()->create();@@ -690,13 +687,13 @@ class StoreAssetTest extends TestCase$this->assertTrue($apiAsset->checkedOutToAsset());// I think this makes sense, but open to a sanity check$this->assertTrue($asset->assignedAssets()->find($response['payload']['id'])->is($apiAsset));- $this->assertHasTheseActionLogs($asset, ['create'/*, 'checkout'*/]); // TODO - should be the two events+ $this->assertHasTheseActionLogs($asset, ['create'/* , 'checkout' */]); // TODO - should be the two events}/*** @link https://app.shortcut.com/grokability/story/24475*/- public function testCompanyIdNeedsToBeInteger()+ public function test_company_id_needs_to_be_integer(){$this->actingAsForApi(User::factory()->createAssets()->create())->postJson(route('api.assets.store'), [@@ -724,7 +721,7 @@ class StoreAssetTest extends TestCase->assertMessagesContains('serial');}- public function testEncryptedCustomFieldCanBeStored()+ public function test_encrypted_custom_field_can_be_stored(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');@@ -762,12 +759,12 @@ class StoreAssetTest extends TestCase$response = $this->actingAsForApi($superuser)->postJson(route('api.assets.store'), [- $alphaField->db_column_name() => 'Thisisencryptedfield',+ $alphaField->db_column_name() => 'Thisisencryptedfield',$numericField->db_column_name() => '1234567890',- $emailField->db_column_name() => '[email protected]',- 'model_id' => $assetData->model->id,- 'status_id' => $status->id,- 'asset_tag' => '1234',+ $emailField->db_column_name() => '[email protected]',+ 'model_id' => $assetData->model->id,+ 'status_id' => $status->id,+ 'asset_tag' => '1234',])->assertStatusMessageIs('success')->assertOk()@@ -795,9 +792,9 @@ class StoreAssetTest extends TestCase$response = $this->actingAsForApi($superuser)->postJson(route('api.assets.store'), [$alphaField->db_column_name() => 'Thisisencryptedfield123',- 'model_id' => $assetData->model->id,- 'status_id' => $status->id,- 'asset_tag' => '1234',+ 'model_id' => $assetData->model->id,+ 'status_id' => $status->id,+ 'asset_tag' => '1234',])->assertStatusMessageIs('error')->assertJsonPath('messages.'.$alphaField->db_column_name(), [trans('validation.alpha', ['attribute' => $cleaned_name])])@@ -805,8 +802,7 @@ class StoreAssetTest extends TestCase->json();}-- public function testPermissionNeededToStoreEncryptedField()+ public function test_permission_needed_to_store_encrypted_field(){// @todo:$this->markTestIncomplete();@@ -833,7 +829,7 @@ class StoreAssetTest extends TestCase$this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()}));}- public function testBase64AssetImages()+ public function test_base64_asset_images(){$status = Statuslabel::factory()->readyToDeploy()->create();$model = AssetModel::factory()->create();@@ -844,7 +840,7 @@ class StoreAssetTest extends TestCase'model_id' => $model->id,'status_id' => $status->id,'asset_tag' => '1234',- 'image' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAEsAQMAAADXeXeBAAAABlBMVEX+AAD///+KQee0AAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH5QQbCAoNcoiTQAAAACZJREFUaN7twTEBAAAAwqD1T20JT6AAAAAAAAAAAAAAAAAAAICnATvEAAEnf54JAAAAAElFTkSuQmCC'+ 'image' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAEsAQMAAADXeXeBAAAABlBMVEX+AAD///+KQee0AAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH5QQbCAoNcoiTQAAAACZJREFUaN7twTEBAAAAwqD1T20JT6AAAAAAAAAAAAAAAAAAAICnATvEAAEnf54JAAAAAElFTkSuQmCC',])->assertStatusMessageIs('success')->assertOk()@@ -852,8 +848,8 @@ class StoreAssetTest extends TestCase$asset = Asset::findOrFail($response['payload']['id']);$this->assertEquals($asset->asset_tag, '1234');- $image_data = Storage::disk('public')->get(app('assets_upload_path') . e($asset->image));- //$this->assertEquals('3d67fb99a0b6926e350f7b71397525d7a6b936c1', sha1($image_data)); //this doesn't work because the image gets resized - use the resized hash instead+ $image_data = Storage::disk('public')->get(app('assets_upload_path').e($asset->image));+ // $this->assertEquals('3d67fb99a0b6926e350f7b71397525d7a6b936c1', sha1($image_data)); //this doesn't work because the image gets resized - use the resized hash instead$this->assertEquals('db2e13ba04318c99058ca429d67777322f48566b', sha1($image_data));}}diff --git a/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.php b/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.phpindex 3cfaea1572..6cb1974522 100644--- a/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.php+++ b/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.php@@ -17,7 +17,7 @@ class StoreAssetWithFullMultipleCompanySupportTest extends TestCase* @link https://github.com/grokability/snipe-it/issues/15654*/#[DataProvider('dataForFullMultipleCompanySupportTesting')]- public function testAdheresToFullMultipleCompaniesSupportScoping($data)+ public function test_adheres_to_full_multiple_companies_support_scoping($data){['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();@@ -37,7 +37,7 @@ class StoreAssetWithFullMultipleCompanySupportTest extends TestCase}#[DataProvider('dataForFullMultipleCompanySupportTesting')]- public function testHandlesCompanyIdBeingString($data)+ public function test_handles_company_id_being_string($data){['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();diff --git a/tests/Feature/Assets/Api/UpdateAssetTest.php b/tests/Feature/Assets/Api/UpdateAssetTest.phpindex e04f3f6811..91f4442e2f 100644--- a/tests/Feature/Assets/Api/UpdateAssetTest.php+++ b/tests/Feature/Assets/Api/UpdateAssetTest.php@@ -5,24 +5,24 @@ namespace Tests\Feature\Assets\Api;use App\Models\Asset;use App\Models\AssetModel;use App\Models\Company;+use App\Models\CustomField;use App\Models\Location;use App\Models\Statuslabel;use App\Models\Supplier;use App\Models\User;-use App\Models\CustomField;use Illuminate\Support\Facades\Crypt;use Tests\TestCase;class UpdateAssetTest extends TestCase{- public function testThatANonExistentAssetIdReturnsError()+ public function test_that_a_non_existent_asset_id_returns_error(){$this->actingAsForApi(User::factory()->editAssets()->createAssets()->create())->patchJson(route('api.assets.update', 123456789))->assertStatusMessageIs('error');}- public function testRequiresPermissionToUpdateAsset()+ public function test_requires_permission_to_update_asset(){$asset = Asset::factory()->create();@@ -31,19 +31,18 @@ class UpdateAssetTest extends TestCase->assertForbidden();}- public function testGivenPermissionUpdateAssetIsAllowed()-+ public function test_given_permission_update_asset_is_allowed(){$asset = Asset::factory()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), [- 'name' => 'test'+ 'name' => 'test',])->assertOk();}- public function testAllAssetAttributesAreStored()+ public function test_all_asset_attributes_are_stored(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -99,11 +98,11 @@ class UpdateAssetTest extends TestCase$this->assertTrue($updatedAsset->assetstatus->is($status));$this->assertTrue($updatedAsset->supplier->is($supplier));$this->assertEquals(10, $updatedAsset->warranty_months);- //$this->assertEquals('2023-09-03 00:00:00', $updatedAsset->last_audit_date->format('Y-m-d H:i:s'));+ // $this->assertEquals('2023-09-03 00:00:00', $updatedAsset->last_audit_date->format('Y-m-d H:i:s'));$this->assertEquals('2023-09-03 00:00:00', $updatedAsset->last_audit_date);}- public function testUpdatesPeriodAsCommaSeparatorForPurchaseCost()+ public function test_updates_period_as_comma_separator_for_purchase_cost(){$this->settings->set(['default_currency' => 'EUR',@@ -127,7 +126,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals(1112.34, $asset->purchase_cost);}- public function testUpdatesFloatForPurchaseCost()+ public function test_updates_float_for_purchase_cost(){$this->settings->set(['default_currency' => 'EUR',@@ -151,7 +150,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals(12.34, $asset->purchase_cost);}- public function testUpdatesUSDecimalForPurchaseCost()+ public function test_updates_us_decimal_for_purchase_cost(){$this->settings->set(['default_currency' => 'EUR',@@ -166,7 +165,7 @@ class UpdateAssetTest extends TestCase'model_id' => AssetModel::factory()->create()->id,'status_id' => Statuslabel::factory()->create()->id,// API also accepts string for comma separated values- 'purchase_cost' => '5412.34', //NOTE - you cannot use thousands-separator here!!!!+ 'purchase_cost' => '5412.34', // NOTE - you cannot use thousands-separator here!!!!])->assertStatusMessageIs('success');@@ -175,7 +174,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals(5412.34, $asset->purchase_cost);}- public function testUpdatesFloatUSDecimalForPurchaseCost()+ public function test_updates_float_us_decimal_for_purchase_cost(){$this->settings->set(['default_currency' => 'EUR',@@ -199,7 +198,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals(12.34, $asset->purchase_cost);}- public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated()+ public function test_asset_eol_date_is_calculated_if_purchase_date_updated(){$asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create();@@ -216,14 +215,14 @@ class UpdateAssetTest extends TestCase$this->assertEquals('2024-01-01', $asset->asset_eol_date);}- public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet()+ public function test_asset_eol_date_is_not_calculated_if_purchase_date_not_set(){$asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), ['name' => 'test asset',- 'asset_eol_date' => '2022-01-01'+ 'asset_eol_date' => '2022-01-01',])->assertOk()->assertStatusMessageIs('success')@@ -234,7 +233,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals('2022-01-01', $asset->asset_eol_date);}- public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet()+ public function test_asset_eol_explicit_is_set_if_asset_eol_date_is_explicitly_set(){$asset = Asset::factory()->laptopMbp()->create();@@ -252,7 +251,7 @@ class UpdateAssetTest extends TestCase$this->assertTrue($asset->eol_explicit);}- public function testAssetTagCannotUpdateToNullValue()+ public function test_asset_tag_cannot_update_to_null_value(){$asset = Asset::factory()->laptopMbp()->create();@@ -264,77 +263,77 @@ class UpdateAssetTest extends TestCase->assertStatusMessageIs('error');}- public function testAssetTagCannotUpdateToEmptyStringValue()+ public function test_asset_tag_cannot_update_to_empty_string_value(){$asset = Asset::factory()->laptopMbp()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), [- 'asset_tag' => "",+ 'asset_tag' => '',])->assertOk()->assertStatusMessageIs('error');}- public function testModelIdCannotUpdateToNullValue()+ public function test_model_id_cannot_update_to_null_value(){$asset = Asset::factory()->laptopMbp()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), [- 'model_id' => null+ 'model_id' => null,])->assertOk()->assertStatusMessageIs('error');}- public function testModelIdCannotUpdateToEmptyStringValue()+ public function test_model_id_cannot_update_to_empty_string_value(){$asset = Asset::factory()->laptopMbp()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), [- 'model_id' => ""+ 'model_id' => '',])->assertOk()->assertStatusMessageIs('error');}- public function testStatusIdCannotUpdateToNullValue()+ public function test_status_id_cannot_update_to_null_value(){$asset = Asset::factory()->laptopMbp()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), [- 'status_id' => null+ 'status_id' => null,])->assertOk()->assertStatusMessageIs('error');}- public function testStatusIdCannotUpdateToEmptyStringValue()+ public function test_status_id_cannot_update_to_empty_string_value(){$asset = Asset::factory()->laptopMbp()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), [- 'status_id' => ""+ 'status_id' => '',])->assertOk()->assertStatusMessageIs('error');}- public function testIfRtdLocationIdIsSetWithoutLocationIdAssetReturnsToDefault()+ public function test_if_rtd_location_id_is_set_without_location_id_asset_returns_to_default(){$location = Location::factory()->create();$asset = Asset::factory()->laptopMbp()->create([- 'location_id' => $location->id+ 'location_id' => $location->id,]);$rtdLocation = Location::factory()->create();$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), [- 'rtd_location_id' => $rtdLocation->id+ 'rtd_location_id' => $rtdLocation->id,]);$asset->refresh();@@ -343,7 +342,7 @@ class UpdateAssetTest extends TestCase$this->assertTrue($asset->location->is($rtdLocation));}- public function testIfLocationAndRtdLocationAreSetLocationIdIsLocation()+ public function test_if_location_and_rtd_location_are_set_location_id_is_location(){$location = Location::factory()->create();$asset = Asset::factory()->laptopMbp()->create();@@ -352,7 +351,7 @@ class UpdateAssetTest extends TestCase$this->actingAsForApi(User::factory()->editAssets()->create())->patchJson(route('api.assets.update', $asset->id), ['rtd_location_id' => $rtdLocation->id,- 'location_id' => $location->id+ 'location_id' => $location->id,]);$asset->refresh();@@ -361,7 +360,7 @@ class UpdateAssetTest extends TestCase$this->assertTrue($asset->location->is($location));}- public function testEncryptedCustomFieldCanBeUpdated()+ public function test_encrypted_custom_field_can_be_updated(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');@@ -371,7 +370,7 @@ class UpdateAssetTest extends TestCase$this->actingAsForApi($superuser)->patchJson(route('api.assets.update', $asset->id), [- $field->db_column_name() => 'This is encrypted field'+ $field->db_column_name() => 'This is encrypted field',])->assertStatusMessageIs('success')->assertOk();@@ -380,7 +379,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()}));}- public function testPermissionNeededToUpdateEncryptedField()+ public function test_permission_needed_to_update_encrypted_field(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');@@ -388,23 +387,23 @@ class UpdateAssetTest extends TestCase$asset = Asset::factory()->hasEncryptedCustomField($field)->create();$normal_user = User::factory()->editAssets()->create();- $asset->{$field->db_column_name()} = Crypt::encrypt("encrypted value should not change");+ $asset->{$field->db_column_name()} = Crypt::encrypt('encrypted value should not change');$asset->save();// test that a 'normal' user *cannot* change the encrypted custom field$this->actingAsForApi($normal_user)->patchJson(route('api.assets.update', $asset->id), [- $field->db_column_name() => 'Some Other Value Entirely!'+ $field->db_column_name() => 'Some Other Value Entirely!',])->assertStatusMessageIs('success')->assertOk()->assertMessagesAre('Asset updated successfully, but encrypted custom fields were not due to permissions');$asset->refresh();- $this->assertEquals("encrypted value should not change", Crypt::decrypt($asset->{$field->db_column_name()}));+ $this->assertEquals('encrypted value should not change', Crypt::decrypt($asset->{$field->db_column_name()}));}- public function testCheckoutToUserOnAssetUpdate()+ public function test_checkout_to_user_on_asset_update(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -423,7 +422,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals($asset->assigned_type, 'App\Models\User');}- public function testCheckoutToUserWithAssignedToAndAssignedType()+ public function test_checkout_to_user_with_assigned_to_and_assigned_type(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -432,7 +431,7 @@ class UpdateAssetTest extends TestCase$response = $this->actingAsForApi($user)->patchJson(route('api.assets.update', $asset->id), ['assigned_to' => $assigned_user->id,- 'assigned_type' => User::class+ 'assigned_type' => User::class,])->assertOk()->assertStatusMessageIs('success')@@ -443,7 +442,7 @@ class UpdateAssetTest extends TestCase$this->assertEquals($asset->assigned_type, 'App\Models\User');}- public function testCheckoutToUserWithAssignedToWithoutAssignedType()+ public function test_checkout_to_user_with_assigned_to_without_assigned_type(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -452,7 +451,7 @@ class UpdateAssetTest extends TestCase$response = $this->actingAsForApi($user)->patchJson(route('api.assets.update', $asset->id), ['assigned_to' => $assigned_user->id,-// 'assigned_type' => User::class //deliberately omit assigned_type+ // 'assigned_type' => User::class //deliberately omit assigned_type])->assertOk()->assertStatusMessageIs('error');@@ -463,7 +462,7 @@ class UpdateAssetTest extends TestCase$this->assertNotNull($response->json('messages.assigned_type'));}- public function testCheckoutToUserWithAssignedToWithBadAssignedType()+ public function test_checkout_to_user_with_assigned_to_with_bad_assigned_type(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -471,8 +470,8 @@ class UpdateAssetTest extends TestCase$response = $this->actingAsForApi($user)->patchJson(route('api.assets.update', $asset->id), [- 'assigned_to' => $assigned_user->id,- 'assigned_type' => 'more_deliberate_nonsense' //deliberately bad assigned_type+ 'assigned_to' => $assigned_user->id,+ 'assigned_type' => 'more_deliberate_nonsense', // deliberately bad assigned_type])->assertOk()->assertStatusMessageIs('error');@@ -483,7 +482,7 @@ class UpdateAssetTest extends TestCase$this->assertNotNull($response->json('messages.assigned_type'));}- public function testCheckoutToUserWithoutAssignedToWithAssignedType()+ public function test_checkout_to_user_without_assigned_to_with_assigned_type(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -491,8 +490,8 @@ class UpdateAssetTest extends TestCase$response = $this->actingAsForApi($user)->patchJson(route('api.assets.update', $asset->id), [- //'assigned_to' => $assigned_user->id, // deliberately omit assigned_to- 'assigned_type' => User::class+ // 'assigned_to' => $assigned_user->id, // deliberately omit assigned_to+ 'assigned_type' => User::class,])->assertOk()->assertStatusMessageIs('error');@@ -503,7 +502,7 @@ class UpdateAssetTest extends TestCase$this->assertNotNull($response->json('messages.assigned_to'));}- public function testCheckoutToDeletedUserFailsOnAssetUpdate()+ public function test_checkout_to_deleted_user_fails_on_asset_update(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -522,7 +521,7 @@ class UpdateAssetTest extends TestCase$this->assertNull($asset->assigned_type);}- public function testCheckoutToLocationOnAssetUpdate()+ public function test_checkout_to_location_on_asset_update(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -542,7 +541,7 @@ class UpdateAssetTest extends TestCase}- public function testCheckoutToDeletedLocationFailsOnAssetUpdate()+ public function test_checkout_to_deleted_location_fails_on_asset_update(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -561,7 +560,7 @@ class UpdateAssetTest extends TestCase$this->assertNull($asset->assigned_type);}- public function testCheckoutAssetOnAssetUpdate()+ public function test_checkout_asset_on_asset_update(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -569,7 +568,7 @@ class UpdateAssetTest extends TestCase$this->actingAsForApi($user)->patchJson(route('api.assets.update', $asset->id), [- 'assigned_asset' => $assigned_asset->id,+ 'assigned_asset' => $assigned_asset->id,'checkout_to_type' => 'user',])->assertOk()@@ -582,7 +581,7 @@ class UpdateAssetTest extends TestCase}- public function testCheckoutToDeletedAssetFailsOnAssetUpdate()+ public function test_checkout_to_deleted_asset_fails_on_asset_update(){$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -601,7 +600,7 @@ class UpdateAssetTest extends TestCase$this->assertNull($asset->assigned_type);}- public function testAssetCannotBeUpdatedByUserInSeparateCompany()+ public function test_asset_cannot_be_updated_by_user_in_separate_company(){$this->settings->enableMultipleFullCompanySupport();@@ -614,24 +613,24 @@ class UpdateAssetTest extends TestCase'company_id' => $companyB->id,]);$asset = Asset::factory()->create([- 'created_by' => $userA->id,+ 'created_by' => $userA->id,'company_id' => $companyA->id,]);$this->actingAsForApi($userB)->patchJson(route('api.assets.update', $asset->id), [- 'name' => 'test name'+ 'name' => 'test name',])->assertStatusMessageIs('error');$this->actingAsForApi($userA)->patchJson(route('api.assets.update', $asset->id), [- 'name' => 'test name'+ 'name' => 'test name',])->assertStatusMessageIs('success');}- public function testCustomFieldCannotBeUpdatedIfNotOnCurrentAssetModel()+ public function test_custom_field_cannot_be_updated_if_not_on_current_asset_model(){$this->markIncompleteIfMySQL('Custom Field Tests do not work in MySQL');diff --git a/tests/Feature/Assets/Ui/AssetIndexTest.php b/tests/Feature/Assets/Ui/AssetIndexTest.phpindex 6963caf28f..c3ed0fbad3 100644--- a/tests/Feature/Assets/Ui/AssetIndexTest.php+++ b/tests/Feature/Assets/Ui/AssetIndexTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class AssetIndexTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('hardware.index'))diff --git a/tests/Feature/Assets/Ui/AssetLabelTest.php b/tests/Feature/Assets/Ui/AssetLabelTest.phpindex ddf57828bf..0666dfbc6d 100644--- a/tests/Feature/Assets/Ui/AssetLabelTest.php+++ b/tests/Feature/Assets/Ui/AssetLabelTest.php@@ -2,35 +2,32 @@namespace Tests\Feature\Assets\Ui;-use App\Models\Accessory;-use App\Models\Actionlog;use App\Models\Asset;use App\Models\User;use Tests\TestCase;class AssetLabelTest extends TestCase{- public function testUserWithPermissionsCanAccessPage()+ public function test_user_with_permissions_can_access_page(){$assets = Asset::factory()->count(20)->create();$id_array = $assets->pluck('id')->toArray();$this->actingAs(User::factory()->viewAssets()->create())->post('/hardware/bulkedit', [- 'ids' => $id_array,- 'bulk_actions' => 'labels',+ 'ids' => $id_array,+ 'bulk_actions' => 'labels',])->assertStatus(200);}- public function testRedirectOfNoAssetsSelected()+ public function test_redirect_of_no_assets_selected(){$id_array = [];$this->actingAs(User::factory()->viewAssets()->create())->from(route('hardware.index'))->post('/hardware/bulkedit', [- 'ids' => $id_array,- 'bulk_actions' => 'Labels',- ])->assertStatus(302)- ->assertRedirect(route('hardware.index'));+ 'ids' => $id_array,+ 'bulk_actions' => 'Labels',+ ])->assertStatus(302)+ ->assertRedirect(route('hardware.index'));}-}diff --git a/tests/Feature/Assets/Ui/AuditAssetTest.php b/tests/Feature/Assets/Ui/AuditAssetTest.phpindex 473a5af531..e6864c6665 100644--- a/tests/Feature/Assets/Ui/AuditAssetTest.php+++ b/tests/Feature/Assets/Ui/AuditAssetTest.php@@ -8,28 +8,28 @@ use Tests\TestCase;class AuditAssetTest extends TestCase{- public function testPermissionRequiredToViewAuditCreatePage()+ public function test_permission_required_to_view_audit_create_page(){$this->actingAs(User::factory()->create())->get(route('asset.audit.create', Asset::factory()->create()))->assertForbidden();}- public function testPageCanBeAccessed(): void+ public function test_page_can_be_accessed(): void{$this->actingAs(User::factory()->auditAssets()->create())->get(route('asset.audit.create', Asset::factory()->create()))->assertStatus(200);}- public function testPermissionRequiredToAuditAsset()+ public function test_permission_required_to_audit_asset(){$this->actingAs(User::factory()->create())->post(route('asset.audit.store', Asset::factory()->create()))->assertForbidden();}- public function testAssetAuditPostIsRedirectedToAssetIndexIfRedirectSelectionIsIndex()+ public function test_asset_audit_post_is_redirected_to_asset_index_if_redirect_selection_is_index(){$asset = Asset::factory()->create();@@ -46,7 +46,7 @@ class AuditAssetTest extends TestCase$this->assertHasTheseActionLogs($asset, ['create', 'audit']);}- public function testAssetAuditPostIsRedirectedToAssetPageIfRedirectSelectionIsAsset()+ public function test_asset_audit_post_is_redirected_to_asset_page_if_redirect_selection_is_asset(){$asset = Asset::factory()->create();@@ -62,7 +62,7 @@ class AuditAssetTest extends TestCase$this->assertHasTheseActionLogs($asset, ['create', 'audit']); // WAT.}- public function testAssetAuditPostIsRedirectedToAuditDuePageIfRedirectSelectionIsList()+ public function test_asset_audit_post_is_redirected_to_audit_due_page_if_redirect_selection_is_list(){$asset = Asset::factory()->create();@@ -77,5 +77,4 @@ class AuditAssetTest extends TestCase$this->followRedirects($response)->assertSee('success');$this->assertHasTheseActionLogs($asset, ['create', 'audit']);}-}diff --git a/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.php b/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.phpindex 59906cf4aa..33d436aded 100644--- a/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.php+++ b/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.php@@ -2,15 +2,13 @@namespace Tests\Feature\Assets\Ui;-use App\Models\Accessory;-use App\Models\Actionlog;use App\Models\Asset;use App\Models\User;use Tests\TestCase;class BulkDeleteAssetsTest extends TestCase{- public function testUserWithPermissionsCanAccessPage()+ public function test_user_with_permissions_can_access_page(){$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$assets = Asset::factory()->count(2)->create();@@ -18,14 +16,14 @@ class BulkDeleteAssetsTest extends TestCase$id_array = $assets->pluck('id')->toArray();$this->actingAs($user)->post('/hardware/bulkedit', [- 'ids' => $id_array,- 'order' => 'asc',+ 'ids' => $id_array,+ 'order' => 'asc','bulk_actions' => 'delete',- 'sort' => 'id'+ 'sort' => 'id',])->assertStatus(200);}- public function testStandardUserCannotAccessPage()+ public function test_standard_user_cannot_access_page(){$user = User::factory()->create();$assets = Asset::factory()->count(2)->create();@@ -33,32 +31,32 @@ class BulkDeleteAssetsTest extends TestCase$id_array = $assets->pluck('id')->toArray();$this->actingAs($user)->post('/hardware/bulkdelete', [- 'ids' => $id_array,+ 'ids' => $id_array,'bulk_actions' => 'delete',])->assertStatus(403);}- public function testPageRedirectFromInterstitialIfNoAssetsSelectedToDelete()+ public function test_page_redirect_from_interstitial_if_no_assets_selected_to_delete(){$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$response = $this->actingAs($user)->post('/hardware/bulkdelete', [- 'ids' => null,+ 'ids' => null,'bulk_actions' => 'delete',- ])- ->assertStatus(302)- ->assertRedirect(route('hardware.index'));+ ])+ ->assertStatus(302)+ ->assertRedirect(route('hardware.index'));- $this->followRedirects($response)->assertSee('alert-danger');+ $this->followRedirects($response)->assertSee('alert-danger');}- public function testPageRedirectFromInterstitialIfNoAssetsSelectedToRestore()+ public function test_page_redirect_from_interstitial_if_no_assets_selected_to_restore(){$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$response = $this->actingAs($user)->from(route('hardware.index'))->post('/hardware/bulkrestore', [- 'ids' => null,+ 'ids' => null,'bulk_actions' => 'delete',])->assertStatus(302)@@ -67,8 +65,7 @@ class BulkDeleteAssetsTest extends TestCase$this->followRedirects($response)->assertSee('alert-danger');}-- public function testBulkDeleteSelectedAssetsFromInterstitial()+ public function test_bulk_delete_selected_assets_from_interstitial(){$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$assets = Asset::factory()->count(2)->create();@@ -78,11 +75,11 @@ class BulkDeleteAssetsTest extends TestCase$response = $this->actingAs($user)->from(route('hardware.bulkdelete.store'))->post('/hardware/bulkdelete', [- 'ids' => $id_array,- 'bulk_actions' => 'delete',- ])->assertStatus(302);+ 'ids' => $id_array,+ 'bulk_actions' => 'delete',+ ])->assertStatus(302);- Asset::findMany($id_array)->each(function (Asset $asset) {+ Asset::findMany($id_array)->each(function (Asset $asset) {$this->assertNotNull($asset->deleted_at);$this->assertHasTheseActionLogs($asset, ['create', 'delete']);});@@ -90,7 +87,7 @@ class BulkDeleteAssetsTest extends TestCase$this->followRedirects($response)->assertSee('alert-success');}- public function testBulkRestoreSelectedAssetsFromInterstitial()+ public function test_bulk_restore_selected_assets_from_interstitial(){$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$asset = Asset::factory()->deleted()->create();@@ -106,12 +103,12 @@ class BulkDeleteAssetsTest extends TestCase$test_ran = true;$this->assertNotNull($asset->deleted_at);});- $this->assertTrue($test_ran, "Test never actually ran!");+ $this->assertTrue($test_ran, 'Test never actually ran!');$response = $this->actingAs($user)->from(route('hardware.bulkdelete.store'))->post(route('hardware/bulkrestore'), [- 'ids' => [$asset->id],+ 'ids' => [$asset->id],])->assertStatus(302);$this->followRedirects($response)->assertSee('alert-success');@@ -120,13 +117,12 @@ class BulkDeleteAssetsTest extends TestCaseAsset::findMany($id_array)->each(function (Asset $asset) use (&$test_ran) {$test_ran = true;$this->assertNull($asset->deleted_at);- $this->assertHasTheseActionLogs($asset, ['create',/* 'delete',*/ 'restore'/*, 'fart'*/]); //SHIT+ $this->assertHasTheseActionLogs($asset, ['create', /* 'delete', */ 'restore'/* , 'fart' */]); // SHIT});- $this->assertTrue($test_ran, "Test never actually ran!");+ $this->assertTrue($test_ran, 'Test never actually ran!');}-- public function testActionLogCreatedUponBulkDelete()+ public function test_action_log_created_upon_bulk_delete(){$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$asset = Asset::factory()->create();@@ -134,7 +130,7 @@ class BulkDeleteAssetsTest extends TestCase$this->actingAs($user)->from(route('hardware.bulkdelete.store'))->post('/hardware/bulkdelete', [- 'ids' => [$asset->id],+ 'ids' => [$asset->id],'bulk_actions' => 'delete',]);@@ -153,7 +149,7 @@ class BulkDeleteAssetsTest extends TestCase$this->assertNull($asset->assigned_type);}- public function testActionLogCreatedUponBulkRestore()+ public function test_action_log_created_upon_bulk_restore(){$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$asset = Asset::factory()->deleted()->create();@@ -161,7 +157,7 @@ class BulkDeleteAssetsTest extends TestCase$this->actingAs($user)->from(route('hardware.bulkdelete.store'))->post(route('hardware/bulkrestore'), [- 'ids' => [$asset->id],+ 'ids' => [$asset->id],'bulk_actions' => 'restore',]);@@ -176,7 +172,8 @@ class BulkDeleteAssetsTest extends TestCase);}- public function testBulkDeleteAssignedAssetTriggersError(){+ public function test_bulk_delete_assigned_asset_triggers_error()+ {$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();$asset = Asset::factory()->create(['id' => 5,@@ -186,19 +183,17 @@ class BulkDeleteAssetsTest extends TestCase]);$response = $this->actingAs($user)- ->from(route('hardware.bulkdelete.store'))- ->post('/hardware/bulkdelete', [- 'ids' => [$asset->id],- 'bulk_actions' => 'delete',- ]);+ ->from(route('hardware.bulkdelete.store'))+ ->post('/hardware/bulkdelete', [+ 'ids' => [$asset->id],+ 'bulk_actions' => 'delete',+ ]);$this->assertEquals(302, $response->getStatusCode());$this->assertEquals(route('hardware.index'), $response->headers->get('Location'));-$errorMessage = session('error');- $expectedMessage = trans_choice('admin/hardware/message.delete.assigned_to_error',1, ['asset_tag' => $asset->asset_tag]);+ $expectedMessage = trans_choice('admin/hardware/message.delete.assigned_to_error', 1, ['asset_tag' => $asset->asset_tag]);$this->assertEquals($expectedMessage, $errorMessage);- }-+ }}diff --git a/tests/Feature/Assets/Ui/BulkEditAssetsTest.php b/tests/Feature/Assets/Ui/BulkEditAssetsTest.phpindex efedca4ca6..73ec810be1 100644--- a/tests/Feature/Assets/Ui/BulkEditAssetsTest.php+++ b/tests/Feature/Assets/Ui/BulkEditAssetsTest.php@@ -14,7 +14,7 @@ use Tests\TestCase;class BulkEditAssetsTest extends TestCase{- public function testUserWithPermissionsCanAccessPage()+ public function test_user_with_permissions_can_access_page(){$user = User::factory()->viewAssets()->editAssets()->create();$assets = Asset::factory()->count(2)->create();@@ -22,10 +22,10 @@ class BulkEditAssetsTest extends TestCase$id_array = $assets->pluck('id')->toArray();$this->actingAs($user)->post('/hardware/bulkedit', [- 'ids' => $id_array,- 'order' => 'asc',+ 'ids' => $id_array,+ 'order' => 'asc','bulk_actions' => 'edit',- 'sort' => 'id'+ 'sort' => 'id',])->assertStatus(200);}@@ -44,7 +44,7 @@ class BulkEditAssetsTest extends TestCase'ids' => $id_array,'order' => 'asc','bulk_actions' => 'edit',- 'sort' => 'id'+ 'sort' => 'id',])->assertStatus(200);}@@ -56,10 +56,10 @@ class BulkEditAssetsTest extends TestCase$id_array = $assets->pluck('id')->toArray();$this->actingAs($user)->post('/hardware/bulkedit', [- 'ids' => $id_array,- 'order' => 'asc',+ 'ids' => $id_array,+ 'order' => 'asc','bulk_actions' => 'edit',- 'sort' => 'id'+ 'sort' => 'id',])->assertStatus(403);}@@ -76,20 +76,20 @@ class BulkEditAssetsTest extends TestCase$company1 = Company::factory()->create();$company2 = Company::factory()->create();$assets = Asset::factory()->count(10)->create([- 'name' => 'Old Asset Name',- 'purchase_date' => '2023-01-01',+ 'name' => 'Old Asset Name',+ 'purchase_date' => '2023-01-01','expected_checkin' => '2023-01-01',- 'status_id' => $status1->id,- 'model_id' => $model1->id,+ 'status_id' => $status1->id,+ 'model_id' => $model1->id,// skipping locations on this test, it deserves it's own test- 'purchase_cost' => 1234.90,- 'supplier_id' => $supplier1->id,- 'company_id' => $company1->id,- 'order_number' => '123456',- 'warranty_months' => 24,- 'next_audit_date' => '2024-06-01',- 'requestable' => false,- 'notes' => 'This is a new note!',+ 'purchase_cost' => 1234.90,+ 'supplier_id' => $supplier1->id,+ 'company_id' => $company1->id,+ 'order_number' => '123456',+ 'warranty_months' => 24,+ 'next_audit_date' => '2024-06-01',+ 'requestable' => false,+ 'notes' => 'This is a new note!',]);// gets the ids together to submit to the endpoint@@ -97,20 +97,20 @@ class BulkEditAssetsTest extends TestCase// submits the ids and new values for each attribute$this->actingAs(User::factory()->editAssets()->create())->post(route('hardware/bulksave'), [- 'ids' => $id_array,- 'name' => 'New Asset Name',- 'purchase_date' => '2024-01-01',+ 'ids' => $id_array,+ 'name' => 'New Asset Name',+ 'purchase_date' => '2024-01-01','expected_checkin' => '2024-01-01',- 'status_id' => $status2->id,- 'model_id' => $model2->id,- 'purchase_cost' => 5678.92,- 'supplier_id' => $supplier2->id,- 'company_id' => $company2->id,- 'order_number' => '7890',- 'warranty_months' => 36,- 'next_audit_date' => '2025-01-01',- 'requestable' => true,- 'notes' => 'This is a newer note!',+ 'status_id' => $status2->id,+ 'model_id' => $model2->id,+ 'purchase_cost' => 5678.92,+ 'supplier_id' => $supplier2->id,+ 'company_id' => $company2->id,+ 'order_number' => '7890',+ 'warranty_months' => 36,+ 'next_audit_date' => '2025-01-01',+ 'requestable' => true,+ 'notes' => 'This is a newer note!',])->assertStatus(302)->assertSessionHasNoErrors();@@ -147,20 +147,20 @@ class BulkEditAssetsTest extends TestCase$company1 = Company::factory()->create();$company2 = Company::factory()->create();$assets = Asset::factory()->count(10)->create([- 'name' => 'Old Asset Name',- 'purchase_date' => '2023-01-01',+ 'name' => 'Old Asset Name',+ 'purchase_date' => '2023-01-01','expected_checkin' => '2023-01-01',- 'status_id' => $status1->id,- 'model_id' => $model1->id,+ 'status_id' => $status1->id,+ 'model_id' => $model1->id,// skipping locations on this test, it deserves it's own test- 'purchase_cost' => 1234.90,- 'supplier_id' => $supplier1->id,- 'company_id' => $company1->id,- 'order_number' => '123456',- 'warranty_months' => 24,- 'next_audit_date' => '2024-06-01',- 'requestable' => false,- 'notes' => 'This is a note that will be deleted',+ 'purchase_cost' => 1234.90,+ 'supplier_id' => $supplier1->id,+ 'company_id' => $company1->id,+ 'order_number' => '123456',+ 'warranty_months' => 24,+ 'next_audit_date' => '2024-06-01',+ 'requestable' => false,+ 'notes' => 'This is a note that will be deleted',]);// gets the ids together to submit to the endpoint@@ -168,20 +168,20 @@ class BulkEditAssetsTest extends TestCase// submits the ids and new values for each attribute$this->actingAs(User::factory()->editAssets()->create())->post(route('hardware/bulksave'), [- 'ids' => $id_array,- 'null_name' => '1',- 'null_purchase_date' => '1',+ 'ids' => $id_array,+ 'null_name' => '1',+ 'null_purchase_date' => '1','null_expected_checkin_date' => '1',- 'null_next_audit_date' => '1',- 'null_notes' => '1',- 'status_id' => $status2->id,- 'model_id' => $model2->id,+ 'null_next_audit_date' => '1',+ 'null_notes' => '1',+ 'status_id' => $status2->id,+ 'model_id' => $model2->id,])->assertStatus(302)->assertSessionHasNoErrors();// asserts that each asset has the updated values- Asset::findMany($id_array)->each(function (Asset $asset) use ($status2, $model2, $supplier2, $company2) {+ Asset::findMany($id_array)->each(function (Asset $asset) {$this->assertNull($asset->name);$this->assertNull($asset->purchase_date);$this->assertNull($asset->expected_checkin);@@ -211,7 +211,7 @@ class BulkEditAssetsTest extends TestCase$id_array = $assets->pluck('id')->toArray();$this->actingAs(User::factory()->editAssets()->create())->post(route('hardware/bulksave'), [- 'ids' => $id_array,+ 'ids' => $id_array,$ram->db_column => 16,$cpu->db_column => '4.1',])->assertStatus(302);@@ -245,14 +245,14 @@ class BulkEditAssetsTest extends TestCase$id_array = $assets->pluck('id')->toArray();$this->actingAs(User::factory()->editAssets()->create())->post(route('hardware/bulksave'), [- 'ids' => $id_array,- $ram->db_column => 16,- $cpu->db_column => '4.1',+ 'ids' => $id_array,+ $ram->db_column => 16,+ $cpu->db_column => '4.1','null'.$phone->db_column => '8304997586',])->assertStatus(302);$this->actingAs(User::factory()->editAssets()->create())->post(route('hardware/bulksave'), [- 'ids' => $id_array,+ 'ids' => $id_array,null.$phone->db_column => 1,]);@@ -278,7 +278,7 @@ class BulkEditAssetsTest extends TestCase$id_array = $assets->pluck('id')->toArray();$this->actingAs(User::factory()->admin()->create())->post(route('hardware/bulksave'), [- 'ids' => $id_array,+ 'ids' => $id_array,$encrypted->db_column => 'New Encrypted Text',])->assertStatus(302);@@ -309,13 +309,13 @@ class BulkEditAssetsTest extends TestCase$standard_id_array = $standard_assets->pluck('id')->toArray();$this->actingAs($admin_user)->post(route('hardware/bulksave'), [- 'ids' => $admin_id_array,+ 'ids' => $admin_id_array,$encrypted->db_column => 'New Encrypted Text',])->assertStatus(302);// do we want to return an error when this happens???$this->actingAs($edit_user)->post(route('hardware/bulksave'), [- 'ids' => $standard_id_array,+ 'ids' => $standard_id_array,$encrypted->db_column => 'New Encrypted Text',])->assertStatus(302);diff --git a/tests/Feature/Assets/Ui/CheckinCheckoutCounters.php b/tests/Feature/Assets/Ui/CheckinCheckoutCounters.phpindex cd4faeaad9..9f354ef224 100644--- a/tests/Feature/Assets/Ui/CheckinCheckoutCounters.php+++ b/tests/Feature/Assets/Ui/CheckinCheckoutCounters.php@@ -12,7 +12,7 @@ use Tests\TestCase;class CheckinCheckoutCounters extends TestCase{#[Test]- function counters()+ public function counters(){$admin = User::factory()->admin()->create();$user = User::factory()->create();@@ -27,11 +27,11 @@ class CheckinCheckoutCounters extends TestCase$asset = Asset::where('asset_tag', '1234')->sole();- //ensure counters are initialized properly- $this->assertEquals(0,$asset->checkout_counter);- $this->assertEquals(0,$asset->checkin_counter);+ // ensure counters are initialized properly+ $this->assertEquals(0, $asset->checkout_counter);+ $this->assertEquals(0, $asset->checkin_counter);- //perform a checkout+ // perform a checkout$this->actingAs($admin)->post(route('hardware.checkout.store', $asset), ['checkout_to_type' => 'user',@@ -44,11 +44,11 @@ class CheckinCheckoutCounters extends TestCase])->assertRedirect()->assertSessionHasNoErrors();$asset->refresh();-// dump($asset);- $this->assertEquals(1,$asset->checkout_counter);- $this->assertEquals(0,$asset->checkin_counter);+ // dump($asset);+ $this->assertEquals(1, $asset->checkout_counter);+ $this->assertEquals(0, $asset->checkin_counter);- //perform a check-in+ // perform a check-in$this->actingAs($admin)->post(route('hardware.checkin.store', [$asset]),@@ -58,8 +58,8 @@ class CheckinCheckoutCounters extends TestCase)->assertRedirect()->assertSessionHasNoErrors();$asset->refresh();-// dump($asset);- $this->assertEquals(1,$asset->checkout_counter);- $this->assertEquals(1,$asset->checkin_counter);+ // dump($asset);+ $this->assertEquals(1, $asset->checkout_counter);+ $this->assertEquals(1, $asset->checkin_counter);}-}\ No newline at end of file+}diff --git a/tests/Feature/Assets/Ui/CloneAssetTest.php b/tests/Feature/Assets/Ui/CloneAssetTest.phpindex acf7e5a782..ed8286585e 100644--- a/tests/Feature/Assets/Ui/CloneAssetTest.php+++ b/tests/Feature/Assets/Ui/CloneAssetTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class CloneAssetTest extends TestCase{- public function testPermissionRequiredToCloneAsset()+ public function test_permission_required_to_clone_asset(){$asset = Asset::factory()->create();$this->actingAs(User::factory()->create())@@ -16,7 +16,7 @@ class CloneAssetTest extends TestCase->assertForbidden();}- public function testPageCanBeAccessed(): void+ public function test_page_can_be_accessed(): void{$asset = Asset::factory()->create();$response = $this->actingAs(User::factory()->createAssets()->create())@@ -24,14 +24,14 @@ class CloneAssetTest extends TestCase$response->assertStatus(200);}- public function testAssetCanBeCloned()+ public function test_asset_can_be_cloned(){- $asset_to_clone = Asset::factory()->create(['name'=>'Asset to clone']);+ $asset_to_clone = Asset::factory()->create(['name' => 'Asset to clone']);$this->actingAs(User::factory()->createAssets()->create())->get(route('clone/hardware', $asset_to_clone))->assertOk()->assertSee([- 'Asset to clone'+ 'Asset to clone',], false);}}diff --git a/tests/Feature/Assets/Ui/DeleteAssetTest.php b/tests/Feature/Assets/Ui/DeleteAssetTest.phpindex 799643929b..db206e353c 100644--- a/tests/Feature/Assets/Ui/DeleteAssetTest.php+++ b/tests/Feature/Assets/Ui/DeleteAssetTest.php@@ -11,14 +11,14 @@ use Tests\TestCase;class DeleteAssetTest extends TestCase{- public function testPermissionNeededToDeleteAsset()+ public function test_permission_needed_to_delete_asset(){$this->actingAs(User::factory()->create())->delete(route('hardware.destroy', Asset::factory()->create()))->assertForbidden();}- public function testCanDeleteAsset()+ public function test_can_delete_asset(){$asset = Asset::factory()->create();@@ -30,7 +30,7 @@ class DeleteAssetTest extends TestCase$this->assertSoftDeleted($asset);}- public function testActionLogEntryMadeWhenAssetDeleted()+ public function test_action_log_entry_made_when_asset_deleted(){$actor = User::factory()->deleteAssets()->create();@@ -48,7 +48,7 @@ class DeleteAssetTest extends TestCase]);}- public function testActionLogsActionDateIsPopulatedWhenAssetDeleted()+ public function test_action_logs_action_date_is_populated_when_asset_deleted(){$actor = User::factory()->deleteAssets()->create();@@ -71,7 +71,7 @@ class DeleteAssetTest extends TestCase}- public function testAssetIsCheckedInWhenDeleted()+ public function test_asset_is_checked_in_when_deleted(){Event::fake();@@ -95,7 +95,7 @@ class DeleteAssetTest extends TestCaseEvent::assertDispatched(CheckoutableCheckedIn::class);}- public function testImageIsDeletedWhenAssetDeleted()+ public function test_image_is_deleted_when_asset_deleted(){Storage::fake('public');diff --git a/tests/Feature/Assets/Ui/EditAssetTest.php b/tests/Feature/Assets/Ui/EditAssetTest.phpindex 554b2f1487..816f173464 100644--- a/tests/Feature/Assets/Ui/EditAssetTest.php+++ b/tests/Feature/Assets/Ui/EditAssetTest.php@@ -14,8 +14,7 @@ use Tests\TestCase;class EditAssetTest extends TestCase{-- public function testPermissionRequiredToViewEditAssetPage()+ public function test_permission_required_to_view_edit_asset_page(){$asset = Asset::factory()->create();$this->actingAs(User::factory()->create())@@ -23,7 +22,7 @@ class EditAssetTest extends TestCase->assertForbidden();}- public function testPageCanBeAccessed(): void+ public function test_page_can_be_accessed(): void{$asset = Asset::factory()->create();$user = User::factory()->editAssets()->create();@@ -31,7 +30,7 @@ class EditAssetTest extends TestCase$response->assertStatus(200);}- public function testAssetEditPostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_asset_edit_post_is_redirected_if_redirect_selection_is_index(){$asset = Asset::factory()->assignedToUser()->create();@@ -49,7 +48,8 @@ class EditAssetTest extends TestCase->assertRedirect(route('hardware.index'));$this->assertDatabaseHas('assets', ['asset_tag' => 'New Asset Tag']);}- public function testAssetEditPostIsRedirectedIfRedirectSelectionIsItem()++ public function test_asset_edit_post_is_redirected_if_redirect_selection_is_item(){$asset = Asset::factory()->create();@@ -68,13 +68,13 @@ class EditAssetTest extends TestCase$this->assertDatabaseHas('assets', ['asset_tag' => 'New Asset Tag']);}- public function testNewCheckinIsLoggedIfStatusChangedToUndeployable()+ public function test_new_checkin_is_logged_if_status_changed_to_undeployable(){Event::fake([CheckoutableCheckedIn::class]);$user = User::factory()->create();- $deployable_status = Statuslabel::factory()->rtd()->create();- $achived_status = Statuslabel::factory()->archived()->create();+ $deployable_status = StatusLabel::factory()->rtd()->create();+ $achived_status = StatusLabel::factory()->archived()->create();$asset = Asset::factory()->assignedToUser($user)->create(['status_id' => $deployable_status->id,'last_checkin' => null,@@ -86,13 +86,13 @@ class EditAssetTest extends TestCase$this->actingAs(User::factory()->viewAssets()->editAssets()->create())->from(route('hardware.edit', $asset))->put(route('hardware.update', $asset), [- 'status_id' => $achived_status->id,- 'model_id' => $asset->model_id,- 'asset_tags' => $asset->asset_tag,- ],+ 'status_id' => $achived_status->id,+ 'model_id' => $asset->model_id,+ 'asset_tags' => $asset->asset_tag,+ ],)->assertStatus(302);- //->assertRedirect(route('hardware.show', ['hardware' => $asset->id]));;+ // ->assertRedirect(route('hardware.show', ['hardware' => $asset->id]));;// $asset->refresh();$asset = Asset::find($asset->id);@@ -106,13 +106,13 @@ class EditAssetTest extends TestCase}, 1);}- public function testCurrentLocationIsNotUpdatedOnEdit()+ public function test_current_location_is_not_updated_on_edit(){$defaultLocation = Location::factory()->create();$currentLocation = Location::factory()->create();$asset = Asset::factory()->create(['location_id' => $currentLocation->id,- 'rtd_location_id' => $defaultLocation->id+ 'rtd_location_id' => $defaultLocation->id,]);$this->actingAs(User::factory()->viewAssets()->editAssets()->create())@@ -129,7 +129,6 @@ class EditAssetTest extends TestCase$this->assertEquals($currentLocation->id, $asset->location_id);}-public function test_handles_model_being_deleted(){$this->withoutExceptionHandling();diff --git a/tests/Feature/Assets/Ui/ShowAssetTest.php b/tests/Feature/Assets/Ui/ShowAssetTest.phpindex 05920cc636..ce2a855188 100644--- a/tests/Feature/Assets/Ui/ShowAssetTest.php+++ b/tests/Feature/Assets/Ui/ShowAssetTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class ShowAssetTest extends TestCase{- public function testPermissionRequiredToViewAsset()+ public function test_permission_required_to_view_asset(){$this->actingAs(User::factory()->create())->get(route('hardware.show', Asset::factory()->create()))->assertForbidden();}- public function testCanViewAsset()+ public function test_can_view_asset(){$asset = Asset::factory()->create();@@ -25,7 +25,7 @@ class ShowAssetTest extends TestCase->assertOk();}- public function testPageForAssetWithMissingModelStillRenders()+ public function test_page_for_asset_with_missing_model_still_renders(){$asset = Asset::factory()->create();diff --git a/tests/Feature/Assets/Ui/StoreAssetWithFullMultipleCompanySupportTest.php b/tests/Feature/Assets/Ui/StoreAssetWithFullMultipleCompanySupportTest.phpindex 3443256030..c11142bcdf 100644--- a/tests/Feature/Assets/Ui/StoreAssetWithFullMultipleCompanySupportTest.php+++ b/tests/Feature/Assets/Ui/StoreAssetWithFullMultipleCompanySupportTest.php@@ -14,7 +14,7 @@ class StoreAssetWithFullMultipleCompanySupportTest extends TestCaseuse ProvidesDataForFullMultipleCompanySupportTesting;#[DataProvider('dataForFullMultipleCompanySupportTesting')]- public function testAdheresToFullMultipleCompaniesSupportScoping($data)+ public function test_adheres_to_full_multiple_companies_support_scoping($data){['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();diff --git a/tests/Feature/Assets/Ui/StoreAssetsTest.php b/tests/Feature/Assets/Ui/StoreAssetsTest.phpindex b6beb8da78..d571474046 100644--- a/tests/Feature/Assets/Ui/StoreAssetsTest.php+++ b/tests/Feature/Assets/Ui/StoreAssetsTest.php@@ -2,7 +2,6 @@namespace Tests\Feature\Assets\Ui;-use App\Models\Asset;use App\Models\AssetModel;use App\Models\Statuslabel;use App\Models\User;@@ -10,14 +9,14 @@ use Tests\TestCase;class StoreAssetsTest extends TestCase{- public function testPermissionRequiredToViewCreateAssetPage()+ public function test_permission_required_to_view_create_asset_page(){$this->actingAs(User::factory()->create())->get(route('hardware.create'))->assertForbidden();}- public function testPermissionRequiredToStoreAsset()+ public function test_permission_required_to_store_asset(){$this->actingAs(User::factory()->create())->post(route('hardware.store'), [@@ -27,14 +26,14 @@ class StoreAssetsTest extends TestCase->assertForbidden();}- public function testCreateAssetPageRenders()+ public function test_create_asset_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('hardware.create'))->assertOk();}- public function testAssetCanBeStoredWithSerialRequiredAndSerialProvided()+ public function test_asset_can_be_stored_with_serial_required_and_serial_provided(){$user = User::factory()->superuser()->create();$this->actingAs($user);@@ -46,7 +45,7 @@ class StoreAssetsTest extends TestCase$response = $this->post(route('hardware.store'), ['model_id' => $model->id,'serials' => [1 => 'ABC123'],- 'asset_tags' =>[1 => '1234'],+ 'asset_tags' => [1 => '1234'],'status_id' => 1,// other required fields...]);@@ -63,10 +62,9 @@ class StoreAssetsTest extends TestCase'asset_tag' => '1234',]);-}- public function testAssetCannotBeStoredIfSerialRequiredAndMissing()+ public function test_asset_cannot_be_stored_if_serial_required_and_missing(){$user = User::factory()->superuser()->create();$this->actingAs($user);diff --git a/tests/Feature/Authentication/LoginTest.php b/tests/Feature/Authentication/LoginTest.phpindex 98f84527db..573f75c41c 100644--- a/tests/Feature/Authentication/LoginTest.php+++ b/tests/Feature/Authentication/LoginTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class LoginTest extends TestCase{- public function testLogsFailedLoginAttempt()+ public function test_logs_failed_login_attempt(){User::factory()->create(['username' => 'username_here']);@@ -28,17 +28,16 @@ class LoginTest extends TestCase]);}-- public function testLoginThrottleConfigIsRespected()+ public function test_login_throttle_config_is_respected(){- $this->markTestIncomplete("This test is flaky and needs to be fixed. Passes and fails seemingly at random.");- User::factory()->create(['username' => 'username_here']);+ $this->markTestIncomplete('This test is flaky and needs to be fixed. Passes and fails seemingly at random.');+ User::factory()->create(['username' => 'username_here']);- config(['auth.passwords.users.throttle.max_attempts' => 1]);- config(['auth.passwords.users.throttle.lockout_duration' => 1]);+ config(['auth.passwords.users.throttle.max_attempts' => 1]);+ config(['auth.passwords.users.throttle.lockout_duration' => 1]);- for ($i = 0; $i < 2; ++$i) {+ for ($i = 0; $i < 2; $i++) {$this->from('/login')->withServerVariables(['REMOTE_ADDR' => '127.0.0.100'])->post('/login', [@@ -47,7 +46,6 @@ class LoginTest extends TestCase]);}-$response = $this->from('/login')->withServerVariables(['REMOTE_ADDR' => '127.0.0.100'])->post('/login', [@@ -61,9 +59,9 @@ class LoginTest extends TestCase$this->followRedirects($response)->assertSee(trans('auth.throttle', ['minutes' => 1]));}- public function testLogsSuccessfulLogin()+ public function test_logs_successful_login(){- $this->markTestIncomplete("This test is flaky and needs to be fixed. Passes and fails seemingly at random.");+ $this->markTestIncomplete('This test is flaky and needs to be fixed. Passes and fails seemingly at random.');User::factory()->create(['username' => 'username_here']);$this->withServerVariables(['REMOTE_ADDR' => '127.0.0.100'])diff --git a/tests/Feature/Categories/Api/CreateCategoriesTest.php b/tests/Feature/Categories/Api/CreateCategoriesTest.phpindex 92bdb1558b..8f01549b42 100644--- a/tests/Feature/Categories/Api/CreateCategoriesTest.php+++ b/tests/Feature/Categories/Api/CreateCategoriesTest.php@@ -2,23 +2,20 @@namespace Tests\Feature\Categories\Api;-use App\Models\Asset;-use App\Models\AssetModel;use App\Models\Category;use App\Models\User;-use Illuminate\Testing\Fluent\AssertableJson;use Tests\TestCase;class CreateCategoriesTest extends TestCase{- public function testRequiresPermissionToCreateCategory()+ public function test_requires_permission_to_create_category(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.categories.store'))->assertForbidden();}- public function testCanCreateCategoryWithValidCategoryType()+ public function test_can_create_category_with_valid_category_type(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.categories.store'), [@@ -45,7 +42,7 @@ class CreateCategoriesTest extends TestCase$this->assertEquals(1, $category->alert_on_response);}- public function testCannotCreateCategoryWithoutCategoryType()+ public function test_cannot_create_category_without_category_type(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.categories.store'), [@@ -56,14 +53,14 @@ class CreateCategoriesTest extends TestCase->assertStatusMessageIs('error')->assertJson(['messages' => [- 'category_type' => ['The category type field is required.'],+ 'category_type' => ['The category type field is required.'],],]);$this->assertFalse(Category::where('name', 'Test Category')->exists());}- public function testCannotCreateCategoryWithInvalidCategoryType()+ public function test_cannot_create_category_with_invalid_category_type(){$this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.categories.store'), [@@ -76,10 +73,10 @@ class CreateCategoriesTest extends TestCase->assertStatusMessageIs('error')->assertJson(['messages' => [- 'category_type' => ['The selected category type is invalid.'],+ 'category_type' => ['The selected category type is invalid.'],],]);-+$this->assertFalse(Category::where('name', 'Test Category')->exists());}diff --git a/tests/Feature/Categories/Api/DeleteCategoriesTest.php b/tests/Feature/Categories/Api/DeleteCategoriesTest.phpindex 627ddc66dd..6c204cf4e7 100644--- a/tests/Feature/Categories/Api/DeleteCategoriesTest.php+++ b/tests/Feature/Categories/Api/DeleteCategoriesTest.php@@ -22,7 +22,7 @@ class DeleteCategoriesTest extends TestCase implements TestsPermissionsRequireme$this->assertNotSoftDeleted($category);}- public function testCannotDeleteCategoryThatStillHasAssociatedAssets()+ public function test_cannot_delete_category_that_still_has_associated_assets(){$asset = Asset::factory()->create();$category = $asset->model->category;@@ -34,7 +34,7 @@ class DeleteCategoriesTest extends TestCase implements TestsPermissionsRequireme$this->assertNotSoftDeleted($category);}- public function testCannotDeleteCategoryThatStillHasAssociatedModels()+ public function test_cannot_delete_category_that_still_has_associated_models(){$model = AssetModel::factory()->create();$category = $model->category;@@ -46,7 +46,7 @@ class DeleteCategoriesTest extends TestCase implements TestsPermissionsRequireme$this->assertNotSoftDeleted($category);}- public function testCanDeleteCategory()+ public function test_can_delete_category(){$category = Category::factory()->create();diff --git a/tests/Feature/Categories/Api/IndexCategoriesTest.php b/tests/Feature/Categories/Api/IndexCategoriesTest.phpindex 424ddf5b02..fc6ddb3b18 100644--- a/tests/Feature/Categories/Api/IndexCategoriesTest.php+++ b/tests/Feature/Categories/Api/IndexCategoriesTest.php@@ -4,20 +4,18 @@ namespace Tests\Feature\Categories\Api;use App\Models\Category;use App\Models\User;-use Illuminate\Testing\Fluent\AssertableJson;use Tests\TestCase;class IndexCategoriesTest extends TestCase{-- public function testViewingCategoryIndexRequiresPermission()+ public function test_viewing_category_index_requires_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.categories.index'))->assertForbidden();}- public function testCategoryIndexReturnsExpectedSearchResults()+ public function test_category_index_returns_expected_search_results(){Category::factory()->count(10)->create();Category::factory()->count(1)->forAssets()->create(['name' => 'My Test Category']);@@ -42,8 +40,7 @@ class IndexCategoriesTest extends TestCase}-- public function testCategoryIndexReturnsExpectedCategories()+ public function test_category_index_returns_expected_categories(){$this->markTestIncomplete('Not sure why the category factory is generating one more than expected here.');Category::factory()->count(3)->create();@@ -66,5 +63,4 @@ class IndexCategoriesTest extends TestCase]);}-}diff --git a/tests/Feature/Categories/Api/UpdateCategoriesTest.php b/tests/Feature/Categories/Api/UpdateCategoriesTest.phpindex 19e8e9e0da..54fc00e760 100644--- a/tests/Feature/Categories/Api/UpdateCategoriesTest.php+++ b/tests/Feature/Categories/Api/UpdateCategoriesTest.php@@ -43,7 +43,7 @@ class UpdateCategoriesTest extends TestCase$this->assertTrue($category->alert_on_response, 'Alert on response was not updated');}- public function testCanUpdateCategoryViaPatchWithoutCategoryType()+ public function test_can_update_category_via_patch_without_category_type(){$category = Category::factory()->create();@@ -58,7 +58,7 @@ class UpdateCategoriesTest extends TestCase->assertStatus(200)->json();- //dd($response);+ // dd($response);$category->refresh();$this->assertEquals('Test Category', $category->name, 'Name was not updated');$this->assertEquals('Test EULA', $category->eula_text, 'EULA was not updated');@@ -66,7 +66,7 @@ class UpdateCategoriesTest extends TestCase}- public function testCannotUpdateCategoryViaPatchWithCategoryType()+ public function test_cannot_update_category_via_patch_with_category_type(){$category = Category::factory()->create();@@ -81,7 +81,7 @@ class UpdateCategoriesTest extends TestCase->assertStatusMessageIs('error')->assertStatus(200)->json();-+$category->refresh();$this->assertNotEquals('Test Category', $category->name, 'Name was not updated');$this->assertNotEquals('Test EULA', $category->eula_text, 'EULA was not updated');diff --git a/tests/Feature/Categories/Ui/BulkDeleteCategoriesTest.php b/tests/Feature/Categories/Ui/BulkDeleteCategoriesTest.phpindex 8595b42c7d..e67a8d3341 100644--- a/tests/Feature/Categories/Ui/BulkDeleteCategoriesTest.php+++ b/tests/Feature/Categories/Ui/BulkDeleteCategoriesTest.php@@ -14,7 +14,7 @@ class BulkDeleteCategoriesTest extends TestCase implements TestsPermissionsRequi{$this->actingAs(User::factory()->create())->post(route('categories.bulk.delete'), [- 'ids' => [1, 2, 3]+ 'ids' => [1, 2, 3],])->assertForbidden();}@@ -23,12 +23,12 @@ class BulkDeleteCategoriesTest extends TestCase implements TestsPermissionsRequi{$category = Category::factory()->create();AssetModel::factory()->create(['category_id' => $category->id]);-+$this->actingAs(User::factory()->deleteCategories()->create())->post(route('categories.bulk.delete'), [- 'ids' => [$category->id]+ 'ids' => [$category->id],]);-+$this->assertModelExists($category);$this->assertNotSoftDeleted($category);}@@ -41,7 +41,7 @@ class BulkDeleteCategoriesTest extends TestCase implements TestsPermissionsRequi$this->actingAs(User::factory()->deleteCategories()->create())->post(route('categories.bulk.delete'), [- 'ids' => [$category1->id, $category2->id, $category3->id]+ 'ids' => [$category1->id, $category2->id, $category3->id],])->assertRedirect(route('categories.index'));@@ -49,6 +49,4 @@ class BulkDeleteCategoriesTest extends TestCase implements TestsPermissionsRequi$this->assertSoftDeleted($category2);$this->assertSoftDeleted($category3);}--}diff --git a/tests/Feature/Categories/Ui/CreateCategoriesTest.php b/tests/Feature/Categories/Ui/CreateCategoriesTest.phpindex f2a45c6116..2254e7db14 100644--- a/tests/Feature/Categories/Ui/CreateCategoriesTest.php+++ b/tests/Feature/Categories/Ui/CreateCategoriesTest.php@@ -2,14 +2,13 @@namespace Tests\Feature\Categories\Ui;-use App\Models\AssetModel;use App\Models\Category;use App\Models\User;use Tests\TestCase;class CreateCategoriesTest extends TestCase{- public function testPermissionRequiredToCreateCategories()+ public function test_permission_required_to_create_categories(){$this->actingAs(User::factory()->create())->post(route('categories.store'), [@@ -19,14 +18,14 @@ class CreateCategoriesTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('categories.create'))->assertOk();}- public function testUserCanCreateCategories()+ public function test_user_can_create_categories(){$this->assertFalse(Category::where('name', 'Test Category')->exists());@@ -50,7 +49,7 @@ class CreateCategoriesTest extends TestCase]);}- public function testUserCannotCreateCategoriesWithInvalidType()+ public function test_user_cannot_create_categories_with_invalid_type(){$this->assertFalse(Category::where('name', 'Test Category')->exists());@@ -64,5 +63,4 @@ class CreateCategoriesTest extends TestCase$this->assertFalse(Category::where('name', 'Test Category')->exists());}-}diff --git a/tests/Feature/Categories/Ui/DeleteCategoriesTest.php b/tests/Feature/Categories/Ui/DeleteCategoriesTest.phpindex 3cd342a78a..71737eff78 100644--- a/tests/Feature/Categories/Ui/DeleteCategoriesTest.php+++ b/tests/Feature/Categories/Ui/DeleteCategoriesTest.php@@ -2,25 +2,22 @@namespace Tests\Feature\Categories\Ui;-use App\Events\CheckoutableCheckedIn;use App\Models\Asset;use App\Models\AssetModel;-use App\Models\User;use App\Models\Category;-use Illuminate\Support\Facades\Event;-use Illuminate\Support\Facades\Storage;+use App\Models\User;use Tests\TestCase;class DeleteCategoriesTest extends TestCase{- public function testPermissionNeededToDeleteCategory()+ public function test_permission_needed_to_delete_category(){$this->actingAs(User::factory()->create())->delete(route('categories.destroy', Category::factory()->create()))->assertForbidden();}- public function testCanDeleteCategory()+ public function test_can_delete_category(){$category = Category::factory()->create();@@ -32,7 +29,7 @@ class DeleteCategoriesTest extends TestCase$this->assertSoftDeleted($category);}- public function testCannotDeleteCategoryThatStillHasAssociatedModels()+ public function test_cannot_delete_category_that_still_has_associated_models(){$model = AssetModel::factory()->create();$category = $model->category;@@ -44,7 +41,7 @@ class DeleteCategoriesTest extends TestCase$this->assertNotSoftDeleted($category);}- public function testCannotDeleteCategoryThatStillHasAssociatedAssets()+ public function test_cannot_delete_category_that_still_has_associated_assets(){$asset = Asset::factory()->create();$category = $asset->model->category;@@ -56,5 +53,4 @@ class DeleteCategoriesTest extends TestCase$this->assertNotSoftDeleted($category);}-}diff --git a/tests/Feature/Categories/Ui/IndexCategoriesTest.php b/tests/Feature/Categories/Ui/IndexCategoriesTest.phpindex caacba99a9..450eb82b96 100644--- a/tests/Feature/Categories/Ui/IndexCategoriesTest.php+++ b/tests/Feature/Categories/Ui/IndexCategoriesTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class IndexCategoriesTest extends TestCase{- public function testPermissionRequiredToViewCategoryList()+ public function test_permission_required_to_view_category_list(){$this->actingAs(User::factory()->create())->get(route('categories.index'))->assertForbidden();}- public function testUserCanListCategories()+ public function test_user_can_list_categories(){$this->actingAs(User::factory()->superuser()->create())->get(route('categories.index'))diff --git a/tests/Feature/Categories/Ui/ShowCategoryTest.php b/tests/Feature/Categories/Ui/ShowCategoryTest.phpindex 93a9cc0af2..224d8fd701 100644--- a/tests/Feature/Categories/Ui/ShowCategoryTest.php+++ b/tests/Feature/Categories/Ui/ShowCategoryTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowCategoryTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('categories.show', Category::factory()->create()))diff --git a/tests/Feature/Categories/Ui/UpdateCategoriesTest.php b/tests/Feature/Categories/Ui/UpdateCategoriesTest.phpindex 9d984fbbfe..e918b49d46 100644--- a/tests/Feature/Categories/Ui/UpdateCategoriesTest.php+++ b/tests/Feature/Categories/Ui/UpdateCategoriesTest.php@@ -2,32 +2,32 @@namespace Tests\Feature\Categories\Ui;-use App\Models\Category;use App\Models\Asset;+use App\Models\Category;use App\Models\User;use Tests\TestCase;class UpdateCategoriesTest extends TestCase{- public function testPermissionRequiredToStoreCategory()+ public function test_permission_required_to_store_category(){$this->actingAs(User::factory()->create())->post(route('categories.store'), ['name' => 'Test Category',- 'category_type' => 'asset'+ 'category_type' => 'asset',])->assertStatus(403)->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('categories.edit', Category::factory()->create()))->assertOk();}- public function testUserCanCreateCategories()+ public function test_user_can_create_categories(){$this->actingAs(User::factory()->superuser()->create())->post(route('categories.store'), [@@ -41,7 +41,7 @@ class UpdateCategoriesTest extends TestCase$this->assertTrue(Category::where('name', 'Test Category')->exists());}- public function testUserCanEditAssetCategory()+ public function test_user_can_edit_asset_category(){$category = Category::factory()->forAssets()->create(['name' => 'Test Category',@@ -72,7 +72,7 @@ class UpdateCategoriesTest extends TestCase]);}- public function testUserCanChangeCategoryTypeIfNoAssetsAssociated()+ public function test_user_can_change_category_type_if_no_assets_associated(){$category = Category::factory()->forAssets()->create(['name' => 'Test Category']);$this->assertTrue(Category::where('name', 'Test Category')->exists());@@ -93,7 +93,7 @@ class UpdateCategoriesTest extends TestCase}- public function testUserCannotChangeCategoryTypeIfAssetsAreAssociated()+ public function test_user_cannot_change_category_type_if_assets_are_associated(){Asset::factory()->count(5)->laptopMbp()->create();$category = Category::where('name', 'Laptops')->first();diff --git a/tests/Feature/Checkins/Api/AccessoryCheckinTest.php b/tests/Feature/Checkins/Api/AccessoryCheckinTest.phpindex dc3a423b82..5d2fcb99ca 100644--- a/tests/Feature/Checkins/Api/AccessoryCheckinTest.php+++ b/tests/Feature/Checkins/Api/AccessoryCheckinTest.php@@ -48,7 +48,7 @@ class AccessoryCheckinTest extends TestCase implements TestsFullMultipleCompanie$this->assertHasTheseActionLogs($anotherAccessoryForCompanyB, ['create', 'checkin from']);}- public function testCanCheckinAccessory()+ public function test_can_checkin_accessory(){$accessory = Accessory::factory()->checkedOutToUser()->create();@@ -61,10 +61,10 @@ class AccessoryCheckinTest extends TestCase implements TestsFullMultipleCompanie->assertStatusMessageIs('success');$this->assertEquals(0, $accessory->fresh()->checkouts->count(), 'Accessory should be checked in');- $this->assertHasTheseActionLogs($accessory, ['create'/*, 'checkout'*/, 'checkin from']); // TODO - should be the 3 events!+ $this->assertHasTheseActionLogs($accessory, ['create'/* , 'checkout' */, 'checkin from']); // TODO - should be the 3 events!}- public function testCheckinIsLogged()+ public function test_checkin_is_logged(){$user = User::factory()->create();$actor = User::factory()->checkinAccessories()->create();diff --git a/tests/Feature/Checkins/Api/AssetCheckinTest.php b/tests/Feature/Checkins/Api/AssetCheckinTest.phpindex 85fceee6dd..afb9c6eb11 100644--- a/tests/Feature/Checkins/Api/AssetCheckinTest.php+++ b/tests/Feature/Checkins/Api/AssetCheckinTest.php@@ -15,28 +15,28 @@ use Tests\TestCase;class AssetCheckinTest extends TestCase{- public function testCheckingInAssetRequiresCorrectPermission()+ public function test_checking_in_asset_requires_correct_permission(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()))->assertForbidden();}- public function testCannotCheckInNonExistentAsset()+ public function test_cannot_check_in_non_existent_asset(){$this->actingAsForApi(User::factory()->checkinAssets()->create())->postJson(route('api.asset.checkin', ['id' => 'does-not-exist']))->assertStatusMessageIs('error');}- public function testCannotCheckInAssetThatIsNotCheckedOut()+ public function test_cannot_check_in_asset_that_is_not_checked_out(){$this->actingAsForApi(User::factory()->checkinAssets()->create())->postJson(route('api.asset.checkin', Asset::factory()->create()->id))->assertStatusMessageIs('error');}- public function testAssetCanBeCheckedIn()+ public function test_asset_can_be_checked_in(){Event::fake([CheckoutableCheckedIn::class]);@@ -69,8 +69,7 @@ class AssetCheckinTest extends TestCase$this->assertEquals('Changed Name', $asset->name);$this->assertEquals($status->id, $asset->status_id);$this->assertTrue($asset->location()->is($location));- $this->assertHasTheseActionLogs($asset, ['create'/*, 'checkout', 'checkin from'*/]); //TODO - the Event::fake() is probably getting in the way here-+ $this->assertHasTheseActionLogs($asset, ['create'/* , 'checkout', 'checkin from' */]); // TODO - the Event::fake() is probably getting in the way hereEvent::assertDispatched(function (CheckoutableCheckedIn $event) use ($currentTimestamp) {// this could be better mocked but is ok for now.@@ -78,7 +77,7 @@ class AssetCheckinTest extends TestCase}, 1);}- public function testLocationIsSetToRTDLocationByDefaultUponCheckin()+ public function test_location_is_set_to_rtd_location_by_default_upon_checkin(){$rtdLocation = Location::factory()->create();$asset = Asset::factory()->assignedToUser()->create([@@ -90,10 +89,10 @@ class AssetCheckinTest extends TestCase->postJson(route('api.asset.checkin', $asset->id));$this->assertTrue($asset->refresh()->location()->is($rtdLocation));- $this->assertHasTheseActionLogs($asset, ['create', /*'checkout',*/ 'checkin from']); //FIXME?+ $this->assertHasTheseActionLogs($asset, ['create', /* 'checkout', */ 'checkin from']); // FIXME?}- public function testDefaultLocationCanBeUpdatedUponCheckin()+ public function test_default_location_can_be_updated_upon_checkin(){$location = Location::factory()->create();$asset = Asset::factory()->assignedToUser()->create();@@ -105,10 +104,10 @@ class AssetCheckinTest extends TestCase]);$this->assertTrue($asset->refresh()->defaultLoc()->is($location));- $this->assertHasTheseActionLogs($asset, ['create', /*'checkout',*/ 'checkin from']); //FIXME?+ $this->assertHasTheseActionLogs($asset, ['create', /* 'checkout', */ 'checkin from']); // FIXME?}- public function testAssetsLicenseSeatsAreClearedUponCheckin()+ public function test_assets_license_seats_are_cleared_upon_checkin(){$asset = Asset::factory()->assignedToUser()->create();LicenseSeat::factory()->assignedToUser()->for($asset)->create();@@ -121,7 +120,7 @@ class AssetCheckinTest extends TestCase$this->assertNull($asset->refresh()->licenseseats->first()->assigned_to);}- public function testLegacyLocationValuesSetToZeroAreUpdated()+ public function test_legacy_location_values_set_to_zero_are_updated(){$asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create(['rtd_location_id' => 0,@@ -135,7 +134,7 @@ class AssetCheckinTest extends TestCase$this->assertEquals($asset->location_id, $asset->rtd_location_id);}- public function testPendingCheckoutAcceptancesAreClearedUponCheckin()+ public function test_pending_checkout_acceptances_are_cleared_upon_checkin(){$asset = Asset::factory()->assignedToUser()->create();@@ -147,7 +146,7 @@ class AssetCheckinTest extends TestCase$this->assertFalse($acceptance->exists(), 'Acceptance was not deleted');}- public function testCheckinTimeAndActionLogNoteCanBeSet()+ public function test_checkin_time_and_action_log_note_can_be_set(){Event::fake();diff --git a/tests/Feature/Checkins/Api/ComponentCheckinTest.php b/tests/Feature/Checkins/Api/ComponentCheckinTest.phpindex 02abc6ca75..20fe68a793 100644--- a/tests/Feature/Checkins/Api/ComponentCheckinTest.php+++ b/tests/Feature/Checkins/Api/ComponentCheckinTest.php@@ -23,7 +23,7 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie->assertForbidden();}- public function testHandlesNonExistentPivotId()+ public function test_handles_non_existent_pivot_id(){$this->actingAsForApi(User::factory()->checkinComponents()->create())->postJson(route('api.components.checkin', 1000), [@@ -33,7 +33,7 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie->assertStatusMessageIs('error');}- public function testHandlesNonExistentComponent()+ public function test_handles_non_existent_component(){$component = Component::factory()->checkedOutToAsset()->create();$pivotId = $component->assets->first()->pivot->id;@@ -47,7 +47,7 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie->assertStatusMessageIs('error');}- public function testCannotCheckinMoreThanCheckedOut()+ public function test_cannot_checkin_more_than_checked_out(){$component = Component::factory()->checkedOutToAsset()->create();@@ -62,7 +62,7 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie->assertStatusMessageIs('error');}- public function testCanCheckinComponent()+ public function test_can_checkin_component(){Event::fake([CheckoutableCheckedIn::class]);@@ -72,7 +72,6 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie$pivot = $component->assets->first()->pivot;$pivot->update(['assigned_qty' => 3]);-$this->actingAsForApi($user)->postJson(route('api.components.checkin', $component->assets->first()->pivot->id), ['checkin_qty' => 2,@@ -82,8 +81,7 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie->assertStatusMessageIs('success');$this->assertEquals(1, $component->fresh()->assets->first()->pivot->assigned_qty);- $this->assertHasTheseActionLogs($component, ['create']); //FIXME?-+ $this->assertHasTheseActionLogs($component, ['create']); // FIXME?Event::assertDispatched(function (CheckoutableCheckedIn $event) use ($user, $component) {return $event->checkoutable->is($component)@@ -93,7 +91,7 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie});}- public function testCheckingInEntireAssignedQuantityClearsThePivotRecordFromTheDatabase()+ public function test_checking_in_entire_assigned_quantity_clears_the_pivot_record_from_the_database(){Event::fake([CheckoutableCheckedIn::class]);@@ -139,7 +137,7 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie->assertStatusMessageIs('error');}- public function testCheckinIsLogged()+ public function test_checkin_is_logged(){$user = User::factory()->checkinComponents()->create();@@ -162,6 +160,6 @@ class ComponentCheckinTest extends TestCase implements TestsFullMultipleCompanie'item_id' => $component->id,'item_type' => Component::class,]);- $this->assertHasTheseActionLogs($component, ['create', /*'checkout',*/ 'checkin from']); //FIXME?+ $this->assertHasTheseActionLogs($component, ['create', /* 'checkout', */ 'checkin from']); // FIXME?}}diff --git a/tests/Feature/Checkins/Api/LicenseCheckInTest.php b/tests/Feature/Checkins/Api/LicenseCheckInTest.phpindex 0fdcab4704..87e1e14a60 100644--- a/tests/Feature/Checkins/Api/LicenseCheckInTest.php+++ b/tests/Feature/Checkins/Api/LicenseCheckInTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Feature\Checkins\Api;use App\Models\License;@@ -6,8 +7,9 @@ use App\Models\LicenseSeat;use App\Models\User;use Tests\TestCase;-class LicenseCheckInTest extends TestCase {- public function testLicenseCheckin()+class LicenseCheckInTest extends TestCase+{+ public function test_license_checkin(){$authUser = User::factory()->superuser()->create();$this->actingAsForApi($authUser);@@ -17,12 +19,12 @@ class LicenseCheckInTest extends TestCase {$licenseSeat = LicenseSeat::factory()->for($license)->create(['assigned_to' => $oldUser->id,- 'notes' => 'Previously checked out',+ 'notes' => 'Previously checked out',]);$payload = ['assigned_to' => null,- 'asset_id' => null,+ 'asset_id' => null,'notes' => 'Checking in the seat',];@@ -41,6 +43,6 @@ class LicenseCheckInTest extends TestCase {$this->assertNull($licenseSeat->asset_id);$this->assertEquals('Checking in the seat', $licenseSeat->notes);- $this->assertHasTheseActionLogs($license, ['add seats', 'create', 'checkin from']); //FIXME - bad order!+ $this->assertHasTheseActionLogs($license, ['add seats', 'create', 'checkin from']); // FIXME - bad order!}-}\ No newline at end of file+}diff --git a/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php b/tests/Feature/Checkins/Ui/AccessoryCheckinTest.phpindex a8572c6186..20953b28bb 100644--- a/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php+++ b/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php@@ -6,15 +6,13 @@ use App\Events\CheckoutableCheckedIn;use App\Mail\CheckinAccessoryMail;use App\Models\Accessory;use App\Models\User;-use App\Notifications\CheckinAccessoryNotification;use Illuminate\Support\Facades\Event;use Illuminate\Support\Facades\Mail;-use Illuminate\Support\Facades\Notification;use Tests\TestCase;class AccessoryCheckinTest extends TestCase{- public function testCheckingInAccessoryRequiresCorrectPermission()+ public function test_checking_in_accessory_requires_correct_permission(){$accessory = Accessory::factory()->checkedOutToUser()->create();@@ -23,7 +21,7 @@ class AccessoryCheckinTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$accessory = Accessory::factory()->checkedOutToUser()->create();@@ -32,7 +30,7 @@ class AccessoryCheckinTest extends TestCase->assertOk();}- public function testAccessoryCanBeCheckedIn()+ public function test_accessory_can_be_checked_in(){Event::fake([CheckoutableCheckedIn::class]);@@ -49,7 +47,7 @@ class AccessoryCheckinTest extends TestCaseEvent::assertDispatched(CheckoutableCheckedIn::class, 1);}- public function testEmailSentToUserIfSettingEnabled()+ public function test_email_sent_to_user_if_setting_enabled(){Mail::fake();@@ -64,13 +62,13 @@ class AccessoryCheckinTest extends TestCaseUser::factory()->checkinAccessories()->create(),'',));- Mail::assertSent(CheckinAccessoryMail::class, function (CheckinAccessoryMail $mail) use ( $accessory, $user) {+ Mail::assertSent(CheckinAccessoryMail::class, function (CheckinAccessoryMail $mail) use ($user) {return $mail->hasTo($user->email);});}- public function testEmailNotSentToUserIfSettingDisabled()+ public function test_email_not_sent_to_user_if_setting_disabled(){Mail::fake();@@ -78,9 +76,9 @@ class AccessoryCheckinTest extends TestCase$accessory = Accessory::factory()->checkedOutToUser($user)->create();$accessory->category->update([- 'checkin_email' => false,- 'require_acceptance' => false,- 'eula_text' => null+ 'checkin_email' => false,+ 'require_acceptance' => false,+ 'eula_text' => null,]);event(new CheckoutableCheckedIn(diff --git a/tests/Feature/Checkins/Ui/AssetCheckinTest.php b/tests/Feature/Checkins/Ui/AssetCheckinTest.phpindex bb0fe79298..cb2cea3852 100644--- a/tests/Feature/Checkins/Ui/AssetCheckinTest.php+++ b/tests/Feature/Checkins/Ui/AssetCheckinTest.php@@ -15,14 +15,14 @@ use Tests\TestCase;class AssetCheckinTest extends TestCase{- public function testCheckingInAssetRequiresCorrectPermission()+ public function test_checking_in_asset_requires_correct_permission(){$this->actingAs(User::factory()->create())->post(route('hardware.checkin.store', [Asset::factory()->assignedToUser()->create()]))->assertForbidden();}- public function testCannotCheckInAssetThatIsNotCheckedOut()+ public function test_cannot_check_in_asset_that_is_not_checked_out(){$this->actingAs(User::factory()->checkinAssets()->create())->post(route('hardware.checkin.store', [Asset::factory()->create()]))@@ -31,7 +31,7 @@ class AssetCheckinTest extends TestCase->assertRedirect(route('hardware.index'));}- public function testCannotStoreAssetCheckinThatIsNotCheckedOut()+ public function test_cannot_store_asset_checkin_that_is_not_checked_out(){$this->actingAs(User::factory()->checkinAssets()->create())->get(route('hardware.checkin.store', [Asset::factory()->create()]))@@ -40,14 +40,14 @@ class AssetCheckinTest extends TestCase->assertRedirect(route('hardware.index'));}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('hardware.checkin.create', Asset::factory()->assignedToUser()->create()))->assertOk();}- public function testAssetCanBeCheckedIn()+ public function test_asset_can_be_checked_in(){Event::fake([CheckoutableCheckedIn::class]);@@ -90,7 +90,7 @@ class AssetCheckinTest extends TestCase}, 1);}- public function testLocationIsSetToRTDLocationByDefaultUponCheckin()+ public function test_location_is_set_to_rtd_location_by_default_upon_checkin(){$rtdLocation = Location::factory()->create();$asset = Asset::factory()->assignedToUser()->create([@@ -105,7 +105,7 @@ class AssetCheckinTest extends TestCase$this->assertHasTheseActionLogs($asset, ['create', 'checkin from']);}- public function testDefaultLocationCanBeUpdatedUponCheckin()+ public function test_default_location_can_be_updated_upon_checkin(){$location = Location::factory()->create();$asset = Asset::factory()->assignedToUser()->create();@@ -113,13 +113,13 @@ class AssetCheckinTest extends TestCase$this->actingAs(User::factory()->checkinAssets()->create())->post(route('hardware.checkin.store', [$asset]), ['location_id' => $location->id,- 'update_default_location' => 0+ 'update_default_location' => 0,]);$this->assertTrue($asset->refresh()->defaultLoc()->is($location));}- public function testAssetsLicenseSeatsAreClearedUponCheckin()+ public function test_assets_license_seats_are_cleared_upon_checkin(){$asset = Asset::factory()->assignedToUser()->create();LicenseSeat::factory()->assignedToUser()->for($asset)->create();@@ -132,7 +132,7 @@ class AssetCheckinTest extends TestCase$this->assertNull($asset->refresh()->licenseseats->first()->assigned_to);}- public function testLegacyLocationValuesSetToZeroAreUpdated()+ public function test_legacy_location_values_set_to_zero_are_updated(){$asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create(['rtd_location_id' => 0,@@ -146,7 +146,7 @@ class AssetCheckinTest extends TestCase$this->assertEquals($asset->location_id, $asset->rtd_location_id);}- public function testPendingCheckoutAcceptancesAreClearedUponCheckin()+ public function test_pending_checkout_acceptances_are_cleared_upon_checkin(){$asset = Asset::factory()->assignedToUser()->create();@@ -158,7 +158,7 @@ class AssetCheckinTest extends TestCase$this->assertFalse($acceptance->exists(), 'Acceptance was not deleted');}- public function testCheckinTimeAndActionLogNoteCanBeSet()+ public function test_checkin_time_and_action_log_note_can_be_set(){Event::fake([CheckoutableCheckedIn::class]);@@ -167,7 +167,7 @@ class AssetCheckinTest extends TestCase'hardware.checkin.store', [Asset::factory()->assignedToUser()->create()]), ['checkin_at' => '2023-01-02',- 'note' => 'hello'+ 'note' => 'hello',]);Event::assertDispatched(function (CheckoutableCheckedIn $event) {@@ -175,7 +175,7 @@ class AssetCheckinTest extends TestCase}, 1);}- public function testAssetCheckinPageIsRedirectedIfModelIsInvalid()+ public function test_asset_checkin_page_is_redirected_if_model_is_invalid(){$asset = Asset::factory()->assignedToUser()->create();@@ -189,7 +189,7 @@ class AssetCheckinTest extends TestCase->assertRedirect(route('hardware.show', $asset));}- public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid()+ public function test_asset_checkin_page_post_is_redirected_if_model_is_invalid(){$asset = Asset::factory()->assignedToUser()->create();$asset->model_id = 0;@@ -202,7 +202,7 @@ class AssetCheckinTest extends TestCase->assertRedirect(route('hardware.show', $asset));}- public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_asset_checkin_page_post_is_redirected_if_redirect_selection_is_index(){$asset = Asset::factory()->assignedToUser()->create();@@ -215,7 +215,7 @@ class AssetCheckinTest extends TestCase->assertRedirect(route('hardware.index'));}- public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsItem()+ public function test_asset_checkin_page_post_is_redirected_if_redirect_selection_is_item(){$asset = Asset::factory()->assignedToUser()->create();diff --git a/tests/Feature/Checkins/Ui/ComponentCheckinTest.php b/tests/Feature/Checkins/Ui/ComponentCheckinTest.phpindex 4672b870e4..6d02fd65e5 100644--- a/tests/Feature/Checkins/Ui/ComponentCheckinTest.php+++ b/tests/Feature/Checkins/Ui/ComponentCheckinTest.php@@ -9,8 +9,7 @@ use Tests\TestCase;class ComponentCheckinTest extends TestCase{-- public function testCheckingInComponentRequiresCorrectPermission()+ public function test_checking_in_component_requires_correct_permission(){$component = Component::factory()->checkedOutToAsset()->create();@@ -21,7 +20,7 @@ class ComponentCheckinTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$component = Component::factory()->checkedOutToAsset()->create();@@ -32,7 +31,7 @@ class ComponentCheckinTest extends TestCase->assertOk();}- public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_component_checkin_page_post_is_redirected_if_redirect_selection_is_index(){$component = Component::factory()->checkedOutToAsset()->create();@@ -51,7 +50,7 @@ class ComponentCheckinTest extends TestCase$this->assertHasTheseActionLogs($component, ['create', 'checkin from']);}- public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsItem()+ public function test_component_checkin_page_post_is_redirected_if_redirect_selection_is_item(){$component = Component::factory()->checkedOutToAsset()->create();diff --git a/tests/Feature/Checkins/Ui/LicenseCheckinTest.php b/tests/Feature/Checkins/Ui/LicenseCheckinTest.phpindex f1f912cad4..cc91413ee4 100644--- a/tests/Feature/Checkins/Ui/LicenseCheckinTest.php+++ b/tests/Feature/Checkins/Ui/LicenseCheckinTest.php@@ -11,7 +11,7 @@ use Tests\TestCase;class LicenseCheckinTest extends TestCase{- public function testCheckingInLicenseRequiresCorrectPermission()+ public function test_checking_in_license_requires_correct_permission(){$this->actingAs(User::factory()->create())->post(route('licenses.checkin.save', [@@ -20,7 +20,7 @@ class LicenseCheckinTest extends TestCase->assertForbidden();}- public function testNonReassignableLicenseSeatCantBeCheckedOut()+ public function test_non_reassignable_license_seat_cant_be_checked_out(){$licenseSeat = LicenseSeat::factory()->notReassignable()@@ -35,7 +35,7 @@ class LicenseCheckinTest extends TestCase$this->assertEquals(true, $licenseSeat->unreassignable_seat);}- public function testCannotCheckinLicenseThatIsNotAssigned()+ public function test_cannot_checkin_license_that_is_not_assigned(){$licenseSeat = LicenseSeat::factory()->reassignable()@@ -52,7 +52,7 @@ class LicenseCheckinTest extends TestCase->assertSessionHas('error', trans('admin/licenses/message.checkin.error'));}- public function testCanCheckInLicenseAssignedToAsset()+ public function test_can_check_in_license_assigned_to_asset(){Event::fake([CheckoutableCheckedIn::class]);@@ -85,7 +85,7 @@ class LicenseCheckinTest extends TestCase});}- public function testCanCheckInLicenseAssignedToUser()+ public function test_can_check_in_license_assigned_to_user(){Event::fake([CheckoutableCheckedIn::class]);@@ -118,8 +118,8 @@ class LicenseCheckinTest extends TestCase});}-- public function testPageRenders()++ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('licenses.checkin', LicenseSeat::factory()->assignedToUser()->create()->id))diff --git a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.phpindex ac23dc7259..7a67f02378 100644--- a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php@@ -83,7 +83,7 @@ class AccessoryAcceptanceTest extends TestCase/*** This can be absorbed into a bigger test*/- public function testUsersNameIsIncludedInAccessoryAcceptedNotification()+ public function test_users_name_is_included_in_accessory_accepted_notification(){Notification::fake();@@ -116,7 +116,7 @@ class AccessoryAcceptanceTest extends TestCase/*** This can be absorbed into a bigger test*/- public function testUsersNameIsIncludedInAccessoryDeclinedNotification()+ public function test_users_name_is_included_in_accessory_declined_notification(){Notification::fake();@@ -146,7 +146,7 @@ class AccessoryAcceptanceTest extends TestCase);}- public function testUserIsNotAbleToAcceptAnAssetAssignedToADifferentUser()+ public function test_user_is_not_able_to_accept_an_asset_assigned_to_a_different_user(){Notification::fake();diff --git a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.phpindex 4a3ee4001a..533e015bf6 100644--- a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php@@ -12,7 +12,7 @@ use Tests\TestCase;class AssetAcceptanceTest extends TestCase{- public function testAssetCheckoutAcceptPageRenders()+ public function test_asset_checkout_accept_page_renders(){$checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();@@ -21,7 +21,7 @@ class AssetAcceptanceTest extends TestCase->assertViewIs('account.accept.create');}- public function testCannotAcceptAssetAlreadyAccepted()+ public function test_cannot_accept_asset_already_accepted(){Event::fake([CheckoutAccepted::class]);@@ -40,7 +40,7 @@ class AssetAcceptanceTest extends TestCaseEvent::assertNotDispatched(CheckoutAccepted::class);}- public function testCannotAcceptAssetForAnotherUser()+ public function test_cannot_accept_asset_for_another_user(){Event::fake([CheckoutAccepted::class]);@@ -63,7 +63,7 @@ class AssetAcceptanceTest extends TestCaseEvent::assertNotDispatched(CheckoutAccepted::class);}- public function testUserCanAcceptAsset()+ public function test_user_can_accept_asset(){Event::fake([CheckoutAccepted::class]);@@ -88,7 +88,7 @@ class AssetAcceptanceTest extends TestCaseEvent::assertDispatched(CheckoutAccepted::class);}- public function testUserCanDeclineAsset()+ public function test_user_can_decline_asset(){Event::fake([CheckoutAccepted::class]);@@ -113,7 +113,7 @@ class AssetAcceptanceTest extends TestCaseEvent::assertNotDispatched(CheckoutAccepted::class);}- public function testActionLoggedWhenAcceptingAsset()+ public function test_action_logged_when_accepting_asset(){$checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();@@ -137,7 +137,7 @@ class AssetAcceptanceTest extends TestCase);}- public function testActionLoggedWhenDecliningAsset()+ public function test_action_logged_when_declining_asset(){$checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();diff --git a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.phpindex a58064bc7f..7156021a2c 100644--- a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php+++ b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php@@ -6,15 +6,12 @@ use App\Mail\CheckoutAccessoryMail;use App\Models\Accessory;use App\Models\Actionlog;use App\Models\User;-use App\Notifications\CheckoutAccessoryNotification;use Illuminate\Support\Facades\Mail;-use Illuminate\Support\Facades\Notification;use Tests\Concerns\TestsPermissionsRequirement;use Tests\TestCase;class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirement{-public function test_requires_permission(){$this->actingAsForApi(User::factory()->create())@@ -22,7 +19,7 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem->assertForbidden();}- public function testValidationWhenCheckingOutAccessory()+ public function test_validation_when_checking_out_accessory(){$this->actingAsForApi(User::factory()->checkoutAccessories()->create())->postJson(route('api.accessories.checkout', Accessory::factory()->create()), [@@ -31,29 +28,27 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem->assertStatusMessageIs('error');}- public function testAccessoryMustBeAvailableWhenCheckingOut()+ public function test_accessory_must_be_available_when_checking_out(){$this->actingAsForApi(User::factory()->checkoutAccessories()->create())->postJson(route('api.accessories.checkout', Accessory::factory()->withoutItemsRemaining()->create()), ['assigned_user' => User::factory()->create()->id,- 'checkout_to_type' => 'user'+ 'checkout_to_type' => 'user',])->assertOk()->assertStatusMessageIs('error')->assertJson([- 'status' => 'error',- 'messages' =>- [- 'checkout_qty' =>- [- trans_choice('admin/accessories/message.checkout.checkout_qty.lte', 0,- [- 'number_currently_remaining' => 0,- 'checkout_qty' => 1,- 'number_remaining_after_checkout' => 0- ])- ],+ 'status' => 'error',+ 'messages' => [+ 'checkout_qty' => [+ trans_choice('admin/accessories/message.checkout.checkout_qty.lte', 0,+ [+ 'number_currently_remaining' => 0,+ 'checkout_qty' => 1,+ 'number_remaining_after_checkout' => 0,+ ]),+ ],],'payload' => null,@@ -62,7 +57,7 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem->json();}- public function testAccessoryCanBeCheckedOutWithoutQty()+ public function test_accessory_can_be_checked_out_without_qty(){$accessory = Accessory::factory()->create();$user = User::factory()->create();@@ -71,12 +66,12 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem$this->actingAsForApi($admin)->postJson(route('api.accessories.checkout', $accessory), ['assigned_user' => $user->id,- 'checkout_to_type' => 'user'+ 'checkout_to_type' => 'user',])->assertOk()->assertStatusMessageIs('success')->assertStatus(200)- ->assertJson(['messages' => trans('admin/accessories/message.checkout.success')])+ ->assertJson(['messages' => trans('admin/accessories/message.checkout.success')])->json();$this->assertTrue($accessory->checkouts()->where('assigned_type', User::class)->where('assigned_to', $user->id)->count() > 0);@@ -90,12 +85,12 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem'item_id' => $accessory->id,'item_type' => Accessory::class,'created_by' => $admin->id,- ])->count(),'Log entry either does not exist or there are more than expected'+ ])->count(), 'Log entry either does not exist or there are more than expected');$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);}- public function testAccessoryCanBeCheckedOutWithQty()+ public function test_accessory_can_be_checked_out_with_qty(){$accessory = Accessory::factory()->create(['qty' => 20]);$user = User::factory()->create();@@ -110,7 +105,7 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem->assertOk()->assertStatusMessageIs('success')->assertStatus(200)- ->assertJson(['messages' => trans('admin/accessories/message.checkout.success')])+ ->assertJson(['messages' => trans('admin/accessories/message.checkout.success')])->json();$this->assertTrue($accessory->checkouts()->where('assigned_type', User::class)->where('assigned_to', $user->id)->count() > 0);@@ -128,7 +123,7 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);}- public function testAccessoryCannotBeCheckedOutToInvalidUser()+ public function test_accessory_cannot_be_checked_out_to_invalid_user(){$accessory = Accessory::factory()->create();$user = User::factory()->create();@@ -144,10 +139,10 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem->assertStatus(200)->json();- $this->assertFalse($accessory->checkouts()->where('assigned_type', User::class)->where('assigned_to', $user->id)->count() > 0);+ $this->assertFalse($accessory->checkouts()->where('assigned_type', User::class)->where('assigned_to', $user->id)->count() > 0);}- public function testUserSentNotificationUponCheckout()+ public function test_user_sent_notification_upon_checkout(){Mail::fake();@@ -165,7 +160,7 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem});}- public function testActionLogCreatedUponCheckout()+ public function test_action_log_created_upon_checkout(){$accessory = Accessory::factory()->create();$actor = User::factory()->checkoutAccessories()->create();diff --git a/tests/Feature/Checkouts/Api/AssetCheckoutTest.php b/tests/Feature/Checkouts/Api/AssetCheckoutTest.phpindex d7096a5288..b9b4f875de 100644--- a/tests/Feature/Checkouts/Api/AssetCheckoutTest.php+++ b/tests/Feature/Checkouts/Api/AssetCheckoutTest.php@@ -2,9 +2,6 @@namespace Tests\Feature\Checkouts\Api;-use Illuminate\Support\Facades\Mail;-use Notification;-use PHPUnit\Framework\Attributes\DataProvider;use App\Events\CheckoutableCheckedOut;use App\Models\Asset;use App\Models\Location;@@ -12,6 +9,8 @@ use App\Models\Statuslabel;use App\Models\User;use Illuminate\Support\Carbon;use Illuminate\Support\Facades\Event;+use Notification;+use PHPUnit\Framework\Attributes\DataProvider;use Tests\TestCase;class AssetCheckoutTest extends TestCase@@ -23,7 +22,7 @@ class AssetCheckoutTest extends TestCaseEvent::fake([CheckoutableCheckedOut::class]);}- public function testCheckoutRequest()+ public function test_checkout_request(){Notification::fake();$requestable = Asset::factory()->requestable()->create();@@ -37,11 +36,11 @@ class AssetCheckoutTest extends TestCase->post(route('api.assets.requests.store', $nonRequestable->id))->assertStatusMessageIs('error');- $this->assertHasTheseActionLogs($requestable, ['create', 'requested', 'update']); //FIXME - is this right?!+ $this->assertHasTheseActionLogs($requestable, ['create', 'requested', 'update']); // FIXME - is this right?!}- public function testCheckingOutAssetRequiresCorrectPermission()+ public function test_checking_out_asset_requires_correct_permission(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.asset.checkout', Asset::factory()->create()), [@@ -51,7 +50,7 @@ class AssetCheckoutTest extends TestCase->assertForbidden();}- public function testNonExistentAssetCannotBeCheckedOut()+ public function test_non_existent_asset_cannot_be_checked_out(){$this->actingAsForApi(User::factory()->checkoutAssets()->create())->postJson(route('api.asset.checkout', 1000), [@@ -61,7 +60,7 @@ class AssetCheckoutTest extends TestCase->assertStatusMessageIs('error');}- public function testAssetNotAvailableForCheckoutCannotBeCheckedOut()+ public function test_asset_not_available_for_checkout_cannot_be_checked_out(){$assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create();@@ -73,7 +72,7 @@ class AssetCheckoutTest extends TestCase->assertStatusMessageIs('error');}- public function testAssetCannotBeCheckedOutToItself()+ public function test_asset_cannot_be_checked_out_to_itself(){$asset = Asset::factory()->create();@@ -85,7 +84,7 @@ class AssetCheckoutTest extends TestCase->assertStatusMessageIs('error');}- public function testValidationWhenCheckingOutAsset()+ public function test_validation_when_checking_out_asset(){$this->actingAsForApi(User::factory()->checkoutAssets()->create())->postJson(route('api.asset.checkout', Asset::factory()->create()), [])@@ -94,7 +93,7 @@ class AssetCheckoutTest extends TestCaseEvent::assertNotDispatched(CheckoutableCheckedOut::class);}- public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled()+ public function test_cannot_checkout_across_companies_when_full_company_support_enabled(){$this->markTestIncomplete('This is not implemented');}@@ -116,7 +115,7 @@ class AssetCheckoutTest extends TestCase'target' => $user,'expected_location' => $userLocation,];- }+ },],'Checkout to User without location set' => [function () {@@ -128,7 +127,7 @@ class AssetCheckoutTest extends TestCase'target' => $user,'expected_location' => null,];- }+ },],'Checkout to Asset with location set' => [function () {@@ -141,7 +140,7 @@ class AssetCheckoutTest extends TestCase'target' => $asset,'expected_location' => $location,];- }+ },],'Checkout to Asset without location set' => [function () {@@ -153,7 +152,7 @@ class AssetCheckoutTest extends TestCase'target' => $asset,'expected_location' => null,];- }+ },],'Checkout to Location' => [function () {@@ -164,13 +163,13 @@ class AssetCheckoutTest extends TestCase'target' => $location,'expected_location' => $location,];- }+ },],];}#[DataProvider('checkoutTargets')]- public function testAssetCanBeCheckedOut($data)+ public function test_asset_can_be_checked_out($data){['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data();@@ -212,12 +211,12 @@ class AssetCheckoutTest extends TestCase});}- public function testLicenseSeatsAreAssignedToUserUponCheckout()+ public function test_license_seats_are_assigned_to_user_upon_checkout(){$this->markTestIncomplete('This is not implemented');}- public function testLastCheckoutUsesCurrentDateIfNotProvided()+ public function test_last_checkout_uses_current_date_if_not_provided(){$asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]);diff --git a/tests/Feature/Checkouts/Api/ComponentCheckoutTest.php b/tests/Feature/Checkouts/Api/ComponentCheckoutTest.phpindex 63d1edc995..8893e17875 100644--- a/tests/Feature/Checkouts/Api/ComponentCheckoutTest.php+++ b/tests/Feature/Checkouts/Api/ComponentCheckoutTest.php@@ -23,7 +23,7 @@ class ComponentCheckoutTest extends TestCase implements TestsFullMultipleCompani->assertForbidden();}- public function testCannotCheckoutNonExistentComponent()+ public function test_cannot_checkout_non_existent_component(){$this->actingAsForApi(User::factory()->checkoutComponents()->create())->postJson(route('api.components.checkout', 1000))@@ -32,7 +32,7 @@ class ComponentCheckoutTest extends TestCase implements TestsFullMultipleCompani->assertMessagesAre('Component does not exist.');}- public function testCheckingOutComponentRequiresValidFields()+ public function test_checking_out_component_requires_valid_fields(){$component = Component::factory()->create();@@ -46,7 +46,7 @@ class ComponentCheckoutTest extends TestCase implements TestsFullMultipleCompani->assertPayloadContains('assigned_qty');}- public function testCannotCheckoutComponentIfRequestedAmountIsMoreThanComponentQuantity()+ public function test_cannot_checkout_component_if_requested_amount_is_more_than_component_quantity(){$asset = Asset::factory()->create();$component = Component::factory()->create(['qty' => 2]);@@ -61,7 +61,7 @@ class ComponentCheckoutTest extends TestCase implements TestsFullMultipleCompani->assertMessagesAre(trans('admin/components/message.checkout.unavailable', ['remaining' => 2, 'requested' => 3]));}- public function testCannotCheckoutComponentIfRequestedAmountIsMoreThanWhatIsRemaining()+ public function test_cannot_checkout_component_if_requested_amount_is_more_than_what_is_remaining(){$asset = Asset::factory()->create();$component = Component::factory()->create(['qty' => 2]);@@ -81,7 +81,7 @@ class ComponentCheckoutTest extends TestCase implements TestsFullMultipleCompani->assertStatusMessageIs('error');}- public function testCanCheckoutComponent()+ public function test_can_checkout_component(){$user = User::factory()->checkoutComponents()->create();$asset = Asset::factory()->create();@@ -99,7 +99,7 @@ class ComponentCheckoutTest extends TestCase implements TestsFullMultipleCompani$this->assertHasTheseActionLogs($component, ['create', 'checkout']);}- public function testComponentCheckoutIsLogged()+ public function test_component_checkout_is_logged(){$user = User::factory()->checkoutComponents()->create();$location = Location::factory()->create();diff --git a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.phpindex ba88016d02..97e431857c 100644--- a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php+++ b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php@@ -6,21 +6,19 @@ use App\Mail\CheckoutConsumableMail;use App\Models\Actionlog;use App\Models\Consumable;use App\Models\User;-use App\Notifications\CheckoutConsumableNotification;use Illuminate\Support\Facades\Mail;-use Illuminate\Support\Facades\Notification;use Tests\TestCase;class ConsumableCheckoutTest extends TestCase{- public function testCheckingOutConsumableRequiresCorrectPermission()+ public function test_checking_out_consumable_requires_correct_permission(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.consumables.checkout', Consumable::factory()->create()))->assertForbidden();}- public function testValidationWhenCheckingOutConsumable()+ public function test_validation_when_checking_out_consumable(){$this->actingAsForApi(User::factory()->checkoutConsumables()->create())->postJson(route('api.consumables.checkout', Consumable::factory()->create()), [@@ -29,7 +27,7 @@ class ConsumableCheckoutTest extends TestCase->assertStatusMessageIs('error');}- public function testConsumableMustBeAvailableWhenCheckingOut()+ public function test_consumable_must_be_available_when_checking_out(){$this->actingAsForApi(User::factory()->checkoutConsumables()->create())->postJson(route('api.consumables.checkout', Consumable::factory()->withoutItemsRemaining()->create()), [@@ -38,7 +36,7 @@ class ConsumableCheckoutTest extends TestCase->assertStatusMessageIs('error');}- public function testConsumableCanBeCheckedOut()+ public function test_consumable_can_be_checked_out(){$consumable = Consumable::factory()->create();$user = User::factory()->create();@@ -52,7 +50,7 @@ class ConsumableCheckoutTest extends TestCase$this->assertHasTheseActionLogs($consumable, ['create', 'checkout']);}- public function testConsumableCanBeCheckedOutWithQuantity()+ public function test_consumable_can_be_checked_out_with_quantity(){$consumable = Consumable::factory()->create();$user = User::factory()->create();@@ -73,7 +71,7 @@ class ConsumableCheckoutTest extends TestCase]);}- public function testUserSentNotificationUponCheckout()+ public function test_user_sent_notification_upon_checkout(){Mail::fake();@@ -86,13 +84,14 @@ class ConsumableCheckoutTest extends TestCase'assigned_to' => $user->id,]);- Mail::assertSent(CheckoutConsumableMail::class, function ($mail) use ($consumable, $user) {+ Mail::assertSent(CheckoutConsumableMail::class, function ($mail) use ($user) {return $mail->hasTo($user->email);});}- public function testActionLogCreatedUponCheckout()- {$consumable = Consumable::factory()->create();+ public function test_action_log_created_upon_checkout()+ {+ $consumable = Consumable::factory()->create();$actor = User::factory()->checkoutConsumables()->create();$user = User::factory()->create();diff --git a/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.php b/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.phpindex 5f45d3225c..bfa30f7c0d 100644--- a/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.php+++ b/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.php@@ -13,6 +13,7 @@ use Tests\TestCase;class SettingAlertOnResponseTest extends TestCase{private User $actor;+private User $assignedUser;protected function setUp(): voiddiff --git a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.phpindex b05200cfcc..3646d68b94 100644--- a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php@@ -8,28 +8,26 @@ use App\Models\Actionlog;use App\Models\Asset;use App\Models\Location;use App\Models\User;-use App\Notifications\CheckoutAccessoryNotification;use Illuminate\Support\Facades\Mail;-use Illuminate\Support\Facades\Notification;use Tests\TestCase;class AccessoryCheckoutTest extends TestCase{- public function testCheckingOutAccessoryRequiresCorrectPermission()+ public function test_checking_out_accessory_requires_correct_permission(){$this->actingAs(User::factory()->create())->post(route('accessories.checkout.store', Accessory::factory()->create()))->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('accessories.checkout.show', Accessory::factory()->create()))->assertOk();}- public function testValidationWhenCheckingOutAccessory()+ public function test_validation_when_checking_out_accessory(){$accessory = Accessory::factory()->create();$response = $this->actingAs(User::factory()->superuser()->create())@@ -44,7 +42,7 @@ class AccessoryCheckoutTest extends TestCase$this->followRedirects($response)->assertSee(trans('general.error'));}- public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut()+ public function test_accessory_must_have_available_items_for_checkout_when_checking_out(){$accessory = Accessory::factory()->withoutItemsRemaining()->create();@@ -61,7 +59,7 @@ class AccessoryCheckoutTest extends TestCase$this->followRedirects($response)->assertSee(trans('general.error'));}- public function testAccessoryCanBeCheckedOutWithoutQuantity()+ public function test_accessory_can_be_checked_out_without_quantity(){$accessory = Accessory::factory()->create();$user = User::factory()->create();@@ -87,9 +85,9 @@ class AccessoryCheckoutTest extends TestCase$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);}- public function testAccessoryCanBeCheckedOutWithQuantity()+ public function test_accessory_can_be_checked_out_with_quantity(){- $accessory = Accessory::factory()->create(['qty'=>5]);+ $accessory = Accessory::factory()->create(['qty' => 5]);$user = User::factory()->create();$this->actingAs(User::factory()->checkoutAccessories()->create())@@ -115,9 +113,9 @@ class AccessoryCheckoutTest extends TestCase$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);}- public function testAccessoryCanBeCheckedOutToLocationWithQuantity()+ public function test_accessory_can_be_checked_out_to_location_with_quantity(){- $accessory = Accessory::factory()->create(['qty'=>5]);+ $accessory = Accessory::factory()->create(['qty' => 5]);$location = Location::factory()->create();$this->actingAs(User::factory()->checkoutAccessories()->create())@@ -143,9 +141,9 @@ class AccessoryCheckoutTest extends TestCase$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);}- public function testAccessoryCanBeCheckedOutToAssetWithQuantity()+ public function test_accessory_can_be_checked_out_to_asset_with_quantity(){- $accessory = Accessory::factory()->create(['qty'=>5]);+ $accessory = Accessory::factory()->create(['qty' => 5]);$asset = Asset::factory()->create();$this->actingAs(User::factory()->checkoutAccessories()->create())@@ -171,7 +169,7 @@ class AccessoryCheckoutTest extends TestCase$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);}- public function testUserSentNotificationUponCheckout()+ public function test_user_sent_notification_upon_checkout(){Mail::fake();@@ -190,7 +188,7 @@ class AccessoryCheckoutTest extends TestCase});}- public function testActionLogCreatedUponCheckout()+ public function test_action_log_created_upon_checkout(){$accessory = Accessory::factory()->create();$actor = User::factory()->checkoutAccessories()->create();@@ -220,7 +218,7 @@ class AccessoryCheckoutTest extends TestCase$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);}- public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_accessory_checkout_page_post_is_redirected_if_redirect_selection_is_index(){$accessory = Accessory::factory()->create();@@ -236,13 +234,13 @@ class AccessoryCheckoutTest extends TestCase->assertRedirect(route('accessories.index'));}- public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()+ public function test_accessory_checkout_page_post_is_redirected_if_redirect_selection_is_item(){$accessory = Accessory::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('accessories.index'))- ->post(route('accessories.checkout.store' , $accessory), [+ ->post(route('accessories.checkout.store', $accessory), ['assigned_user' => User::factory()->create()->id,'checkout_to_type' => 'user','redirect_option' => 'item',@@ -253,14 +251,14 @@ class AccessoryCheckoutTest extends TestCase->assertRedirect(route('accessories.show', $accessory));}- public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()+ public function test_accessory_checkout_page_post_is_redirected_if_redirect_selection_is_target(){$user = User::factory()->create();$accessory = Accessory::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('accessories.index'))- ->post(route('accessories.checkout.store' , $accessory), [+ ->post(route('accessories.checkout.store', $accessory), ['assigned_user' => $user->id,'checkout_to_type' => 'user','redirect_option' => 'target',diff --git a/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php b/tests/Feature/Checkouts/Ui/AssetCheckoutTest.phpindex 959c2bb89c..1674646900 100644--- a/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php@@ -2,9 +2,7 @@namespace Tests\Feature\Checkouts\Ui;-use PHPUnit\Framework\Attributes\DataProvider;use App\Events\CheckoutableCheckedOut;-use App\Models\Accessory;use App\Models\Asset;use App\Models\Company;use App\Models\LicenseSeat;@@ -13,6 +11,7 @@ use App\Models\Statuslabel;use App\Models\User;use Illuminate\Support\Carbon;use Illuminate\Support\Facades\Event;+use PHPUnit\Framework\Attributes\DataProvider;use Tests\TestCase;class AssetCheckoutTest extends TestCase@@ -24,7 +23,7 @@ class AssetCheckoutTest extends TestCaseEvent::fake([CheckoutableCheckedOut::class]);}- public function testCheckingOutAssetRequiresCorrectPermission()+ public function test_checking_out_asset_requires_correct_permission(){$this->actingAs(User::factory()->create())->post(route('hardware.checkout.store', Asset::factory()->create()), [@@ -34,7 +33,7 @@ class AssetCheckoutTest extends TestCase->assertForbidden();}- public function testNonExistentAssetCannotBeCheckedOut()+ public function test_non_existent_asset_cannot_be_checked_out(){$this->actingAs(User::factory()->checkoutAssets()->create())->post(route('hardware.checkout.store', 1000), [@@ -48,7 +47,7 @@ class AssetCheckoutTest extends TestCaseEvent::assertNotDispatched(CheckoutableCheckedOut::class);}- public function testAssetNotAvailableForCheckoutCannotBeCheckedOut()+ public function test_asset_not_available_for_checkout_cannot_be_checked_out(){$assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create();@@ -63,7 +62,7 @@ class AssetCheckoutTest extends TestCaseEvent::assertNotDispatched(CheckoutableCheckedOut::class);}- public function testAssetCannotBeCheckedOutToItself()+ public function test_asset_cannot_be_checked_out_to_itself(){$asset = Asset::factory()->create();@@ -77,7 +76,7 @@ class AssetCheckoutTest extends TestCaseEvent::assertNotDispatched(CheckoutableCheckedOut::class);}- public function testValidationWhenCheckingOutAsset()+ public function test_validation_when_checking_out_asset(){$this->actingAs(User::factory()->create())->post(route('hardware.checkout.store', Asset::factory()->create()), [@@ -98,7 +97,7 @@ class AssetCheckoutTest extends TestCaseEvent::assertNotDispatched(CheckoutableCheckedOut::class);}- public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled()+ public function test_cannot_checkout_across_companies_when_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();@@ -118,12 +117,13 @@ class AssetCheckoutTest extends TestCaseEvent::assertNotDispatched(CheckoutableCheckedOut::class);}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('hardware.checkout.create', Asset::factory()->create()))->assertOk();}+/*** This data provider contains checkout targets along with the* asset's expected location after the checkout process.@@ -175,7 +175,7 @@ class AssetCheckoutTest extends TestCase}#[DataProvider('checkoutTargets')]- public function testAssetCanBeCheckedOut($data)+ public function test_asset_can_be_checked_out($data){['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data();@@ -193,7 +193,7 @@ class AssetCheckoutTest extends TestCase->post(route('hardware.checkout.store', $asset), array_merge($defaultFieldsAlwaysIncludedInUIFormSubmission, ['checkout_to_type' => $type,// overwrite the value from the default fields set above- 'assigned_' . $type => (string) $target->id,+ 'assigned_'.$type => (string) $target->id,'name' => 'Changed Name','status_id' => (string) $newStatus->id,'checkout_at' => '2024-03-18',@@ -207,7 +207,7 @@ class AssetCheckoutTest extends TestCase$this->assertEquals('Changed Name', $asset->name);$this->assertTrue($asset->assetstatus->is($newStatus));$this->assertEquals('2024-03-18 00:00:00', $asset->last_checkout);- $this->assertEquals('2024-03-28 00:00:00', (string)$asset->expected_checkin);+ $this->assertEquals('2024-03-28 00:00:00', (string) $asset->expected_checkin);Event::assertDispatched(CheckoutableCheckedOut::class, 1);Event::assertDispatched(function (CheckoutableCheckedOut $event) use ($admin, $asset, $target) {@@ -218,10 +218,10 @@ class AssetCheckoutTest extends TestCasereturn true;});- $this->assertHasTheseActionLogs($asset, ['create'/*, 'checkout'*/]); //TODO - only getting one?+ $this->assertHasTheseActionLogs($asset, ['create'/* , 'checkout' */]); // TODO - only getting one?}- public function testLicenseSeatsAreAssignedToUserUponCheckout()+ public function test_license_seats_are_assigned_to_user_upon_checkout(){$asset = Asset::factory()->create();$seat = LicenseSeat::factory()->assignedToAsset($asset)->create();@@ -238,7 +238,7 @@ class AssetCheckoutTest extends TestCase$this->assertTrue($user->fresh()->licenses->contains($seat->license));}- public function testLastCheckoutUsesCurrentDateIfNotProvided()+ public function test_last_checkout_uses_current_date_if_not_provided(){$asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]);@@ -253,7 +253,7 @@ class AssetCheckoutTest extends TestCase$this->assertTrue((int) Carbon::parse($asset->last_checkout)->diffInSeconds(now(), true) < 2);}- public function testAssetCheckoutPageIsRedirectedIfModelIsInvalid()+ public function test_asset_checkout_page_is_redirected_if_model_is_invalid(){$asset = Asset::factory()->create();@@ -267,7 +267,7 @@ class AssetCheckoutTest extends TestCase->assertRedirect(route('hardware.show', $asset));}- public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_asset_checkout_page_post_is_redirected_if_redirect_selection_is_index(){$asset = Asset::factory()->create();@@ -275,22 +275,22 @@ class AssetCheckoutTest extends TestCase->from(route('hardware.checkout.create', $asset))->post(route('hardware.checkout.store', $asset), ['checkout_to_type' => 'user',- 'assigned_user' => User::factory()->create()->id,+ 'assigned_user' => User::factory()->create()->id,'redirect_option' => 'index',])->assertStatus(302)->assertRedirect(route('hardware.index'));}- public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()+ public function test_asset_checkout_page_post_is_redirected_if_redirect_selection_is_item(){$asset = Asset::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('hardware.checkout.create', $asset))- ->post(route('hardware.checkout.store' , $asset), [+ ->post(route('hardware.checkout.store', $asset), ['checkout_to_type' => 'user',- 'assigned_user' => User::factory()->create()->id,+ 'assigned_user' => User::factory()->create()->id,'redirect_option' => 'item',])->assertStatus(302)@@ -298,16 +298,16 @@ class AssetCheckoutTest extends TestCase->assertRedirect(route('hardware.show', $asset));}- public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget()+ public function test_asset_checkout_page_post_is_redirected_if_redirect_selection_is_user_target(){$user = User::factory()->create();$asset = Asset::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('hardware.checkout.create', $asset))- ->post(route('hardware.checkout.store' , $asset), [+ ->post(route('hardware.checkout.store', $asset), ['checkout_to_type' => 'user',- 'assigned_user' => $user->id,+ 'assigned_user' => $user->id,'redirect_option' => 'target','assigned_qty' => 1,])@@ -315,16 +315,16 @@ class AssetCheckoutTest extends TestCase->assertRedirect(route('users.show', ['user' => $user]));}- public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget()+ public function test_asset_checkout_page_post_is_redirected_if_redirect_selection_is_asset_target(){$target = Asset::factory()->create();$asset = Asset::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('hardware.checkout.create', $asset))- ->post(route('hardware.checkout.store' , $asset), [+ ->post(route('hardware.checkout.store', $asset), ['checkout_to_type' => 'asset',- 'assigned_asset' => $target->id,+ 'assigned_asset' => $target->id,'redirect_option' => 'target','assigned_qty' => 1,])@@ -332,16 +332,16 @@ class AssetCheckoutTest extends TestCase->assertRedirect(route('hardware.show', $target));}- public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget()+ public function test_asset_checkout_page_post_is_redirected_if_redirect_selection_is_location_target(){$target = Location::factory()->create();$asset = Asset::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('hardware.checkout.create', $asset))- ->post(route('hardware.checkout.store' , $asset), [+ ->post(route('hardware.checkout.store', $asset), ['checkout_to_type' => 'location',- 'assigned_location' => $target->id,+ 'assigned_location' => $target->id,'redirect_option' => 'target','assigned_qty' => 1,])diff --git a/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php b/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.phpindex 99ea17bb4a..684cc05136 100644--- a/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php@@ -15,7 +15,7 @@ use Tests\TestCase;class BulkAssetCheckoutTest extends TestCase{- public function testRequiresPermission()+ public function test_requires_permission(){$this->actingAs(User::factory()->create())->post(route('hardware.bulkcheckout.store'), [@@ -30,7 +30,7 @@ class BulkAssetCheckoutTest extends TestCase->assertForbidden();}- public function testCanBulkCheckoutAssets()+ public function test_can_bulk_checkout_assets(){Mail::fake();@@ -59,7 +59,7 @@ class BulkAssetCheckoutTest extends TestCase$asset->assignedTo()->is($user);$asset->last_checkout = $checkoutAt;$asset->expected_checkin = $expectedCheckin;- $this->assertHasTheseActionLogs($asset, ['create', 'checkout']); //Note: '$this' gets auto-bound in closures, so this does work.+ $this->assertHasTheseActionLogs($asset, ['create', 'checkout']); // Note: '$this' gets auto-bound in closures, so this does work.$this->assertDatabaseHas('checkout_acceptances', ['checkoutable_type' => Asset::class,'checkoutable_id' => $asset->id,@@ -74,7 +74,7 @@ class BulkAssetCheckoutTest extends TestCase});}- public function testHandleMissingModelBeingIncluded()+ public function test_handle_missing_model_being_included(){Mail::fake();@@ -108,7 +108,7 @@ class BulkAssetCheckoutTest extends TestCase'type' => 'user','target' => User::factory()->forCompany()->create(),];- }+ },];yield 'Checkout to asset' => [@@ -117,7 +117,7 @@ class BulkAssetCheckoutTest extends TestCase'type' => 'asset','target' => Asset::factory()->forCompany()->create(),];- }+ },];yield 'Checkout to location' => [@@ -126,7 +126,7 @@ class BulkAssetCheckoutTest extends TestCase'type' => 'location','target' => Location::factory()->forCompany()->create(),];- }+ },];}diff --git a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.phpindex d17204447c..e8d238336f 100644--- a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php@@ -12,7 +12,7 @@ use Tests\TestCase;class ComponentsCheckoutTest extends TestCase{- public function testCheckingOutComponentRequiresCorrectPermission()+ public function test_checking_out_component_requires_correct_permission(){$this->actingAs(User::factory()->create())->post(route('components.checkout.store', [@@ -21,7 +21,7 @@ class ComponentsCheckoutTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('components.checkout.show', Component::factory()->create()->id))@@ -49,7 +49,7 @@ class ComponentsCheckoutTest extends TestCaseEvent::assertNotDispatched(CheckoutableCheckedOut::class);}- public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_component_checkout_page_post_is_redirected_if_redirect_selection_is_index(){$component = Component::factory()->create();@@ -65,14 +65,14 @@ class ComponentsCheckoutTest extends TestCase$this->assertHasTheseActionLogs($component, ['create', 'checkout']);}- public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()+ public function test_component_checkout_page_post_is_redirected_if_redirect_selection_is_item(){$component = Component::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('components.index'))- ->post(route('components.checkout.store' , $component), [- 'asset_id' => Asset::factory()->create()->id,+ ->post(route('components.checkout.store', $component), [+ 'asset_id' => Asset::factory()->create()->id,'redirect_option' => 'item','assigned_qty' => 1,])@@ -81,14 +81,14 @@ class ComponentsCheckoutTest extends TestCase$this->assertHasTheseActionLogs($component, ['create', 'checkout']);}- public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()+ public function test_component_checkout_page_post_is_redirected_if_redirect_selection_is_target(){$asset = Asset::factory()->create();$component = Component::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('components.index'))- ->post(route('components.checkout.store' , $component), [+ ->post(route('components.checkout.store', $component), ['asset_id' => $asset->id,'redirect_option' => 'target','assigned_qty' => 1,diff --git a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.phpindex 9ecea11501..6e1342de90 100644--- a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php@@ -4,31 +4,28 @@ namespace Tests\Feature\Checkouts\Ui;use App\Mail\CheckoutConsumableMail;use App\Models\Actionlog;-use App\Models\Asset;-use App\Models\Component;use App\Models\Consumable;use App\Models\User;-use App\Notifications\CheckoutConsumableNotification;use Illuminate\Support\Facades\Mail;-use Illuminate\Support\Facades\Notification;use Tests\TestCase;class ConsumableCheckoutTest extends TestCase{- public function testCheckingOutConsumableRequiresCorrectPermission()+ public function test_checking_out_consumable_requires_correct_permission(){$this->actingAs(User::factory()->create())->post(route('consumables.checkout.store', Consumable::factory()->create()))->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('consumables.checkout.show', Consumable::factory()->create()->id))->assertOk();}- public function testValidationWhenCheckingOutConsumable()++ public function test_validation_when_checking_out_consumable(){$this->actingAs(User::factory()->checkoutConsumables()->create())->post(route('consumables.checkout.store', Consumable::factory()->create()), [@@ -37,7 +34,7 @@ class ConsumableCheckoutTest extends TestCase->assertSessionHas('error');}- public function testConsumableMustBeAvailableWhenCheckingOut()+ public function test_consumable_must_be_available_when_checking_out(){$this->actingAs(User::factory()->checkoutConsumables()->create())->post(route('consumables.checkout.store', Consumable::factory()->withoutItemsRemaining()->create()), [@@ -46,7 +43,7 @@ class ConsumableCheckoutTest extends TestCase->assertSessionHas('error');}- public function testConsumableCanBeCheckedOut()+ public function test_consumable_can_be_checked_out(){$consumable = Consumable::factory()->create();$user = User::factory()->create();@@ -60,7 +57,7 @@ class ConsumableCheckoutTest extends TestCase$this->assertHasTheseActionLogs($consumable, ['create', 'checkout']);}- public function testUserSentNotificationUponCheckout()+ public function test_user_sent_notification_upon_checkout(){Mail::fake();@@ -77,7 +74,7 @@ class ConsumableCheckoutTest extends TestCase});}- public function testActionLogCreatedUponCheckout()+ public function test_action_log_created_upon_checkout(){$consumable = Consumable::factory()->create();$actor = User::factory()->checkoutConsumables()->create();@@ -104,14 +101,14 @@ class ConsumableCheckoutTest extends TestCase);}- public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_consumable_checkout_page_post_is_redirected_if_redirect_selection_is_index(){$consumable = Consumable::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('consumables.index'))->post(route('consumables.checkout.store', $consumable), [- 'assigned_to' => User::factory()->create()->id,+ 'assigned_to' => User::factory()->create()->id,'redirect_option' => 'index','assigned_qty' => 1,])@@ -119,14 +116,14 @@ class ConsumableCheckoutTest extends TestCase->assertRedirect(route('consumables.index'));}- public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()+ public function test_consumable_checkout_page_post_is_redirected_if_redirect_selection_is_item(){$consumable = Consumable::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('consumables.index'))- ->post(route('consumables.checkout.store' , $consumable), [- 'assigned_to' => User::factory()->create()->id,+ ->post(route('consumables.checkout.store', $consumable), [+ 'assigned_to' => User::factory()->create()->id,'redirect_option' => 'item','assigned_qty' => 1,])@@ -134,15 +131,15 @@ class ConsumableCheckoutTest extends TestCase->assertRedirect(route('consumables.show', $consumable));}- public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()+ public function test_consumable_checkout_page_post_is_redirected_if_redirect_selection_is_target(){$user = User::factory()->create();$consumable = Consumable::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('components.index'))- ->post(route('consumables.checkout.store' , $consumable), [- 'assigned_to' => $user->id,+ ->post(route('consumables.checkout.store', $consumable), [+ 'assigned_to' => $user->id,'redirect_option' => 'target','assigned_qty' => 1,])diff --git a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.phpindex 06f72270e1..7f0d2ed9fa 100644--- a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php@@ -10,14 +10,14 @@ use Tests\TestCase;class LicenseCheckoutTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('licenses.checkout', License::factory()->create()->id))->assertOk();}- public function testNotesAreStoredInActionLogOnCheckoutToAsset()+ public function test_notes_are_stored_in_action_log_on_checkout_to_asset(){$admin = User::factory()->superuser()->create();$asset = Asset::factory()->create();@@ -42,7 +42,7 @@ class LicenseCheckoutTest extends TestCase$this->assertHasTheseActionLogs($licenseSeat->license, ['add seats', 'create', 'checkout']); // TODO - TOTALLY out-of-order}- public function testNotesAreStoredInActionLogOnCheckoutToUser()+ public function test_notes_are_stored_in_action_log_on_checkout_to_user(){$admin = User::factory()->superuser()->create();$licenseSeat = LicenseSeat::factory()->create();@@ -63,17 +63,17 @@ class LicenseCheckoutTest extends TestCase'item_type' => License::class,'note' => 'oh hi there',]);- $this->assertHasTheseActionLogs($licenseSeat->license, ['add seats', 'create', 'checkout']); //FIXME - out-of-order+ $this->assertHasTheseActionLogs($licenseSeat->license, ['add seats', 'create', 'checkout']); // FIXME - out-of-order}- public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()+ public function test_license_checkout_page_post_is_redirected_if_redirect_selection_is_index(){$license = License::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('licenses.checkout', $license))->post(route('licenses.checkout', $license), [- 'assigned_to' => User::factory()->create()->id,+ 'assigned_to' => User::factory()->create()->id,'redirect_option' => 'index','assigned_qty' => 1,])@@ -81,43 +81,44 @@ class LicenseCheckoutTest extends TestCase->assertRedirect(route('licenses.index'));}- public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()+ public function test_license_checkout_page_post_is_redirected_if_redirect_selection_is_item(){$license = License::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('licenses.checkout', $license))->post(route('licenses.checkout', $license), [- 'assigned_to' => User::factory()->create()->id,+ 'assigned_to' => User::factory()->create()->id,'redirect_option' => 'item',])->assertStatus(302)->assertRedirect(route('licenses.show', $license));}- public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget()+ public function test_license_checkout_page_post_is_redirected_if_redirect_selection_is_user_target(){$user = User::factory()->create();$license = License::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('licenses.checkout', $license))- ->post(route('licenses.checkout' , $license), [- 'assigned_to' => $user->id,+ ->post(route('licenses.checkout', $license), [+ 'assigned_to' => $user->id,'redirect_option' => 'target',])->assertStatus(302)->assertRedirect(route('users.show', $user));}- public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget()++ public function test_license_checkout_page_post_is_redirected_if_redirect_selection_is_asset_target(){$asset = Asset::factory()->create();$license = License::factory()->create();$this->actingAs(User::factory()->admin()->create())->from(route('licenses.checkout', $license))- ->post(route('licenses.checkout' , $license), [- 'asset_id' => $asset->id,+ ->post(route('licenses.checkout', $license), [+ 'asset_id' => $asset->id,'redirect_option' => 'target',])->assertStatus(302)diff --git a/tests/Feature/Companies/Api/CreateCompaniesTest.php b/tests/Feature/Companies/Api/CreateCompaniesTest.phpindex 5deb9159d0..9d5e198d2d 100644--- a/tests/Feature/Companies/Api/CreateCompaniesTest.php+++ b/tests/Feature/Companies/Api/CreateCompaniesTest.php@@ -15,7 +15,7 @@ class CreateCompaniesTest extends TestCase implements TestsPermissionsRequiremen->assertForbidden();}- public function testValidationForCreatingCompany()+ public function test_validation_for_creating_company(){$this->actingAsForApi(User::factory()->createCompanies()->create())->postJson(route('api.companies.store'))@@ -28,7 +28,7 @@ class CreateCompaniesTest extends TestCase implements TestsPermissionsRequiremen]);}- public function testCanCreateCompany()+ public function test_can_create_company(){$this->actingAsForApi(User::factory()->createCompanies()->create())->postJson(route('api.companies.store'), [diff --git a/tests/Feature/Companies/Api/DeleteCompaniesTest.php b/tests/Feature/Companies/Api/DeleteCompaniesTest.phpindex d3855d4aff..99823ce016 100644--- a/tests/Feature/Companies/Api/DeleteCompaniesTest.php+++ b/tests/Feature/Companies/Api/DeleteCompaniesTest.php@@ -20,7 +20,7 @@ class DeleteCompaniesTest extends TestCase implements TestsPermissionsRequiremen$this->assertDatabaseHas('companies', ['id' => $company->id]);}- public function testCannotDeleteCompanyThatHasAssociatedItems()+ public function test_cannot_delete_company_that_has_associated_items(){$companyWithAssets = Company::factory()->hasAssets()->create();$companyWithAccessories = Company::factory()->hasAccessories()->create();@@ -43,7 +43,7 @@ class DeleteCompaniesTest extends TestCase implements TestsPermissionsRequiremen$this->assertDatabaseHas('companies', ['id' => $companyWithUsers->id]);}- public function testCanDeleteCompany()+ public function test_can_delete_company(){$company = Company::factory()->create();@@ -54,7 +54,7 @@ class DeleteCompaniesTest extends TestCase implements TestsPermissionsRequiremen$this->assertDatabaseMissing('companies', ['id' => $company->id]);}- public function testAdheresToFullMultipleCompaniesSupportScoping()+ public function test_adheres_to_full_multiple_companies_support_scoping(){$this->settings->enableMultipleFullCompanySupport();diff --git a/tests/Feature/Companies/Api/IndexCompaniesTest.php b/tests/Feature/Companies/Api/IndexCompaniesTest.phpindex 9ecf9589de..edf0bb51bd 100644--- a/tests/Feature/Companies/Api/IndexCompaniesTest.php+++ b/tests/Feature/Companies/Api/IndexCompaniesTest.php@@ -4,20 +4,18 @@ namespace Tests\Feature\Companies\Api;use App\Models\Company;use App\Models\User;-use Illuminate\Testing\Fluent\AssertableJson;use Tests\TestCase;class IndexCompaniesTest extends TestCase{-- public function testViewingCompanyIndexRequiresPermission()+ public function test_viewing_company_index_requires_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.companies.index'))->assertForbidden();}- public function testCompanyIndexReturnsExpectedSearchResults()+ public function test_company_index_returns_expected_search_results(){Company::factory()->count(10)->create();Company::factory()->create(['name' => 'My Test Company']);@@ -42,7 +40,7 @@ class IndexCompaniesTest extends TestCase}- public function testAdheresToFullMultipleCompaniesSupportScoping()+ public function test_adheres_to_full_multiple_companies_support_scoping(){$this->settings->enableMultipleFullCompanySupport();@@ -71,6 +69,4 @@ class IndexCompaniesTest extends TestCase->assertResponseContainsInRows($companyA)->assertResponseContainsInRows($companyB);}--}diff --git a/tests/Feature/Companies/Api/UpdateCompaniesTest.php b/tests/Feature/Companies/Api/UpdateCompaniesTest.phpindex d2e3484dbe..eee5f6b244 100644--- a/tests/Feature/Companies/Api/UpdateCompaniesTest.php+++ b/tests/Feature/Companies/Api/UpdateCompaniesTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class UpdateCompaniesTest extends TestCase{- public function testRequiresPermissionToPatchCompany()+ public function test_requires_permission_to_patch_company(){$company = Company::factory()->create();@@ -17,7 +17,7 @@ class UpdateCompaniesTest extends TestCase->assertForbidden();}- public function testValidationForPatchingCompany()+ public function test_validation_for_patching_company(){$company = Company::factory()->create();@@ -34,7 +34,7 @@ class UpdateCompaniesTest extends TestCase]);}- public function testCanPatchCompany()+ public function test_can_patch_company(){$company = Company::factory()->create();@@ -51,7 +51,7 @@ class UpdateCompaniesTest extends TestCase$this->assertEquals('A Changed Note', $company->notes);}- public function testAdheresToFullMultipleCompaniesSupportScoping()+ public function test_adheres_to_full_multiple_companies_support_scoping(){$this->settings->enableMultipleFullCompanySupport();@@ -84,7 +84,7 @@ class UpdateCompaniesTest extends TestCase'notes' => 'Yet Another Changed Note',])->assertJson([- 'messages' => 'Company not found'+ 'messages' => 'Company not found',])->assertStatusMessageIs('error')->assertStatus(200);diff --git a/tests/Feature/Companies/Ui/CompanyIndexTest.php b/tests/Feature/Companies/Ui/CompanyIndexTest.phpindex 5e768f41b4..47748e46a9 100644--- a/tests/Feature/Companies/Ui/CompanyIndexTest.php+++ b/tests/Feature/Companies/Ui/CompanyIndexTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class CompanyIndexTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('companies.index'))diff --git a/tests/Feature/Companies/Ui/CreateCompaniesTest.php b/tests/Feature/Companies/Ui/CreateCompaniesTest.phpindex 18d95d401a..9d3efad09c 100644--- a/tests/Feature/Companies/Ui/CreateCompaniesTest.php+++ b/tests/Feature/Companies/Ui/CreateCompaniesTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class CreateCompaniesTest extends TestCase{- public function testRequiresPermissionToViewCreateCompanyPage()+ public function test_requires_permission_to_view_create_company_page(){$this->actingAs(User::factory()->create())->get(route('companies.create'))->assertForbidden();}- public function testCreateCompanyPageRenders()+ public function test_create_company_page_renders(){$this->actingAs(User::factory()->createCompanies()->create())->get(route('companies.create'))@@ -22,14 +22,14 @@ class CreateCompaniesTest extends TestCase->assertViewIs('companies.edit');}- public function testRequiresPermissionToCreateCompany()+ public function test_requires_permission_to_create_company(){$this->actingAs(User::factory()->create())->post(route('companies.store'))->assertForbidden();}- public function testValidDataRequiredToCreateCompany()+ public function test_valid_data_required_to_create_company(){$this->actingAs(User::factory()->createCompanies()->create())->post(route('companies.store'), [@@ -40,7 +40,7 @@ class CreateCompaniesTest extends TestCase]);}- public function testCanCreateCompany()+ public function test_can_create_company(){$data = ['email' => '[email protected]',diff --git a/tests/Feature/Companies/Ui/EditCompanyTest.php b/tests/Feature/Companies/Ui/EditCompanyTest.phpindex febc717045..c15b1e73a6 100644--- a/tests/Feature/Companies/Ui/EditCompanyTest.php+++ b/tests/Feature/Companies/Ui/EditCompanyTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class EditCompanyTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('companies.edit', Company::factory()->create()))diff --git a/tests/Feature/Companies/Ui/ShowCompanyTest.php b/tests/Feature/Companies/Ui/ShowCompanyTest.phpindex de7429d40e..58b7bfeb51 100644--- a/tests/Feature/Companies/Ui/ShowCompanyTest.php+++ b/tests/Feature/Companies/Ui/ShowCompanyTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowCompanyTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('companies.show', Company::factory()->create()))diff --git a/tests/Feature/Components/Api/ComponentFileTest.php b/tests/Feature/Components/Api/ComponentFileTest.phpindex 5ad99e0ee7..75c6c43d30 100644--- a/tests/Feature/Components/Api/ComponentFileTest.php+++ b/tests/Feature/Components/Api/ComponentFileTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class ComponentFileTest extends TestCase{- public function testComponentApiAcceptsFileUpload()+ public function test_component_api_accepts_file_upload(){// Create a model to work with$component = Component::factory()->create();@@ -17,17 +17,17 @@ class ComponentFileTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'components', 'id' => $component->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testComponentApiListsFiles()+ public function test_component_api_lists_files(){// List all files on a model@@ -45,13 +45,13 @@ class ComponentFileTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testComponentFailsIfInvalidTypePassedInUrl()+ public function test_component_fails_if_invalid_type_passed_in_url(){// List all files on a model@@ -69,7 +69,7 @@ class ComponentFileTest extends TestCase->assertStatus(404);}- public function testComponentFailsIfInvalidIdPassedInUrl()+ public function test_component_fails_if_invalid_id_passed_in_url(){// List all files on a model@@ -88,7 +88,7 @@ class ComponentFileTest extends TestCase->assertStatusMessageIs('error');}- public function testComponentApiDownloadsFile()+ public function test_component_api_downloads_file(){// Download a file from a model@@ -102,14 +102,14 @@ class ComponentFileTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'components', 'id' => $component->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -117,15 +117,15 @@ class ComponentFileTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'components', 'id' => $component->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],- 'notes' => 'manual'+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],+ 'notes' => 'manual',])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -137,19 +137,19 @@ class ComponentFileTest extends TestCase->assertOk()->assertJsonStructure([- 'total',- 'rows'=>[- '*' => [- 'id',- 'filename',- 'url',- 'created_by',- 'created_at',- 'deleted_at',- 'note',- 'available_actions'- ]- ]+ 'total',+ 'rows' => [+ '*' => [+ 'id',+ 'filename',+ 'url',+ 'created_by',+ 'created_at',+ 'deleted_at',+ 'note',+ 'available_actions',+ ],+ ],])->assertJsonPath('rows.0.note', null)@@ -160,16 +160,16 @@ class ComponentFileTest extends TestCase->get(route('api.files.show', [- 'object_type' => 'components',- 'id' => $component->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'components',+ 'id' => $component->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk();}- public function testComponentApiDeletesFile()+ public function test_component_api_deletes_file(){// Delete a file from a model@@ -179,11 +179,11 @@ class ComponentFileTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'components', 'id' => $component->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -200,17 +200,17 @@ class ComponentFileTest extends TestCase->delete(route('api.files.destroy', [- 'object_type' => 'components',- 'id' => $component->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'components',+ 'id' => $component->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);}diff --git a/tests/Feature/Components/Api/ComponentIndexTest.php b/tests/Feature/Components/Api/ComponentIndexTest.phpindex 4260372c0b..d13c03f5f8 100644--- a/tests/Feature/Components/Api/ComponentIndexTest.php+++ b/tests/Feature/Components/Api/ComponentIndexTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class ComponentIndexTest extends TestCase{- public function testComponentIndexAdheresToCompanyScoping()+ public function test_component_index_adheres_to_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Feature/Components/Api/DeleteComponentTest.php b/tests/Feature/Components/Api/DeleteComponentTest.phpindex bf1aff0eca..ff00b92450 100644--- a/tests/Feature/Components/Api/DeleteComponentTest.php+++ b/tests/Feature/Components/Api/DeleteComponentTest.php@@ -53,7 +53,7 @@ class DeleteComponentTest extends TestCase implements TestsFullMultipleCompanies$this->assertSoftDeleted($componentC);}- public function testCanDeleteComponents()+ public function test_can_delete_components(){$component = Component::factory()->create();@@ -64,7 +64,7 @@ class DeleteComponentTest extends TestCase implements TestsFullMultipleCompanies$this->assertSoftDeleted($component);}- public function testCannotDeleteComponentIfCheckedOut()+ public function test_cannot_delete_component_if_checked_out(){$component = Component::factory()->checkedOutToAsset()->create();diff --git a/tests/Feature/Components/Ui/CloneComponentTest.php b/tests/Feature/Components/Ui/CloneComponentTest.phpindex 95a80f7f77..dca01f7ad3 100644--- a/tests/Feature/Components/Ui/CloneComponentTest.php+++ b/tests/Feature/Components/Ui/CloneComponentTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class CloneComponentTest extends TestCase{- public function testPermissionRequiredToCreateComponent()+ public function test_permission_required_to_create_component(){$component = Component::factory()->create();$this->actingAs(User::factory()->create())@@ -16,7 +16,7 @@ class CloneComponentTest extends TestCase->assertForbidden();}- public function testPageCanBeAccessed(): void+ public function test_page_can_be_accessed(): void{$component = Component::factory()->create();$response = $this->actingAs(User::factory()->createComponents()->create())@@ -24,14 +24,14 @@ class CloneComponentTest extends TestCase$response->assertStatus(200);}- public function testComponentCanBeCloned()+ public function test_component_can_be_cloned(){- $component_to_clone = Component::factory()->create(['name'=>'Component to clone']);+ $component_to_clone = Component::factory()->create(['name' => 'Component to clone']);$this->actingAs(User::factory()->createComponents()->create())->get(route('components.clone.create', $component_to_clone))->assertOk()->assertSee([- 'Component to clone'+ 'Component to clone',], false);}}diff --git a/tests/Feature/Components/Ui/ComponentIndexTest.php b/tests/Feature/Components/Ui/ComponentIndexTest.phpindex 41b733e046..fc342320c4 100644--- a/tests/Feature/Components/Ui/ComponentIndexTest.php+++ b/tests/Feature/Components/Ui/ComponentIndexTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class ComponentIndexTest extends TestCase{- public function testPermissionRequiredToViewComponentsList()+ public function test_permission_required_to_view_components_list(){$this->actingAs(User::factory()->create())->get(route('components.index'))->assertForbidden();}- public function testUserCanListComponents()+ public function test_user_can_list_components(){$this->actingAs(User::factory()->superuser()->create())->get(route('components.index'))diff --git a/tests/Feature/Components/Ui/DeleteComponentTest.php b/tests/Feature/Components/Ui/DeleteComponentTest.phpindex 3320c55461..f46a32c723 100644--- a/tests/Feature/Components/Ui/DeleteComponentTest.php+++ b/tests/Feature/Components/Ui/DeleteComponentTest.php@@ -21,14 +21,14 @@ class DeleteComponentTest extends TestCase implements TestsFullMultipleCompanies->assertForbidden();}- public function testHandlesNonExistentComponent()+ public function test_handles_non_existent_component(){$this->actingAs(User::factory()->deleteComponents()->create())->delete(route('components.destroy', 10000))->assertSessionHas('error');}- public function testCanDeleteComponent()+ public function test_can_delete_component(){$component = Component::factory()->create();@@ -40,7 +40,7 @@ class DeleteComponentTest extends TestCase implements TestsFullMultipleCompanies$this->assertSoftDeleted($component);}- public function testCannotDeleteComponentIfCheckedOut()+ public function test_cannot_delete_component_if_checked_out(){$component = Component::factory()->checkedOutToAsset()->create();@@ -50,7 +50,7 @@ class DeleteComponentTest extends TestCase implements TestsFullMultipleCompanies->assertRedirect(route('components.index'));}- public function testDeletingComponentRemovesComponentImage()+ public function test_deleting_component_removes_component_image(){Storage::fake('public');@@ -65,7 +65,7 @@ class DeleteComponentTest extends TestCase implements TestsFullMultipleCompaniesStorage::disk('public')->assertMissing('components/component-image.jpg');}- public function testDeletingComponentIsLogged()+ public function test_deleting_component_is_logged(){$user = User::factory()->deleteComponents()->create();$component = Component::factory()->create();diff --git a/tests/Feature/Components/Ui/EditComponentTest.php b/tests/Feature/Components/Ui/EditComponentTest.phpindex 4e4b992330..fc03000985 100644--- a/tests/Feature/Components/Ui/EditComponentTest.php+++ b/tests/Feature/Components/Ui/EditComponentTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class EditComponentTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('components.edit', Component::factory()->create()))diff --git a/tests/Feature/Components/Ui/ShowComponentTest.php b/tests/Feature/Components/Ui/ShowComponentTest.phpindex 6ee2ca2863..0b9cbca84c 100644--- a/tests/Feature/Components/Ui/ShowComponentTest.php+++ b/tests/Feature/Components/Ui/ShowComponentTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowComponentTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('components.show', Component::factory()->create()))diff --git a/tests/Feature/Components/Ui/StoreComponentWithFullMultipleCompanySupportTest.php b/tests/Feature/Components/Ui/StoreComponentWithFullMultipleCompanySupportTest.phpindex bb36a6fa82..54ff58208d 100644--- a/tests/Feature/Components/Ui/StoreComponentWithFullMultipleCompanySupportTest.php+++ b/tests/Feature/Components/Ui/StoreComponentWithFullMultipleCompanySupportTest.php@@ -13,7 +13,7 @@ class StoreComponentWithFullMultipleCompanySupportTest extends TestCaseuse ProvidesDataForFullMultipleCompanySupportTesting;#[DataProvider('dataForFullMultipleCompanySupportTesting')]- public function testAdheresToFullMultipleCompaniesSupportScoping($data)+ public function test_adheres_to_full_multiple_companies_support_scoping($data){['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();diff --git a/tests/Feature/Console/CleanOldCheckoutRequestsTest.php b/tests/Feature/Console/CleanOldCheckoutRequestsTest.phpindex b1bdf8e603..d00493ed54 100644--- a/tests/Feature/Console/CleanOldCheckoutRequestsTest.php+++ b/tests/Feature/Console/CleanOldCheckoutRequestsTest.php@@ -20,7 +20,7 @@ class CleanOldCheckoutRequestsTest extends TestCasepublic function test_clean_old_checkout_requests_command_for_soft_deleted_asset(){$requestForSoftDeletedAsset = CheckoutRequest::factory()->forAsset()->create();- Model::withoutEvents(fn() => $requestForSoftDeletedAsset->requestedItem->delete());+ Model::withoutEvents(fn () => $requestForSoftDeletedAsset->requestedItem->delete());$this->artisan('snipeit:clean-old-checkout-requests')->assertExitCode(0);@@ -41,7 +41,7 @@ class CleanOldCheckoutRequestsTest extends TestCasepublic function test_clean_old_checkout_requests_command_for_soft_deleted_model(){$requestForSoftDeletedAssetModel = CheckoutRequest::factory()->forAssetModel()->create();- Model::withoutEvents(fn() => $requestForSoftDeletedAssetModel->requestedItem->delete());+ Model::withoutEvents(fn () => $requestForSoftDeletedAssetModel->requestedItem->delete());$this->artisan('snipeit:clean-old-checkout-requests')->assertExitCode(0);@@ -62,7 +62,7 @@ class CleanOldCheckoutRequestsTest extends TestCasepublic function test_clean_old_checkout_requests_command_for_soft_deleted_user(){$requestForSoftDeletedUser = CheckoutRequest::factory()->forAsset()->create();- Model::withoutEvents(fn() => $requestForSoftDeletedUser->user->delete());+ Model::withoutEvents(fn () => $requestForSoftDeletedUser->user->delete());$this->artisan('snipeit:clean-old-checkout-requests')->assertExitCode(0);diff --git a/tests/Feature/Console/FixupAssignedToAssignedTypeTest.php b/tests/Feature/Console/FixupAssignedToAssignedTypeTest.phpindex 2b5f9b415d..e40a11bd7b 100644--- a/tests/Feature/Console/FixupAssignedToAssignedTypeTest.php+++ b/tests/Feature/Console/FixupAssignedToAssignedTypeTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class FixupAssignedToAssignedTypeTest extends TestCase{- public function testEmptyAssignedType()+ public function test_empty_assigned_type(){$asset = Asset::factory()->create();$user = User::factory()->create();$admin = User::factory()->admin()->create();$asset->checkOut($user, $admin);- $asset->assigned_type=null; //blank out the assigned type+ $asset->assigned_type = null; // blank out the assigned type$asset->save();$this->artisan('snipeit:assigned-to-fixup --debug')->assertExitCode(0);@@ -23,7 +23,7 @@ class FixupAssignedToAssignedTypeTest extends TestCase$this->assertEquals(User::class, $asset->fresh()->assigned_type);}- public function testInvalidAssignedTo()+ public function test_invalid_assigned_to(){$this->markTestIncomplete();$asset = Asset::factory()->create();@@ -31,11 +31,11 @@ class FixupAssignedToAssignedTypeTest extends TestCase$admin = User::factory()->admin()->create();$asset->checkOut($user, $admin);- $asset->assigned_type=null;- $asset->assigned_to=null;- $asset->saveOrFail(); //*should* generate a 'checkin'?+ $asset->assigned_type = null;+ $asset->assigned_to = null;+ $asset->saveOrFail(); // *should* generate a 'checkin'?- $asset->assigned_to=$user->id; //incorrectly mark asset as partially checked-out+ $asset->assigned_to = $user->id; // incorrectly mark asset as partially checked-out$asset->saveOrFail();$this->artisan('snipeit:assigned-to-fixup --debug')->assertExitCode(0);diff --git a/tests/Feature/Console/MergeUsersTest.php b/tests/Feature/Console/MergeUsersTest.phpindex 4c43e6293d..a884411f2f 100644--- a/tests/Feature/Console/MergeUsersTest.php+++ b/tests/Feature/Console/MergeUsersTest.php@@ -3,17 +3,16 @@namespace Tests\Feature\Console;use App\Models\Accessory;+use App\Models\Actionlog;use App\Models\Asset;use App\Models\Consumable;use App\Models\LicenseSeat;use App\Models\User;-use App\Models\Actionlog;use Tests\TestCase;-class MergeUsersTest extends TestCase{- public function testAssetsAreTransferredOnUserMerge()+ public function test_assets_are_transferred_on_user_merge(){$user1 = User::factory()->create(['username' => 'user1']);$user_to_merge_into = User::factory()->create(['username' => '[email protected]']);@@ -28,7 +27,7 @@ class MergeUsersTest extends TestCase}- public function testLicensesAreTransferredOnUserMerge(): void+ public function test_licenses_are_transferred_on_user_merge(): void{$user1 = User::factory()->create(['username' => 'user1']);$user_to_merge_into = User::factory()->create(['username' => '[email protected]']);@@ -45,7 +44,7 @@ class MergeUsersTest extends TestCase}- public function testAccessoriesTransferredOnUserMerge(): void+ public function test_accessories_transferred_on_user_merge(): void{$user1 = User::factory()->create(['username' => 'user1']);$user_to_merge_into = User::factory()->create(['username' => '[email protected]']);@@ -62,7 +61,7 @@ class MergeUsersTest extends TestCase}- public function testConsumablesTransferredOnUserMerge(): void+ public function test_consumables_transferred_on_user_merge(): void{$user1 = User::factory()->create(['username' => 'user1']);$user_to_merge_into = User::factory()->create(['username' => '[email protected]']);@@ -79,7 +78,7 @@ class MergeUsersTest extends TestCase}- public function testFilesAreTransferredOnUserMerge(): void+ public function test_files_are_transferred_on_user_merge(): void{$user1 = User::factory()->create(['username' => 'user1']);$user_to_merge_into = User::factory()->create(['username' => '[email protected]']);@@ -96,7 +95,7 @@ class MergeUsersTest extends TestCase}- public function testAcceptancesAreTransferredOnUserMerge(): void+ public function test_acceptances_are_transferred_on_user_merge(): void{$user1 = User::factory()->create(['username' => 'user1']);$user_to_merge_into = User::factory()->create(['username' => '[email protected]']);@@ -113,7 +112,7 @@ class MergeUsersTest extends TestCase}- public function testUserUpdateHistoryIsTransferredOnUserMerge(): void+ public function test_user_update_history_is_transferred_on_user_merge(): void{$user1 = User::factory()->create(['username' => 'user1']);$user_to_merge_into = User::factory()->create(['username' => '[email protected]']);@@ -130,6 +129,4 @@ class MergeUsersTest extends TestCase$this->assertEquals(1, $user1->refresh()->userlog->count());}--}diff --git a/tests/Feature/Console/OptimizeTest.php b/tests/Feature/Console/OptimizeTest.phpindex b892e57c24..8dabe8bcce 100644--- a/tests/Feature/Console/OptimizeTest.php+++ b/tests/Feature/Console/OptimizeTest.php@@ -6,7 +6,7 @@ use Tests\TestCase;class OptimizeTest extends TestCase{- public function testOptimizeSucceeds()+ public function test_optimize_succeeds(){$this->beforeApplicationDestroyed(function () {$this->artisan('config:clear');diff --git a/tests/Feature/Console/SendAcceptanceReminderTest.php b/tests/Feature/Console/SendAcceptanceReminderTest.phpindex 6d0a51dd5d..365ccfe4ee 100644--- a/tests/Feature/Console/SendAcceptanceReminderTest.php+++ b/tests/Feature/Console/SendAcceptanceReminderTest.php@@ -7,17 +7,18 @@ use App\Models\CheckoutAcceptance;use App\Models\User;use Illuminate\Support\Facades\Mail;use Tests\TestCase;+class SendAcceptanceReminderTest extends TestCase{- public function testAcceptanceReminderCommand()+ public function test_acceptance_reminder_command(){Mail::fake();- $userA = User::factory()->create(['email' => '[email protected]']);- $userB = User::factory()->create(['email' => '[email protected]']);+ $userA = User::factory()->create(['email' => '[email protected]']);+ $userB = User::factory()->create(['email' => '[email protected]']);- CheckoutAcceptance::factory()->pending()->count(2)->create([- 'assigned_to_id' => $userA->id,- ]);+ CheckoutAcceptance::factory()->pending()->count(2)->create([+ 'assigned_to_id' => $userA->id,+ ]);CheckoutAcceptance::factory()->pending()->create(['assigned_to_id' => $userB->id,]);@@ -32,10 +33,10 @@ class SendAcceptanceReminderTest extends TestCasereturn $mail->hasTo('[email protected]');});- Mail::assertSent(UnacceptedAssetReminderMail::class,2);+ Mail::assertSent(UnacceptedAssetReminderMail::class, 2);}- public function testAcceptanceReminderCommandHandlesUserWithoutEmail()+ public function test_acceptance_reminder_command_handles_user_without_email(){Mail::fake();$userA = User::factory()->create(['email' => '']);@@ -48,7 +49,7 @@ class SendAcceptanceReminderTest extends TestCase[$userA->id, $userA->display_name],];$this->artisan('snipeit:acceptance-reminder')- ->expectsOutput("The following users do not have an email address:")+ ->expectsOutput('The following users do not have an email address:')->expectsTable($headers, $rows)->assertExitCode(0);diff --git a/tests/Feature/Consumables/Api/ConsumableFileTest.php b/tests/Feature/Consumables/Api/ConsumableFileTest.phpindex ece3e8b5b8..78948e7541 100644--- a/tests/Feature/Consumables/Api/ConsumableFileTest.php+++ b/tests/Feature/Consumables/Api/ConsumableFileTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class ConsumableFileTest extends TestCase{- public function testConsumableApiAcceptsFileUpload()+ public function test_consumable_api_accepts_file_upload(){// Upload a file to a model@@ -19,17 +19,17 @@ class ConsumableFileTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'consumables', 'id' => $consumable->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testConsumableApiListsFiles()+ public function test_consumable_api_lists_files(){// List all files on a model@@ -47,13 +47,13 @@ class ConsumableFileTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testConsumableFailsIfInvalidTypePassedInUrl()+ public function test_consumable_fails_if_invalid_type_passed_in_url(){// List all files on a model@@ -71,7 +71,7 @@ class ConsumableFileTest extends TestCase->assertStatus(404);}- public function testConsumableFailsIfInvalidIdPassedInUrl()+ public function test_consumable_fails_if_invalid_id_passed_in_url(){// List all files on a model@@ -90,7 +90,7 @@ class ConsumableFileTest extends TestCase->assertStatusMessageIs('error');}- public function testConsumableApiDownloadsFile()+ public function test_consumable_api_downloads_file(){// Download a file from a model@@ -104,14 +104,14 @@ class ConsumableFileTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'consumables', 'id' => $consumable->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -119,15 +119,15 @@ class ConsumableFileTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'consumables', 'id' => $consumable->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],- 'notes' => 'manual'+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],+ 'notes' => 'manual',])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -139,19 +139,19 @@ class ConsumableFileTest extends TestCase->assertOk()->assertJsonStructure([- 'total',- 'rows'=>[- '*' => [- 'id',- 'filename',- 'url',- 'created_by',- 'created_at',- 'deleted_at',- 'note',- 'available_actions'- ]- ]+ 'total',+ 'rows' => [+ '*' => [+ 'id',+ 'filename',+ 'url',+ 'created_by',+ 'created_at',+ 'deleted_at',+ 'note',+ 'available_actions',+ ],+ ],])->assertJsonPath('rows.0.note', null)@@ -162,16 +162,16 @@ class ConsumableFileTest extends TestCase->get(route('api.files.show', [- 'object_type' => 'consumables',- 'id' => $consumable->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'consumables',+ 'id' => $consumable->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk();}- public function testConsumableApiDeletesFile()+ public function test_consumable_api_deletes_file(){// Delete a file from a model@@ -181,11 +181,11 @@ class ConsumableFileTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'consumables', 'id' => $consumable->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -202,18 +202,18 @@ class ConsumableFileTest extends TestCase->delete(route('api.files.destroy', [- 'object_type' => 'consumables',- 'id' => $consumable->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'consumables',+ 'id' => $consumable->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);}-}\ No newline at end of file+}diff --git a/tests/Feature/Consumables/Api/ConsumableIndexTest.php b/tests/Feature/Consumables/Api/ConsumableIndexTest.phpindex f1d3ad7f0b..f6d4fae37f 100644--- a/tests/Feature/Consumables/Api/ConsumableIndexTest.php+++ b/tests/Feature/Consumables/Api/ConsumableIndexTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class ConsumableIndexTest extends TestCase{- public function testConsumableIndexAdheresToCompanyScoping()+ public function test_consumable_index_adheres_to_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();@@ -55,7 +55,7 @@ class ConsumableIndexTest extends TestCase->assertResponseContainsInRows($consumableB);}- public function testConsumableIndexReturnsExpectedSearchResults()+ public function test_consumable_index_returns_expected_search_results(){Consumable::factory()->count(10)->create();Consumable::factory()->count(1)->create(['name' => 'My Test Consumable']);diff --git a/tests/Feature/Consumables/Api/ConsumableUpdateTest.php b/tests/Feature/Consumables/Api/ConsumableUpdateTest.phpindex 0d512b7604..6cc4926916 100644--- a/tests/Feature/Consumables/Api/ConsumableUpdateTest.php+++ b/tests/Feature/Consumables/Api/ConsumableUpdateTest.php@@ -2,15 +2,14 @@namespace Tests\Feature\Consumables\Api;-use App\Models\Consumable;use App\Models\Category;+use App\Models\Consumable;use App\Models\User;use Tests\TestCase;class ConsumableUpdateTest extends TestCase{-- public function testCanUpdateConsumableViaPatchWithoutCategoryType()+ public function test_can_update_consumable_via_patch_without_category_type(){$consumable = Consumable::factory()->create();@@ -27,7 +26,7 @@ class ConsumableUpdateTest extends TestCase$this->assertEquals('Test Consumable', $consumable->name, 'Name was not updated');}- public function testCannotUpdateConsumableViaPatchWithInvalidCategoryType()+ public function test_cannot_update_consumable_via_patch_with_invalid_category_type(){$category = Category::factory()->create(['category_type' => 'asset']);$consumable = Consumable::factory()->create();diff --git a/tests/Feature/Consumables/Api/ConsumableViewTest.php b/tests/Feature/Consumables/Api/ConsumableViewTest.phpindex c6410216e1..2ba9b4d029 100644--- a/tests/Feature/Consumables/Api/ConsumableViewTest.php+++ b/tests/Feature/Consumables/Api/ConsumableViewTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class ConsumableViewTest extends TestCase{- public function testConsumableViewAdheresToCompanyScoping()+ public function test_consumable_view_adheres_to_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Feature/Consumables/Api/DeleteConsumablesTest.php b/tests/Feature/Consumables/Api/DeleteConsumablesTest.phpindex fa43b6f2d0..c06473da92 100644--- a/tests/Feature/Consumables/Api/DeleteConsumablesTest.php+++ b/tests/Feature/Consumables/Api/DeleteConsumablesTest.php@@ -53,7 +53,7 @@ class DeleteConsumablesTest extends TestCase implements TestsFullMultipleCompani$this->assertSoftDeleted($consumableC);}- public function testCanDeleteConsumables()+ public function test_can_delete_consumables(){$consumable = Consumable::factory()->create();diff --git a/tests/Feature/Consumables/Ui/ConsumableIndexTest.php b/tests/Feature/Consumables/Ui/ConsumableIndexTest.phpindex 3c438187ca..234a329951 100644--- a/tests/Feature/Consumables/Ui/ConsumableIndexTest.php+++ b/tests/Feature/Consumables/Ui/ConsumableIndexTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class ConsumableIndexTest extends TestCase{- public function testPermissionRequiredToViewConsumablesList()+ public function test_permission_required_to_view_consumables_list(){$this->actingAs(User::factory()->create())->get(route('consumables.index'))->assertForbidden();}- public function testUserCanListConsumables()+ public function test_user_can_list_consumables(){$this->actingAs(User::factory()->superuser()->create())->get(route('consumables.index'))diff --git a/tests/Feature/Consumables/Ui/ConsumableViewTest.php b/tests/Feature/Consumables/Ui/ConsumableViewTest.phpindex 42c98a1859..82ba0b1456 100644--- a/tests/Feature/Consumables/Ui/ConsumableViewTest.php+++ b/tests/Feature/Consumables/Ui/ConsumableViewTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ConsumableViewTest extends TestCase{- public function testPermissionRequiredToViewConsumable()+ public function test_permission_required_to_view_consumable(){$consumable = Consumable::factory()->create();$this->actingAs(User::factory()->create())@@ -16,7 +16,7 @@ class ConsumableViewTest extends TestCase->assertForbidden();}- public function testUserCanViewAConsumable()+ public function test_user_can_view_a_consumable(){$consumable = Consumable::factory()->create();$this->actingAs(User::factory()->superuser()->create())diff --git a/tests/Feature/Consumables/Ui/CreateConsumableTest.php b/tests/Feature/Consumables/Ui/CreateConsumableTest.phpindex 6d73380fdf..49d08b8ca7 100644--- a/tests/Feature/Consumables/Ui/CreateConsumableTest.php+++ b/tests/Feature/Consumables/Ui/CreateConsumableTest.php@@ -20,7 +20,7 @@ class CreateConsumableTest extends TestCase implements TestsPermissionsRequireme->assertForbidden();}- public function testCanRenderCreateConsumablePage()+ public function test_can_render_create_consumable_page(){$this->actingAs(User::factory()->createConsumables()->create())->get(route('consumables.create'))@@ -28,7 +28,7 @@ class CreateConsumableTest extends TestCase implements TestsPermissionsRequireme->assertViewIs('consumables.edit');}- public function testCanCreateConsumable()+ public function test_can_create_consumable(){$data = ['company_id' => Company::factory()->create()->id,@@ -49,15 +49,15 @@ class CreateConsumableTest extends TestCase implements TestsPermissionsRequireme$this->actingAs(User::factory()->createConsumables()->create())->post(route('consumables.store'), $data + [- 'redirect_option' => 'index',- 'category_type' => 'consumable',- ])+ 'redirect_option' => 'index',+ 'category_type' => 'consumable',+ ])->assertRedirect(route('consumables.index'));$this->assertDatabaseHas('consumables', $data);}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('consumables.create'))diff --git a/tests/Feature/Consumables/Ui/DeleteConsumableTest.php b/tests/Feature/Consumables/Ui/DeleteConsumableTest.phpindex 4406ed530a..da50e149b8 100644--- a/tests/Feature/Consumables/Ui/DeleteConsumableTest.php+++ b/tests/Feature/Consumables/Ui/DeleteConsumableTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class DeleteConsumableTest extends TestCase{- public function testRequiresPermissionToDeleteConsumable()+ public function test_requires_permission_to_delete_consumable(){$this->actingAs(User::factory()->create())->delete(route('consumables.destroy', Consumable::factory()->create()->id))->assertForbidden();}- public function testCannotDeleteConsumableFromAnotherCompany()+ public function test_cannot_delete_consumable_from_another_company(){$this->settings->enableMultipleFullCompanySupport();@@ -32,7 +32,7 @@ class DeleteConsumableTest extends TestCase$this->assertNotSoftDeleted($consumableForCompanyA);}- public function testCanDeleteConsumable()+ public function test_can_delete_consumable(){$consumable = Consumable::factory()->create();diff --git a/tests/Feature/Consumables/Ui/StoreConsumableWithFullMultipleCompanySupportTest.php b/tests/Feature/Consumables/Ui/StoreConsumableWithFullMultipleCompanySupportTest.phpindex 6f53d2298c..a112aa3558 100644--- a/tests/Feature/Consumables/Ui/StoreConsumableWithFullMultipleCompanySupportTest.php+++ b/tests/Feature/Consumables/Ui/StoreConsumableWithFullMultipleCompanySupportTest.php@@ -13,7 +13,7 @@ class StoreConsumableWithFullMultipleCompanySupportTest extends TestCaseuse ProvidesDataForFullMultipleCompanySupportTesting;#[DataProvider('dataForFullMultipleCompanySupportTesting')]- public function testAdheresToFullMultipleCompaniesSupportScoping($data)+ public function test_adheres_to_full_multiple_companies_support_scoping($data){['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();diff --git a/tests/Feature/Consumables/Ui/UpdateConsumableTest.php b/tests/Feature/Consumables/Ui/UpdateConsumableTest.phpindex dbb13b9ce7..c34e307cfd 100644--- a/tests/Feature/Consumables/Ui/UpdateConsumableTest.php+++ b/tests/Feature/Consumables/Ui/UpdateConsumableTest.php@@ -13,14 +13,14 @@ use Tests\TestCase;class UpdateConsumableTest extends TestCase{- public function testRequiresPermissionToSeeEditConsumablePage()+ public function test_requires_permission_to_see_edit_consumable_page(){$this->actingAs(User::factory()->create())->get(route('consumables.edit', Consumable::factory()->create()))->assertForbidden();}- public function testDoesNotShowEditConsumablePageFromAnotherCompany()+ public function test_does_not_show_edit_consumable_page_from_another_company(){$this->settings->enableMultipleFullCompanySupport();@@ -33,7 +33,7 @@ class UpdateConsumableTest extends TestCase->assertRedirect(route('consumables.index'));}- public function testEditConsumablePageRenders()+ public function test_edit_consumable_page_renders(){$this->actingAs(User::factory()->editConsumables()->create())->get(route('consumables.edit', Consumable::factory()->create()))@@ -41,7 +41,7 @@ class UpdateConsumableTest extends TestCase->assertViewIs('consumables.edit');}- public function testCannotUpdateConsumableBelongingToAnotherCompany()+ public function test_cannot_update_consumable_belonging_to_another_company(){$this->settings->enableMultipleFullCompanySupport();@@ -57,7 +57,7 @@ class UpdateConsumableTest extends TestCase->assertStatus(302);}- public function testCannotSetQuantityToAmountLowerThanWhatIsCheckedOut()+ public function test_cannot_set_quantity_to_amount_lower_than_what_is_checked_out(){$user = User::factory()->createConsumables()->editConsumables()->create();$consumable = Consumable::factory()->create(['qty' => 2]);@@ -77,7 +77,7 @@ class UpdateConsumableTest extends TestCase}- public function testCanUpdateConsumable()+ public function test_can_update_consumable(){$consumable = Consumable::factory()->create();@@ -100,9 +100,9 @@ class UpdateConsumableTest extends TestCase$this->actingAs(User::factory()->createConsumables()->editConsumables()->create())->put(route('consumables.update', $consumable), $data + [- 'redirect_option' => 'index',- 'category_type' => 'consumable',- ])+ 'redirect_option' => 'index',+ 'category_type' => 'consumable',+ ])->assertRedirect(route('consumables.index'));$this->assertDatabaseHas('consumables', $data);diff --git a/tests/Feature/CustomFields/Api/DeleteCustomFieldsTest.php b/tests/Feature/CustomFields/Api/DeleteCustomFieldsTest.phpindex 8bf5c5372d..d50d0faa0f 100644--- a/tests/Feature/CustomFields/Api/DeleteCustomFieldsTest.php+++ b/tests/Feature/CustomFields/Api/DeleteCustomFieldsTest.php@@ -23,7 +23,7 @@ class DeleteCustomFieldsTest extends TestCase implements TestsPermissionsRequire$this->assertDatabaseHas('custom_fields', ['id' => $customField->id]);}- public function testCustomFieldsCannotBeDeletedIfTheyHaveAssociatedFieldsets()+ public function test_custom_fields_cannot_be_deleted_if_they_have_associated_fieldsets(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');@@ -39,7 +39,7 @@ class DeleteCustomFieldsTest extends TestCase implements TestsPermissionsRequire$this->assertDatabaseHas('custom_fields', ['id' => $customField->id]);}- public function testCustomFieldsCanBeDeleted()+ public function test_custom_fields_can_be_deleted(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');diff --git a/tests/Feature/CustomFields/Ui/DeleteCustomFieldsTest.php b/tests/Feature/CustomFields/Ui/DeleteCustomFieldsTest.phpindex 543122104f..a50089b5ec 100644--- a/tests/Feature/CustomFields/Ui/DeleteCustomFieldsTest.php+++ b/tests/Feature/CustomFields/Ui/DeleteCustomFieldsTest.php@@ -9,15 +9,14 @@ use Tests\TestCase;class DeleteCustomFieldsTest extends TestCase{- public function testPermissionNeededToDeleteField()+ public function test_permission_needed_to_delete_field(){$this->actingAs(User::factory()->create())->delete(route('fields.destroy', CustomField::factory()->create()))->assertForbidden();}-- public function testCanDeleteCustomField()+ public function test_can_delete_custom_field(){$field = CustomField::factory()->create();$this->assertDatabaseHas('custom_fields', ['id' => $field->id]);@@ -31,7 +30,7 @@ class DeleteCustomFieldsTest extends TestCase$this->assertDatabaseMissing('custom_fields', ['id' => $field->id]);}- public function testCannotDeleteCustomFieldThatDoesNotExist()+ public function test_cannot_delete_custom_field_that_does_not_exist(){$response = $this->actingAs(User::factory()->viewCustomFields()->deleteCustomFields()->create())@@ -44,7 +43,7 @@ class DeleteCustomFieldsTest extends TestCase}- public function testCannotDeleteFieldThatIsAssociatedWithFieldsets()+ public function test_cannot_delete_field_that_is_associated_with_fieldsets(){$field = CustomField::factory()->create();$fieldset = CustomFieldset::factory()->create();diff --git a/tests/Feature/CustomFieldsets/Api/DeleteCustomFieldsetsTest.php b/tests/Feature/CustomFieldsets/Api/DeleteCustomFieldsetsTest.phpindex 415190bd1c..6079a3f0fa 100644--- a/tests/Feature/CustomFieldsets/Api/DeleteCustomFieldsetsTest.php+++ b/tests/Feature/CustomFieldsets/Api/DeleteCustomFieldsetsTest.php@@ -23,7 +23,7 @@ class DeleteCustomFieldsetsTest extends TestCase implements TestsPermissionsRequ$this->assertDatabaseHas('custom_fieldsets', ['id' => $customFieldset->id]);}- public function testCannotDeleteCustomFieldsetWithAssociatedFields()+ public function test_cannot_delete_custom_fieldset_with_associated_fields(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');@@ -39,7 +39,7 @@ class DeleteCustomFieldsetsTest extends TestCase implements TestsPermissionsRequ$this->assertDatabaseHas('custom_fieldsets', ['id' => $customFieldset->id]);}- public function testCannotDeleteCustomFieldsetWithAssociatedModels()+ public function test_cannot_delete_custom_fieldset_with_associated_models(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');@@ -52,7 +52,7 @@ class DeleteCustomFieldsetsTest extends TestCase implements TestsPermissionsRequ$this->assertDatabaseHas('custom_fieldsets', ['id' => $customFieldset->id]);}- public function testCanDeleteCustomFieldsets()+ public function test_can_delete_custom_fieldsets(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');diff --git a/tests/Feature/DashboardTest.php b/tests/Feature/DashboardTest.phpindex 73413c5038..8a214d432b 100644--- a/tests/Feature/DashboardTest.php+++ b/tests/Feature/DashboardTest.php@@ -12,14 +12,14 @@ use Tests\TestCase;class DashboardTest extends TestCase{- public function testUsersWithoutAdminAccessAreRedirected()+ public function test_users_without_admin_access_are_redirected(){$this->actingAs(User::factory()->create())->get(route('home'))->assertRedirect(route('view-assets'));}- public function testCountsAreLoadedCorrectlyForAdmins()+ public function test_counts_are_loaded_correctly_for_admins(){Asset::factory()->count(2)->create();Accessory::factory()->count(2)->create();diff --git a/tests/Feature/Departments/Api/CreateDepartmentsTest.php b/tests/Feature/Departments/Api/CreateDepartmentsTest.phpindex 4d8e968572..72b0267ba6 100644--- a/tests/Feature/Departments/Api/CreateDepartmentsTest.php+++ b/tests/Feature/Departments/Api/CreateDepartmentsTest.php@@ -2,19 +2,14 @@namespace Tests\Feature\Departments\Api;-use App\Models\AssetModel;use App\Models\Company;use App\Models\Department;-use App\Models\Category;use App\Models\Location;use App\Models\User;-use Illuminate\Testing\Fluent\AssertableJson;use Tests\TestCase;class CreateDepartmentsTest extends TestCase{--public function test_requires_permission_to_create_department(){$this->actingAsForApi(User::factory()->create())@@ -30,13 +25,13 @@ class CreateDepartmentsTest extends TestCase$user = User::factory()->superuser()->create();$response = $this->actingAsForApi($user)->postJson(route('api.departments.store'), [- 'name' => 'Test Department',+ 'name' => 'Test Department','company_id' => $company->id,'location_id' => $location->id,'manager_id' => $manager->id,- 'notes' => 'Test Note',- 'phone' => '1234567890',- 'fax' => '1234567890',+ 'notes' => 'Test Note',+ 'phone' => '1234567890',+ 'fax' => '1234567890',])->assertOk()->assertStatusMessageIs('success')@@ -49,14 +44,14 @@ class CreateDepartmentsTest extends TestCase$this->assertEquals('Test Note', $department->notes);$this->assertDatabaseHas('departments', [- 'name' => 'Test Department',- 'company_id' => $company->id,+ 'name' => 'Test Department',+ 'company_id' => $company->id,'location_id' => $location->id,- 'manager_id' => $manager->id,- 'notes' => 'Test Note',- 'phone' => '1234567890',- 'fax' => '1234567890',- 'created_by' => $user->id,+ 'manager_id' => $manager->id,+ 'notes' => 'Test Note',+ 'phone' => '1234567890',+ 'fax' => '1234567890',+ 'created_by' => $user->id,]);}@@ -84,7 +79,7 @@ class CreateDepartmentsTest extends TestCase{$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.departments.store'), [- 'name' => 'Test Department',+ 'name' => 'Test Department','company_id' => [1, 2],])->assertOk()@@ -95,13 +90,10 @@ class CreateDepartmentsTest extends TestCase{$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.departments.store'), [- 'name' => 'Test Department',+ 'name' => 'Test Department','company_id' => ['1', '2'],])->assertOk()->assertStatusMessageIs('error');}---}diff --git a/tests/Feature/Departments/Api/DeleteDepartmentsTest.php b/tests/Feature/Departments/Api/DeleteDepartmentsTest.phpindex ee21d3e94a..4df13d096e 100644--- a/tests/Feature/Departments/Api/DeleteDepartmentsTest.php+++ b/tests/Feature/Departments/Api/DeleteDepartmentsTest.php@@ -53,7 +53,7 @@ class DeleteDepartmentsTest extends TestCase implements TestsFullMultipleCompani$this->assertDatabaseMissing('departments', ['id' => $departmentC->id]);}- public function testCannotDeleteDepartmentThatStillHasUsers()+ public function test_cannot_delete_department_that_still_has_users(){$department = Department::factory()->hasUsers()->create();@@ -64,7 +64,7 @@ class DeleteDepartmentsTest extends TestCase implements TestsFullMultipleCompani$this->assertDatabaseHas('departments', ['id' => $department->id]);}- public function testCanDeleteDepartment()+ public function test_can_delete_department(){$department = Department::factory()->create();diff --git a/tests/Feature/Departments/Api/DepartmentsIndexTest.php b/tests/Feature/Departments/Api/DepartmentsIndexTest.phpindex e3616e2491..a5997b5718 100644--- a/tests/Feature/Departments/Api/DepartmentsIndexTest.php+++ b/tests/Feature/Departments/Api/DepartmentsIndexTest.php@@ -10,19 +10,19 @@ use Tests\TestCase;class DepartmentsIndexTest extends TestCase{- public function testViewingDepartmentIndexRequiresAuthentication()+ public function test_viewing_department_index_requires_authentication(){$this->getJson(route('api.departments.index'))->assertRedirect();}- public function testViewingDepartmentIndexRequiresPermission()+ public function test_viewing_department_index_requires_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.departments.index'))->assertForbidden();}- public function testDepartmentIndexReturnsExpectedDepartments()+ public function test_department_index_returns_expected_departments(){Department::factory()->count(3)->create();@@ -39,10 +39,10 @@ class DepartmentsIndexTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}- public function testDepartmentIndexAdheresToCompanyScoping()+ public function test_department_index_adheres_to_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Feature/Departments/Api/UpdateDepartmentsTest.php b/tests/Feature/Departments/Api/UpdateDepartmentsTest.phpindex b4eb38301a..92b4df0d97 100644--- a/tests/Feature/Departments/Api/UpdateDepartmentsTest.php+++ b/tests/Feature/Departments/Api/UpdateDepartmentsTest.php@@ -3,14 +3,12 @@namespace Tests\Feature\Departments\Api;use App\Models\Department;-use App\Models\Category;use App\Models\User;use Tests\TestCase;class UpdateDepartmentsTest extends TestCase{-- public function testRequiresPermissionToEditDepartment()+ public function test_requires_permission_to_edit_department(){$department = Department::factory()->create();$this->actingAsForApi(User::factory()->create())@@ -18,7 +16,7 @@ class UpdateDepartmentsTest extends TestCase->assertForbidden();}- public function testCanUpdateDepartmentViaPatch()+ public function test_can_update_department_via_patch(){$department = Department::factory()->create();@@ -37,7 +35,4 @@ class UpdateDepartmentsTest extends TestCase$this->assertEquals('Test Note', $department->notes, 'Note was not updated');}---}diff --git a/tests/Feature/Departments/Ui/CreateDepartmentsTest.php b/tests/Feature/Departments/Ui/CreateDepartmentsTest.phpindex f20a2c7b6a..2a0125e75b 100644--- a/tests/Feature/Departments/Ui/CreateDepartmentsTest.php+++ b/tests/Feature/Departments/Ui/CreateDepartmentsTest.php@@ -2,32 +2,31 @@namespace Tests\Feature\Departments\Ui;-use App\Models\Component;-use App\Models\Department;use App\Models\Company;+use App\Models\Department;use App\Models\User;use Tests\TestCase;class CreateDepartmentsTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('departments.create'))->assertOk();}- public function testPermissionRequiredToCreateDepartment()+ public function test_permission_required_to_create_department(){$this->actingAs(User::factory()->create())->post(route('departments.store'), ['name' => 'Test Department',- 'company_id' => Company::factory()->create()->id+ 'company_id' => Company::factory()->create()->id,])->assertForbidden();}- public function testUserCanCreateDepartments()+ public function test_user_can_create_departments(){$this->assertFalse(Department::where('name', 'Test Department')->exists());@@ -41,6 +40,4 @@ class CreateDepartmentsTest extends TestCase$this->assertTrue(Department::where('name', 'Test Department')->where('notes', 'Test Note')->exists());}--}diff --git a/tests/Feature/Departments/Ui/IndexDepartmentsTest.php b/tests/Feature/Departments/Ui/IndexDepartmentsTest.phpindex d4ad9259c0..dfa95c17d0 100644--- a/tests/Feature/Departments/Ui/IndexDepartmentsTest.php+++ b/tests/Feature/Departments/Ui/IndexDepartmentsTest.php@@ -2,27 +2,26 @@namespace Tests\Feature\Departments\Ui;-use App\Models\Component;use App\Models\User;use Tests\TestCase;class IndexDepartmentsTest extends TestCase{- public function testPermissionRequiredToViewDepartmentsList()+ public function test_permission_required_to_view_departments_list(){$this->actingAs(User::factory()->create())->get(route('departments.index'))->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('departments.index'))->assertOk();}- public function testUserCanListDepartments()+ public function test_user_can_list_departments(){$this->actingAs(User::factory()->superuser()->create())->get(route('departments.index'))diff --git a/tests/Feature/Departments/Ui/ShowDepartmentTest.php b/tests/Feature/Departments/Ui/ShowDepartmentTest.phpindex f1373ccc2a..a2f2b32bc3 100644--- a/tests/Feature/Departments/Ui/ShowDepartmentTest.php+++ b/tests/Feature/Departments/Ui/ShowDepartmentTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowDepartmentTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('departments.show', Department::factory()->create()))diff --git a/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php b/tests/Feature/Departments/Ui/UpdateDepartmentsTest.phpindex 83e52bf7c0..9b7c396285 100644--- a/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php+++ b/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php@@ -3,13 +3,12 @@namespace Tests\Feature\Departments\Ui;use App\Models\Department;-use App\Models\Category;use App\Models\User;use Tests\TestCase;class UpdateDepartmentsTest extends TestCase{- public function testPermissionRequiredToStoreDepartment()+ public function test_permission_required_to_store_department(){$this->actingAs(User::factory()->create())->post(route('departments.store'), [@@ -19,14 +18,14 @@ class UpdateDepartmentsTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('departments.edit', Department::factory()->create()))->assertOk();}- public function testUserCanEditDepartments()+ public function test_user_can_edit_departments(){$department = Department::factory()->create(['name' => 'Test Department']);$this->assertTrue(Department::where('name', 'Test Department')->exists());@@ -44,7 +43,4 @@ class UpdateDepartmentsTest extends TestCase$this->assertTrue(Department::where('name', 'Test Department Edited')->where('notes', 'Test Note Edited')->exists());}---}diff --git a/tests/Feature/Depreciations/Api/DeleteDepreciationsTest.php b/tests/Feature/Depreciations/Api/DeleteDepreciationsTest.phpindex 0273d7168e..d12274f25b 100644--- a/tests/Feature/Depreciations/Api/DeleteDepreciationsTest.php+++ b/tests/Feature/Depreciations/Api/DeleteDepreciationsTest.php@@ -20,7 +20,7 @@ class DeleteDepreciationsTest extends TestCase implements TestsPermissionsRequir$this->assertDatabaseHas('depreciations', ['id' => $depreciation->id]);}- public function testCannotDeleteDepreciationThatHasAssociatedModels()+ public function test_cannot_delete_depreciation_that_has_associated_models(){$depreciation = Depreciation::factory()->hasModels()->create();@@ -31,7 +31,7 @@ class DeleteDepreciationsTest extends TestCase implements TestsPermissionsRequir$this->assertDatabaseHas('depreciations', ['id' => $depreciation->id]);}- public function testCanDeleteDepreciation()+ public function test_can_delete_depreciation(){$depreciation = Depreciation::factory()->create();diff --git a/tests/Feature/Depreciations/Api/DepreciationsIndexTest.php b/tests/Feature/Depreciations/Api/DepreciationsIndexTest.phpindex c70ef4d587..15b4775512 100644--- a/tests/Feature/Depreciations/Api/DepreciationsIndexTest.php+++ b/tests/Feature/Depreciations/Api/DepreciationsIndexTest.php@@ -7,11 +7,10 @@ use Tests\TestCase;class DepreciationsIndexTest extends TestCase{- public function testViewingDepreciationIndexRequiresPermission()+ public function test_viewing_depreciation_index_requires_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.depreciations.index'))->assertForbidden();}-}diff --git a/tests/Feature/Depreciations/Ui/CreateDepreciationTest.php b/tests/Feature/Depreciations/Ui/CreateDepreciationTest.phpindex 608194971a..27c8662193 100644--- a/tests/Feature/Depreciations/Ui/CreateDepreciationTest.php+++ b/tests/Feature/Depreciations/Ui/CreateDepreciationTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class CreateDepreciationTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('depreciations.create'))diff --git a/tests/Feature/Depreciations/Ui/DepreciationsIndexTest.php b/tests/Feature/Depreciations/Ui/DepreciationsIndexTest.phpindex 85ca2e55dd..1508b79f00 100644--- a/tests/Feature/Depreciations/Ui/DepreciationsIndexTest.php+++ b/tests/Feature/Depreciations/Ui/DepreciationsIndexTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class DepreciationsIndexTest extends TestCase{- public function testPermissionRequiredToViewDepreciationsList()+ public function test_permission_required_to_view_depreciations_list(){$this->actingAs(User::factory()->create())->get(route('depreciations.index'))->assertForbidden();}- public function testUserCanListDepreciations()+ public function test_user_can_list_depreciations(){$this->actingAs(User::factory()->admin()->create())->get(route('depreciations.index'))diff --git a/tests/Feature/Depreciations/Ui/ShowDepreciationTest.php b/tests/Feature/Depreciations/Ui/ShowDepreciationTest.phpindex 0799e78ff3..2fcf72ed0d 100644--- a/tests/Feature/Depreciations/Ui/ShowDepreciationTest.php+++ b/tests/Feature/Depreciations/Ui/ShowDepreciationTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowDepreciationTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('depreciations.show', Depreciation::factory()->create()->id))diff --git a/tests/Feature/Depreciations/Ui/UpdateDepreciationTest.php b/tests/Feature/Depreciations/Ui/UpdateDepreciationTest.phpindex 66fbb6f741..7d2608d76d 100644--- a/tests/Feature/Depreciations/Ui/UpdateDepreciationTest.php+++ b/tests/Feature/Depreciations/Ui/UpdateDepreciationTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class UpdateDepreciationTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('depreciations.edit', Depreciation::factory()->create()->id))diff --git a/tests/Feature/Groups/Api/DeleteGroupsTest.php b/tests/Feature/Groups/Api/DeleteGroupsTest.phpindex 107e1878d4..33920b2964 100644--- a/tests/Feature/Groups/Api/DeleteGroupsTest.php+++ b/tests/Feature/Groups/Api/DeleteGroupsTest.php@@ -20,7 +20,7 @@ class DeleteGroupsTest extends TestCase implements TestsPermissionsRequirement$this->assertDatabaseHas('permission_groups', ['id' => $group->id]);}- public function testCanDeleteGroup()+ public function test_can_delete_group(){$group = Group::factory()->create();diff --git a/tests/Feature/Groups/Api/StoreGroupTest.php b/tests/Feature/Groups/Api/StoreGroupTest.phpindex 484c921a6c..a493f55da2 100644--- a/tests/Feature/Groups/Api/StoreGroupTest.php+++ b/tests/Feature/Groups/Api/StoreGroupTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class StoreGroupTest extends TestCase{- public function testStoringGroupRequiresSuperAdminPermission()+ public function test_storing_group_requires_super_admin_permission(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.groups.store'))->assertForbidden();}- public function testCanStoreGroupWithPermissionsPassed()+ public function test_can_store_group_with_permissions_passed(){$this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.groups.store'), [@@ -38,12 +38,12 @@ class StoreGroupTest extends TestCase$this->assertEquals('0', $group->decodePermissions()['reports.view']);}- public function testStoringGroupWithoutPermissionPassed()+ public function test_storing_group_without_permission_passed(){$superuser = User::factory()->superuser()->create();$this->actingAsForApi($superuser)->postJson(route('api.groups.store'), [- 'name' => 'My Awesome Group'+ 'name' => 'My Awesome Group',])->assertOk();@@ -58,11 +58,11 @@ class StoreGroupTest extends TestCase);$this->actingAsForApi($superuser)- ->getJson(route('api.groups.show', ['group' => $group]))+ ->getJson(route('api.groups.show', ['group' => $group]))->assertOk();}- public function testStoringGroupWithInvalidPermissionDropsBadPermission()+ public function test_storing_group_with_invalid_permission_drops_bad_permission(){$this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.groups.store'), [diff --git a/tests/Feature/Groups/Ui/CreateGroupTest.php b/tests/Feature/Groups/Ui/CreateGroupTest.phpindex 796905c50f..2967d8ccfb 100644--- a/tests/Feature/Groups/Ui/CreateGroupTest.php+++ b/tests/Feature/Groups/Ui/CreateGroupTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class CreateGroupTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('groups.create'))->assertOk();}- public function testUserCanCreateGroup()+ public function test_user_can_create_group(){$this->assertFalse(Group::where('name', 'Test Group')->exists());diff --git a/tests/Feature/Groups/Ui/IndexGroupTest.php b/tests/Feature/Groups/Ui/IndexGroupTest.phpindex a2d67f903c..9c2e5019de 100644--- a/tests/Feature/Groups/Ui/IndexGroupTest.php+++ b/tests/Feature/Groups/Ui/IndexGroupTest.php@@ -7,16 +7,16 @@ use Tests\TestCase;class IndexGroupTest extends TestCase{- public function testPermissionRequiredToViewGroupList()+ public function test_permission_required_to_view_group_list(){$this->actingAs(User::factory()->create())->get(route('groups.index'))->assertForbidden();- //$this->followRedirects($response)->assertSee('sad-panda.png');+ // $this->followRedirects($response)->assertSee('sad-panda.png');}- public function testUserCanListGroups()+ public function test_user_can_list_groups(){$this->actingAs(User::factory()->superuser()->create())->get(route('groups.index'))diff --git a/tests/Feature/Groups/Ui/ShowGroupTest.php b/tests/Feature/Groups/Ui/ShowGroupTest.phpindex e0106c12ef..ec0e62da13 100644--- a/tests/Feature/Groups/Ui/ShowGroupTest.php+++ b/tests/Feature/Groups/Ui/ShowGroupTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowGroupTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('groups.show', Group::factory()->create()->id))diff --git a/tests/Feature/Groups/Ui/UpdateGroupTest.php b/tests/Feature/Groups/Ui/UpdateGroupTest.phpindex edb2368726..3f567822e7 100644--- a/tests/Feature/Groups/Ui/UpdateGroupTest.php+++ b/tests/Feature/Groups/Ui/UpdateGroupTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class UpdateGroupTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('groups.edit', Group::factory()->create()->id))->assertOk();}- public function testUserCanEditGroups()+ public function test_user_can_edit_groups(){$group = Group::factory()->create(['name' => 'Test Group']);$this->assertTrue(Group::where('name', 'Test Group')->exists());diff --git a/tests/Feature/Importing/Api/GeneralImportTest.php b/tests/Feature/Importing/Api/GeneralImportTest.phpindex 5c38dab7f3..f69a74189f 100644--- a/tests/Feature/Importing/Api/GeneralImportTest.php+++ b/tests/Feature/Importing/Api/GeneralImportTest.php@@ -6,7 +6,7 @@ use App\Models\User;class GeneralImportTest extends ImportDataTestCase{- public function testRequiresExistingImport()+ public function test_requires_existing_import(){$this->actingAsForApi(User::factory()->canImport()->create());diff --git a/tests/Feature/Importing/Api/ImportAccessoriesTest.php b/tests/Feature/Importing/Api/ImportAccessoriesTest.phpindex 1699a670b3..8843a630d0 100644--- a/tests/Feature/Importing/Api/ImportAccessoriesTest.php+++ b/tests/Feature/Importing/Api/ImportAccessoriesTest.php@@ -6,11 +6,11 @@ use App\Models\Accessory;use App\Models\Actionlog;use App\Models\Import;use App\Models\User;-use Illuminate\Support\Str;-use PHPUnit\Framework\Attributes\Test;use Illuminate\Foundation\Testing\WithFaker;use Illuminate\Support\Arr;+use Illuminate\Support\Str;use Illuminate\Testing\TestResponse;+use PHPUnit\Framework\Attributes\Test;use Tests\Concerns\TestsPermissionsRequirement;use Tests\Support\Importing\AccessoriesImportFileBuilder as ImportFileBuilder;use Tests\Support\Importing\CleansUpImportFiles;@@ -22,7 +22,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissioprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'accessory';}@@ -38,7 +38,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function userWithImportAccessoryPermissionCanImportAccessories(): void+ public function user_with_import_accessory_permission_can_import_accessories(): void{$this->actingAsForApi(User::factory()->canImport()->create());@@ -48,7 +48,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function importAccessory(): void+ public function import_accessory(): void{$importFileBuilder = ImportFileBuilder::new();$row = $importFileBuilder->firstRow();@@ -58,11 +58,11 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',+ 'payload' => null,+ 'status' => 'success','messages' => [- 'redirect_url' => route('accessories.index')- ]+ 'redirect_url' => route('accessories.index'),+ ],]);$newAccessory = Accessory::query()@@ -98,7 +98,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function whenImportFileContainsUnknownColumns(): void+ public function when_import_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumn'] = $this->faker->word;@@ -113,7 +113,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willFormatDate(): void+ public function will_format_date(): void{$importFileBuilder = ImportFileBuilder::new(['purchaseDate' => '2022/10/10']);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -129,7 +129,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewCategoryWhenCategoryExists(): void+ public function will_not_create_new_category_when_category_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['category' => Str::random()]);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -145,7 +145,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewAccessoryWhenAccessoryWithNameExists(): void+ public function will_not_create_new_accessory_when_accessory_with_name_exists(): void{$accessory = Accessory::factory()->create(['name' => Str::random()]);$importFileBuilder = ImportFileBuilder::times(2)->replace(['itemName' => $accessory->name]);@@ -163,7 +163,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewCompanyWhenCompanyAlreadyExists(): void+ public function will_not_create_new_company_when_company_already_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['companyName' => Str::random()]);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -179,7 +179,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewLocationWhenLocationAlreadyExists(): void+ public function will_not_create_new_location_when_location_already_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['location' => Str::random()]);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -195,7 +195,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewManufacturerWhenManufacturerAlreadyExists(): void+ public function will_not_create_new_manufacturer_when_manufacturer_already_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['manufacturerName' => $this->faker->company]);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -211,7 +211,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewSupplierWhenSupplierAlreadyExists(): void+ public function will_not_create_new_supplier_when_supplier_already_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['supplierName' => $this->faker->company]);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -227,7 +227,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function whenColumnsAreMissingInImportFile(): void+ public function when_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new()->forget(['minimumAmount', 'purchaseCost', 'purchaseDate']);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -245,7 +245,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new()->forget(['itemName', 'quantity', 'category']);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -261,15 +261,15 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio'Accessory' => ['name' => ['The name field is required.'],'qty' => ['The qty field must be at least 1.'],- 'category_id' => ['The category id field is required.']- ]- ]- ]+ 'category_id' => ['The category id field is required.'],+ ],+ ],+ ],]);}#[Test]- public function updateAccessoryFromImport(): void+ public function update_accessory_from_import(): void{$accessory = Accessory::factory()->create(['name' => Str::random()])->refresh();$importFileBuilder = ImportFileBuilder::new(['itemName' => $accessory->name]);@@ -283,7 +283,7 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio$updatedAttributes = ['name', 'company_id', 'qty', 'purchase_date', 'purchase_cost','order_number', 'notes', 'category_id', 'manufacturer_id', 'supplier_id',- 'location_id', 'model_number', 'updated_at'+ 'location_id', 'model_number', 'updated_at',];$this->assertEquals($row['itemName'], $updatedAccessory->name);@@ -307,26 +307,26 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function whenImportFileContainsEmptyValues(): void+ public function when_import_file_contains_empty_values(): void{$accessory = Accessory::factory()->create(['name' => Str::random()]);$accessory->refresh();$importFileBuilder = ImportFileBuilder::new([- 'companyName' => ' ',- 'purchaseDate' => ' ',- 'purchaseCost' => '',- 'location' => '',- 'companyName' => '',- 'orderNumber' => '',- 'category' => '',- 'quantity' => '',+ 'companyName' => ' ',+ 'purchaseDate' => ' ',+ 'purchaseCost' => '',+ 'location' => '',+ 'companyName' => '',+ 'orderNumber' => '',+ 'category' => '',+ 'quantity' => '','manufacturerName' => '',- 'supplierName' => '',- 'notes' => '',- 'requestAble' => '',- 'minimumAmount' => '',- 'modelNumber' => ''+ 'supplierName' => '',+ 'notes' => '',+ 'requestAble' => '',+ 'minimumAmount' => '',+ 'modelNumber' => '',]);$import = Import::factory()->accessory()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -341,10 +341,10 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio$importFileBuilder->firstRow()['itemName'] => ['Accessory' => ['qty' => ['The qty field must be at least 1.'],- 'category_id' => ['The category id field is required.']- ]- ]- ]+ 'category_id' => ['The category id field is required.'],+ ],+ ],+ ],]);$importFileBuilder->replace(['itemName' => $accessory->name]);@@ -360,22 +360,22 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function customColumnMapping(): void+ public function custom_column_mapping(): void{$faker = ImportFileBuilder::new()->definition();$row = [- 'itemName' => $faker['modelNumber'],- 'purchaseDate' => $faker['notes'],- 'purchaseCost' => $faker['location'],- 'location' => $faker['purchaseCost'],- 'companyName' => $faker['orderNumber'],- 'orderNumber' => $faker['companyName'],- 'category' => $faker['manufacturerName'],+ 'itemName' => $faker['modelNumber'],+ 'purchaseDate' => $faker['notes'],+ 'purchaseCost' => $faker['location'],+ 'location' => $faker['purchaseCost'],+ 'companyName' => $faker['orderNumber'],+ 'orderNumber' => $faker['companyName'],+ 'category' => $faker['manufacturerName'],'manufacturerName' => $faker['category'],- 'notes' => $faker['purchaseDate'],- 'minimumAmount' => $faker['supplierName'],- 'modelNumber' => $faker['itemName'],- 'quantity' => $faker['quantity']+ 'notes' => $faker['purchaseDate'],+ 'minimumAmount' => $faker['supplierName'],+ 'modelNumber' => $faker['itemName'],+ 'quantity' => $faker['quantity'],];$importFileBuilder = new ImportFileBuilder([$row]);@@ -385,20 +385,20 @@ class ImportAccessoriesTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id,'column-mappings' => [- 'Item Name' => 'model_number',+ 'Item Name' => 'model_number','Purchase Date' => 'notes','Purchase Cost' => 'location',- 'Location' => 'purchase_cost',- 'Company' => 'order_number',- 'Order Number' => 'company',- 'Category' => 'manufacturer',- 'Manufacturer' => 'category',- 'Supplier' => 'min_amt',- 'Notes' => 'purchase_date',- 'Min QTY' => 'supplier',- 'Model Number' => 'item_name',- 'Quantity' => 'quantity'- ]+ 'Location' => 'purchase_cost',+ 'Company' => 'order_number',+ 'Order Number' => 'company',+ 'Category' => 'manufacturer',+ 'Manufacturer' => 'category',+ 'Supplier' => 'min_amt',+ 'Notes' => 'purchase_date',+ 'Min QTY' => 'supplier',+ 'Model Number' => 'item_name',+ 'Quantity' => 'quantity',+ ],])->assertOk();$newAccessory = Accessory::query()diff --git a/tests/Feature/Importing/Api/ImportAssetModelsTest.php b/tests/Feature/Importing/Api/ImportAssetModelsTest.phpindex 0d45dd4c84..4298a14cd5 100644--- a/tests/Feature/Importing/Api/ImportAssetModelsTest.php+++ b/tests/Feature/Importing/Api/ImportAssetModelsTest.php@@ -2,18 +2,17 @@namespace Tests\Feature\Importing\Api;-use App\Models\Category;use App\Models\AssetModel;-use App\Models\User;+use App\Models\Category;use App\Models\Import;+use App\Models\User;use Illuminate\Foundation\Testing\WithFaker;-use Illuminate\Support\Arr;use Illuminate\Support\Str;use Illuminate\Testing\TestResponse;use PHPUnit\Framework\Attributes\Test;use Tests\Concerns\TestsPermissionsRequirement;-use Tests\Support\Importing\CleansUpImportFiles;use Tests\Support\Importing\AssetModelsImportFileBuilder as ImportFileBuilder;+use Tests\Support\Importing\CleansUpImportFiles;class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissionsRequirement{@@ -22,7 +21,7 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissioprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'assetModel';}@@ -36,9 +35,9 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => 44])->assertForbidden();}-+#[Test]- public function importAssetModels(): void+ public function import_asset_models(): void{$importFileBuilder = ImportFileBuilder::new();$row = $importFileBuilder->firstRow();@@ -48,9 +47,9 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id, 'send-welcome' => 0])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('models.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('models.index')],]);$newAssetModel = AssetModel::query()@@ -64,7 +63,7 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -78,9 +77,8 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id])->assertOk();}-#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new(['name' => '']);$import = Import::factory()->assetmodel()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -90,16 +88,15 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => ['' => ['name' => [- 'name' =>- ['The name field is required.'],+ 'name' => ['The name field is required.'],],- ]- ]+ ],+ ],]);$newAssetModels = AssetModel::query()@@ -109,9 +106,8 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio$this->assertCount(0, $newAssetModels);}-#[Test]- public function updateAssetModelFromImport(): void+ public function update_asset_model_from_import(): void{$assetmodel = AssetModel::factory()->create();$category = Category::find($assetmodel->category_id);@@ -124,9 +120,9 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id, 'import-update' => true])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('models.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('models.index')],]);$updatedAssetmodel = AssetModel::query()->find($assetmodel->id);@@ -135,6 +131,4 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio$this->assertEquals($row['name'], $updatedAssetmodel->name);}--}diff --git a/tests/Feature/Importing/Api/ImportAssetsTest.php b/tests/Feature/Importing/Api/ImportAssetsTest.phpindex 9a88260874..d8a650c33f 100644--- a/tests/Feature/Importing/Api/ImportAssetsTest.php+++ b/tests/Feature/Importing/Api/ImportAssetsTest.php@@ -2,18 +2,14 @@namespace Tests\Feature\Importing\Api;-use App\Mail\CheckoutAssetMail;use App\Models\Actionlog as ActionLog;use App\Models\Asset;use App\Models\CustomField;use App\Models\Import;use App\Models\User;-use App\Notifications\CheckoutAssetNotification;use Carbon\Carbon;use Illuminate\Foundation\Testing\WithFaker;use Illuminate\Support\Arr;-use Illuminate\Support\Facades\Mail;-use Illuminate\Support\Facades\Notification;use Illuminate\Support\Str;use Illuminate\Testing\TestResponse;use PHPUnit\Framework\Attributes\Test;@@ -28,7 +24,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReqprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'asset';}@@ -44,7 +40,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function userWithImportAssetsPermissionCanImportAssets(): void+ public function user_with_import_assets_permission_can_import_assets(): void{$this->actingAsForApi(User::factory()->canImport()->create());@@ -54,7 +50,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function importAsset(): void+ public function import_asset(): void{$importFileBuilder = ImportFileBuilder::new();@@ -65,9 +61,9 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq$this->importFileResponse(['import' => $import->id])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('hardware.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('hardware.index')],]);$newAsset = Asset::query()@@ -137,13 +133,13 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq$this->assertEquals(0, $newAsset->requests_counter);$this->assertEquals(0, $newAsset->byod);- //Notes is never read.+ // Notes is never read.// $this->assertEquals($row['notes'], $newAsset->notes);}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -158,7 +154,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willNotCreateNewAssetWhenAssetWithSameTagAlreadyExists(): void+ public function will_not_create_new_asset_when_asset_with_same_tag_already_exists(): void{$asset = Asset::factory()->create(['asset_tag' => $this->faker->uuid]);$importFileBuilder = ImportFileBuilder::times(4)->replace(['tag' => $asset->asset_tag]);@@ -174,11 +170,11 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq'' => ['asset_tag' => ['asset_tag' => [- "An asset with the asset tag {$asset->asset_tag} already exists and an update was not requested. No change was made."- ]- ]- ]- ]+ "An asset with the asset tag {$asset->asset_tag} already exists and an update was not requested. No change was made.",+ ],+ ],+ ],+ ],]);$assetsWithSameTag = Asset::query()->where('asset_tag', $asset->asset_tag)->get();@@ -187,7 +183,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willNotCreateNewCompanyWhenCompanyExists(): void+ public function will_not_create_new_company_when_company_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['companyName' => Str::random()]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -203,7 +199,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willNotCreateNewLocationWhenLocationExists(): void+ public function will_not_create_new_location_when_location_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['location' => Str::random()]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -219,7 +215,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willNotCreateNewSupplierWhenSupplierExists(): void+ public function will_not_create_new_supplier_when_supplier_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['supplierName' => $this->faker->company]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -235,7 +231,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willNotCreateNewManufacturerWhenManufacturerExists(): void+ public function will_not_create_new_manufacturer_when_manufacturer_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['manufacturerName' => $this->faker->company]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -252,7 +248,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willNotCreateCategoryWhenCategoryExists(): void+ public function will_not_create_category_when_category_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['category' => $this->faker->company]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -269,7 +265,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willNotCreateNewAssetModelWhenAssetModelExists(): void+ public function will_not_create_new_asset_model_when_asset_model_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['model' => Str::random()]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -286,12 +282,12 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function whenColumnsAreMissingInImportFile(): void+ public function when_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::times()->forget(['purchaseCost','purchaseDate',- 'status'+ 'status',]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -310,11 +306,11 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willFormatValues(): void+ public function will_format_values(): void{$importFileBuilder = ImportFileBuilder::new(['warrantyInMonths' => '3 months',- 'purchaseDate' => '2022/10/10'+ 'purchaseDate' => '2022/10/10',]);$import = Import::factory()->asset()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -331,7 +327,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::times(2)->forget(['tag'])@@ -353,9 +349,9 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq'The asset tag field must be at least 1 characters.',],'model_id' => [- 'The model id field is required.'- ]- ]+ 'The model id field is required.',+ ],+ ],],$rows[1]['itemName'] => ["Asset \"{$rows[1]['itemName']}\"" => [@@ -363,11 +359,11 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq'The asset tag field must be at least 1 characters.',],'model_id' => [- 'The model id field is required.'- ]- ]- ]- ]+ 'The model id field is required.',+ ],+ ],+ ],+ ],]);$newAssets = Asset::query()@@ -378,7 +374,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function updateAssetFromImport(): void+ public function update_asset_from_import(): void{$asset = Asset::factory()->create()->refresh();$importFileBuilder = ImportFileBuilder::times(1)->replace(['tag' => $asset->asset_tag]);@@ -398,7 +394,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq'category', 'manufacturer_id', 'name', 'tag', 'model_id','model_number', 'purchase_date', 'purchase_cost', 'warranty_months', 'supplier_id','location_id', 'company_id', 'serial', 'assigned_to', 'status_id', 'rtd_location_id',- 'last_checkout', 'requestable', 'updated_at', 'checkout_counter', 'assigned_type'+ 'last_checkout', 'requestable', 'updated_at', 'checkout_counter', 'assigned_type',];$this->assertEquals($row['assigneeFullName'], "{$assignee->first_name} {$assignee->last_name}");@@ -420,9 +416,9 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq$this->assertEquals($row['companyName'], $updatedAsset->company->name);$this->assertEquals($row['location'], $updatedAsset->location->name);$this->assertEquals(1, $updatedAsset->checkout_counter);- $this->assertEquals(user::class, $updatedAsset->assigned_type);+ $this->assertEquals(User::class, $updatedAsset->assigned_type);- //RequestAble is always updated regardless of initial value.+ // RequestAble is always updated regardless of initial value.// $this->assertEquals($asset->requestable, $updatedAsset->requestable);$this->assertEquals(@@ -432,28 +428,28 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function customColumnMapping(): void+ public function custom_column_mapping(): void{$faker = ImportFileBuilder::new()->definition();$row = [- 'assigneeFullName' => $faker['supplierName'],- 'assigneeEmail' => $faker['manufacturerName'],- 'assigneeUsername' => $faker['serialNumber'],- 'category' => $faker['location'],- 'companyName' => $faker['purchaseCost'],- 'itemName' => $faker['modelNumber'],- 'location' => $faker['assigneeUsername'],- 'manufacturerName' => $faker['status'],- 'model' => $faker['itemName'],- 'modelNumber' => $faker['category'],- 'notes' => $faker['notes'],- 'purchaseCost' => $faker['model'],- 'purchaseDate' => $faker['companyName'],- 'serialNumber' => $faker['tag'],- 'supplierName' => $faker['purchaseDate'],- 'status' => $faker['warrantyInMonths'],- 'tag' => $faker['assigneeEmail'],- 'warrantyInMonths' => $faker['assigneeFullName'],+ 'assigneeFullName' => $faker['supplierName'],+ 'assigneeEmail' => $faker['manufacturerName'],+ 'assigneeUsername' => $faker['serialNumber'],+ 'category' => $faker['location'],+ 'companyName' => $faker['purchaseCost'],+ 'itemName' => $faker['modelNumber'],+ 'location' => $faker['assigneeUsername'],+ 'manufacturerName' => $faker['status'],+ 'model' => $faker['itemName'],+ 'modelNumber' => $faker['category'],+ 'notes' => $faker['notes'],+ 'purchaseCost' => $faker['model'],+ 'purchaseDate' => $faker['companyName'],+ 'serialNumber' => $faker['tag'],+ 'supplierName' => $faker['purchaseDate'],+ 'status' => $faker['warrantyInMonths'],+ 'tag' => $faker['assigneeEmail'],+ 'warrantyInMonths' => $faker['assigneeFullName'],];$importFileBuilder = new ImportFileBuilder([$row]);@@ -464,25 +460,25 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq$this->importFileResponse(['import' => $import->id,'column-mappings' => [- 'Asset Tag' => 'email',- 'Category' => 'location',- 'Company' => 'purchase_cost',- 'Email' => 'manufacturer',- 'Full Name' => 'supplier',- 'Item Name' => 'model_number',- 'Location' => 'username',- 'Manufacturer' => 'status',- 'Model name' => 'item_name',- 'Model Number' => 'category',- 'Notes' => 'asset_notes',+ 'Asset Tag' => 'email',+ 'Category' => 'location',+ 'Company' => 'purchase_cost',+ 'Email' => 'manufacturer',+ 'Full Name' => 'supplier',+ 'Item Name' => 'model_number',+ 'Location' => 'username',+ 'Manufacturer' => 'status',+ 'Model name' => 'item_name',+ 'Model Number' => 'category',+ 'Notes' => 'asset_notes','Purchase Cost' => 'asset_model','Purchase Date' => 'company','Serial number' => 'asset_tag',- 'Status' => 'warranty_months',- 'Supplier' => 'purchase_date',- 'Username' => 'serial',- 'Warranty' => 'full_name',- ]+ 'Status' => 'warranty_months',+ 'Supplier' => 'purchase_date',+ 'Username' => 'serial',+ 'Warranty' => 'full_name',+ ],])->assertOk();$asset = Asset::query()@@ -534,7 +530,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function customFields(): void+ public function custom_fields(): void{$macAddress = $this->faker->macAddress;@@ -544,7 +540,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq$importFileBuilder = new ImportFileBuilder([$row]);$customField = CustomField::query()->where('name', 'Mac Address')->firstOrNew();- if (!$customField->exists) {+ if (! $customField->exists) {$customField = CustomField::factory()->macAddress()->create(['db_column' => '_snipeit_mac_address_1']);}@@ -564,7 +560,7 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq}#[Test]- public function willEncryptCustomFields(): void+ public function will_encrypt_custom_fields(): void{$macAddress = $this->faker->macAddress;$row = ImportFileBuilder::new()->definition();@@ -574,11 +570,11 @@ class ImportAssetsTest extends ImportDataTestCase implements TestsPermissionsReq$importFileBuilder = new ImportFileBuilder([$row]);$customField = CustomField::query()->where('name', 'Mac Address')->firstOrNew();- if (!$customField->exists) {+ if (! $customField->exists) {$customField = CustomField::factory()->macAddress()->create();}- if (!$customField->field_encrypted) {+ if (! $customField->field_encrypted) {$customField->field_encrypted = 1;$customField->save();}diff --git a/tests/Feature/Importing/Api/ImportCategoriesTest.php b/tests/Feature/Importing/Api/ImportCategoriesTest.phpindex 6e4d70dfad..b11f4809a2 100644--- a/tests/Feature/Importing/Api/ImportCategoriesTest.php+++ b/tests/Feature/Importing/Api/ImportCategoriesTest.php@@ -3,15 +3,15 @@namespace Tests\Feature\Importing\Api;use App\Models\Category;-use App\Models\User;use App\Models\Import;+use App\Models\User;use Illuminate\Foundation\Testing\WithFaker;use Illuminate\Support\Arr;use Illuminate\Testing\TestResponse;use PHPUnit\Framework\Attributes\Test;use Tests\Concerns\TestsPermissionsRequirement;-use Tests\Support\Importing\CleansUpImportFiles;use Tests\Support\Importing\CategoriesImportFileBuilder as ImportFileBuilder;+use Tests\Support\Importing\CleansUpImportFiles;class ImportCategoriesTest extends ImportDataTestCase implements TestsPermissionsRequirement{@@ -20,7 +20,7 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermissionprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'category';}@@ -36,7 +36,7 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function importCategory(): void+ public function import_category(): void{$importFileBuilder = ImportFileBuilder::new();$row = $importFileBuilder->firstRow();@@ -46,9 +46,9 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermission$this->importFileResponse(['import' => $import->id, 'send-welcome' => 0])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('categories.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('categories.index')],]);$newCategory = Category::query()@@ -60,7 +60,7 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -74,9 +74,8 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermission$this->importFileResponse(['import' => $import->id])->assertOk();}-#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new(['name' => '']);$import = Import::factory()->categories()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -86,17 +85,16 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermission$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => ['' => ['Category ""' => [- 'name' =>- ['The name field is required.'],+ 'name' => ['The name field is required.'],],- ]+ ],- ]+ ],]);$newCategory = Category::query()@@ -106,9 +104,8 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermission$this->assertCount(0, $newCategory);}-#[Test]- public function updateCategoryFromImport(): void+ public function update_category_from_import(): void{$category = Category::factory()->create()->refresh();$importFileBuilder = ImportFileBuilder::new(['name' => $category->name, 'category_type' => 'asset', 'notes' => $category->notes, 'use_default_eula' => 0, 'require_acceptance' => 0, 'checkin_email' => 0]);@@ -131,5 +128,4 @@ class ImportCategoriesTest extends ImportDataTestCase implements TestsPermissionArr::except($updatedCategory->attributesToArray(), array_merge($updatedAttributes, $category->getDates())),);}-}diff --git a/tests/Feature/Importing/Api/ImportComponentsTest.php b/tests/Feature/Importing/Api/ImportComponentsTest.phpindex 7fb59bdfd5..bd9cf1071d 100644--- a/tests/Feature/Importing/Api/ImportComponentsTest.php+++ b/tests/Feature/Importing/Api/ImportComponentsTest.php@@ -22,7 +22,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermissionprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'component';}@@ -38,7 +38,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function userWithImportAssetsPermissionCanImportComponents(): void+ public function user_with_import_assets_permission_can_import_components(): void{$this->actingAsForApi(User::factory()->canImport()->create());@@ -48,7 +48,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function importComponents(): void+ public function import_components(): void{Notification::fake();@@ -60,9 +60,9 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission$this->importFileResponse(['import' => $import->id])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('components.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('components.index')],]);$newComponent = Component::query()@@ -95,7 +95,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->firstRow();$row['unknownColumnInCsvFile'] = 'foo';@@ -110,13 +110,13 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function willNotCreateNewComponentWhenComponentWithNameAndSerialNumberExists(): void+ public function will_not_create_new_component_when_component_with_name_and_serial_number_exists(): void{$component = Component::factory()->create();$importFileBuilder = ImportFileBuilder::times(4)->replace([- 'itemName' => $component->name,- 'serialNumber' => $component->serial+ 'itemName' => $component->name,+ 'serialNumber' => $component->serial,]);$import = Import::factory()->component()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -134,7 +134,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function willNotCreateNewCompanyWhenCompanyExists(): void+ public function will_not_create_new_company_when_company_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['companyName' => Str::random()]);$import = Import::factory()->component()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -150,7 +150,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function willNotCreateNewLocationWhenLocationExists(): void+ public function will_not_create_new_location_when_location_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['location' => Str::random()]);$import = Import::factory()->component()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -166,7 +166,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function willNotCreateNewCategoryWhenCategoryExists(): void+ public function will_not_create_new_category_when_category_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['category' => $this->faker->company]);$import = Import::factory()->component()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -182,7 +182,7 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new()->replace(['category' => ''])@@ -196,16 +196,16 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => [$row['itemName'] => ['Component' => ['qty' => ['The qty field must be at least 1.'],- 'category_id' => ['The category id field is required.']- ]- ]- ]+ 'category_id' => ['The category id field is required.'],+ ],+ ],+ ],]);$newComponents = Component::query()@@ -216,12 +216,12 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function updateComponentFromImport(): void+ public function update_component_from_import(): void{$component = Component::factory()->create();$importFileBuilder = ImportFileBuilder::new([- 'itemName' => $component->name,- 'serialNumber' => $component->serial+ 'itemName' => $component->name,+ 'serialNumber' => $component->serial,]);$row = $importFileBuilder->firstRow();@@ -250,19 +250,19 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission}#[Test]- public function customColumnMapping(): void+ public function custom_column_mapping(): void{$faker = ImportFileBuilder::new()->definition();$row = [- 'category' => $faker['serialNumber'],- 'companyName' => $faker['quantity'],- 'itemName' => $faker['purchaseDate'],- 'location' => $faker['purchaseCost'],- 'orderNumber' => $faker['orderNumber'],+ 'category' => $faker['serialNumber'],+ 'companyName' => $faker['quantity'],+ 'itemName' => $faker['purchaseDate'],+ 'location' => $faker['purchaseCost'],+ 'orderNumber' => $faker['orderNumber'],'purchaseCost' => $faker['category'],'purchaseDate' => $faker['companyName'],- 'quantity' => $faker['itemName'],- 'serialNumber' => $faker['location']+ 'quantity' => $faker['itemName'],+ 'serialNumber' => $faker['location'],];$importFileBuilder = new ImportFileBuilder([$row]);@@ -273,16 +273,16 @@ class ImportComponentsTest extends ImportDataTestCase implements TestsPermission$this->importFileResponse(['import' => $import->id,'column-mappings' => [- 'Category' => 'serial',- 'Company' => 'quantity',- 'item Name' => 'purchase_date',- 'Location' => 'purchase_cost',- 'Order Number' => 'order_number',+ 'Category' => 'serial',+ 'Company' => 'quantity',+ 'item Name' => 'purchase_date',+ 'Location' => 'purchase_cost',+ 'Order Number' => 'order_number','Purchase Cost' => 'category','Purchase Date' => 'company',- 'Quantity' => 'item_name',+ 'Quantity' => 'item_name','Serial number' => 'location',- ]+ ],])->assertOk();$newComponent = Component::query()diff --git a/tests/Feature/Importing/Api/ImportConsumablesTest.php b/tests/Feature/Importing/Api/ImportConsumablesTest.phpindex 9b1da22790..c7b86334b2 100644--- a/tests/Feature/Importing/Api/ImportConsumablesTest.php+++ b/tests/Feature/Importing/Api/ImportConsumablesTest.php@@ -22,7 +22,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissioprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'consumable';}@@ -38,7 +38,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function userWithImportAssetsPermissionCanImportConsumables(): void+ public function user_with_import_assets_permission_can_import_consumables(): void{$this->actingAsForApi(User::factory()->canImport()->create());@@ -48,7 +48,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function importConsumables(): void+ public function import_consumables(): void{Notification::fake();@@ -60,9 +60,9 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('consumables.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('consumables.index')],]);$newConsumable = Consumable::query()@@ -97,7 +97,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -112,7 +112,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewConsumableWhenConsumableNameAlreadyExist(): void+ public function will_not_create_new_consumable_when_consumable_name_already_exist(): void{$consumable = Consumable::factory()->create(['name' => Str::random()]);$importFileBuilder = ImportFileBuilder::new(['itemName' => $consumable->name]);@@ -130,7 +130,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewCompanyWhenCompanyExists(): void+ public function will_not_create_new_company_when_company_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['companyName' => Str::random()]);$import = Import::factory()->consumable()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -146,7 +146,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewLocationWhenLocationExists(): void+ public function will_not_create_new_location_when_location_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['location' => Str::random()]);$import = Import::factory()->consumable()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -162,7 +162,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function willNotCreateNewCategoryWhenCategoryExists(): void+ public function will_not_create_new_category_when_category_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['category' => Str::random()]);$import = Import::factory()->consumable()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -178,7 +178,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new(['category' => ''])->forget(['quantity', 'name']);@@ -190,15 +190,15 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => [$row['itemName'] => ['Consumable' => [- 'category_id' => ['The category id field is required.']- ]- ]- ]+ 'category_id' => ['The category id field is required.'],+ ],+ ],+ ],]);$newConsumables = Consumable::query()@@ -209,7 +209,7 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function updateConsumableFromImport(): void+ public function update_consumable_from_import(): void{$consumable = Consumable::factory()->create(['name' => Str::random()]);$importFileBuilder = ImportFileBuilder::new(['itemName' => $consumable->name]);@@ -244,19 +244,19 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio}#[Test]- public function customColumnMapping(): void+ public function custom_column_mapping(): void{$faker = ImportFileBuilder::new()->definition();$row = [- 'category' => $faker['supplier'],- 'companyName' => $faker['quantity'],- 'itemName' => $faker['purchaseDate'],- 'location' => $faker['purchaseCost'],- 'orderNumber' => $faker['orderNumber'],+ 'category' => $faker['supplier'],+ 'companyName' => $faker['quantity'],+ 'itemName' => $faker['purchaseDate'],+ 'location' => $faker['purchaseCost'],+ 'orderNumber' => $faker['orderNumber'],'purchaseCost' => $faker['location'],'purchaseDate' => $faker['companyName'],- 'quantity' => $faker['itemName'],- 'supplier' => $faker['category']+ 'quantity' => $faker['itemName'],+ 'supplier' => $faker['category'],];$importFileBuilder = new ImportFileBuilder([$row]);@@ -265,21 +265,20 @@ class ImportConsumablesTest extends ImportDataTestCase implements TestsPermissio$this->actingAsForApi(User::factory()->superuser()->create());-// This mapping is incorrect on purpose$this->importFileResponse(['import' => $import->id,'column-mappings' => [- 'Category' => 'supplier',- 'Company' => 'quantity',- 'item Name' => 'purchase_date',- 'Location' => 'purchase_cost',- 'Order Number' => 'order_number',+ 'Category' => 'supplier',+ 'Company' => 'quantity',+ 'item Name' => 'purchase_date',+ 'Location' => 'purchase_cost',+ 'Order Number' => 'order_number','Purchase Cost' => 'location','Purchase Date' => 'company',- 'Quantity' => 'item_name',- 'Supplier' => 'category',- ]+ 'Quantity' => 'item_name',+ 'Supplier' => 'category',+ ],])->assertOk();$newConsumable = Consumable::query()diff --git a/tests/Feature/Importing/Api/ImportLicenseTest.php b/tests/Feature/Importing/Api/ImportLicenseTest.phpindex e7348ec4db..090daa26e7 100644--- a/tests/Feature/Importing/Api/ImportLicenseTest.php+++ b/tests/Feature/Importing/Api/ImportLicenseTest.php@@ -21,7 +21,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsReprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'license';}@@ -37,7 +37,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function userWithImportAssetsPermissionCanImportLicenses(): void+ public function user_with_import_assets_permission_can_import_licenses(): void{$this->actingAsForApi(User::factory()->canImport()->create());@@ -47,7 +47,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function importLicenses(): void+ public function import_licenses(): void{$importFileBuilder = ImportFileBuilder::new();$row = $importFileBuilder->firstRow();@@ -57,9 +57,9 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe$this->importFileResponse(['import' => $import->id])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('licenses.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('licenses.index')],]);$newLicense = License::query()@@ -98,7 +98,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -113,13 +113,13 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function willNotCreateNewLicenseWhenNameAndSerialNumberAlreadyExist(): void+ public function will_not_create_new_license_when_name_and_serial_number_already_exist(): void{$license = License::factory()->create();$importFileBuilder = ImportFileBuilder::times(4)->replace([- 'itemName' => $license->name,- 'serialNumber' => $license->serial+ 'itemName' => $license->name,+ 'serialNumber' => $license->serial,]);$import = Import::factory()->license()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -136,10 +136,10 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function formatAttributes(): void+ public function format_attributes(): void{$importFileBuilder = ImportFileBuilder::new([- 'expirationDate' => '2022/10/10'+ 'expirationDate' => '2022/10/10',]);$import = Import::factory()->license()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -155,7 +155,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function willNotCreateNewCompanyWhenCompanyExists(): void+ public function will_not_create_new_company_when_company_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['companyName' => Str::random()]);$import = Import::factory()->license()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -171,7 +171,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function willNotCreateNewManufacturerWhenManufacturerExists(): void+ public function will_not_create_new_manufacturer_when_manufacturer_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['manufacturerName' => Str::random()]);$import = Import::factory()->license()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -187,7 +187,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function willNotCreateNewCategoryWhenCategoryExists(): void+ public function will_not_create_new_category_when_category_exists(): void{$importFileBuilder = ImportFileBuilder::times(4)->replace(['category' => $this->faker->company]);$import = Import::factory()->license()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -203,7 +203,7 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::times()->replace(['name' => ''])@@ -217,15 +217,15 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => [$row['licenseName'] => ["License \"{$row['licenseName']}\"" => ['seats' => ['The seats field is required.'],- ]- ]- ]+ ],+ ],+ ],]);$newLicenses = License::query()@@ -236,12 +236,12 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function updateLicenseFromImport(): void+ public function update_license_from_import(): void{$license = License::factory()->create();$importFileBuilder = ImportFileBuilder::new([- 'licenseName' => $license->name,- 'serialNumber' => $license->serial+ 'licenseName' => $license->name,+ 'serialNumber' => $license->serial,]);$row = $importFileBuilder->firstRow();@@ -278,26 +278,26 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe}#[Test]- public function customColumnMapping(): void+ public function custom_column_mapping(): void{$faker = ImportFileBuilder::times()->definition();$row = [- 'category' => $faker['supplierName'],- 'companyName' => $faker['serialNumber'],- 'expirationDate' => $faker['seats'],- 'isMaintained' => $faker['purchaseDate'],- 'isReassignAble' => $faker['purchaseCost'],- 'licensedToName' => $faker['orderNumber'],- 'licensedToEmail' => $faker['notes'],- 'licenseName' => $faker['licenseName'],+ 'category' => $faker['supplierName'],+ 'companyName' => $faker['serialNumber'],+ 'expirationDate' => $faker['seats'],+ 'isMaintained' => $faker['purchaseDate'],+ 'isReassignAble' => $faker['purchaseCost'],+ 'licensedToName' => $faker['orderNumber'],+ 'licensedToEmail' => $faker['notes'],+ 'licenseName' => $faker['licenseName'],'manufacturerName' => $faker['category'],- 'notes' => $faker['companyName'],- 'orderNumber' => $faker['expirationDate'],- 'purchaseCost' => $faker['isMaintained'],- 'purchaseDate' => $faker['isReassignAble'],- 'seats' => $faker['licensedToName'],- 'serialNumber' => $faker['licensedToEmail'],- 'supplierName' => $faker['manufacturerName']+ 'notes' => $faker['companyName'],+ 'orderNumber' => $faker['expirationDate'],+ 'purchaseCost' => $faker['isMaintained'],+ 'purchaseDate' => $faker['isReassignAble'],+ 'seats' => $faker['licensedToName'],+ 'serialNumber' => $faker['licensedToEmail'],+ 'supplierName' => $faker['manufacturerName'],];$importFileBuilder = new ImportFileBuilder([$row]);@@ -308,23 +308,23 @@ class ImportLicenseTest extends ImportDataTestCase implements TestsPermissionsRe$this->importFileResponse(['import' => $import->id,'column-mappings' => [- 'Category' => 'supplier',- 'Company' => 'serial',- 'expiration date' => 'seats',- 'maintained' => 'purchase_date',- 'reassignable' => 'purchase_cost',+ 'Category' => 'supplier',+ 'Company' => 'serial',+ 'expiration date' => 'seats',+ 'maintained' => 'purchase_date',+ 'reassignable' => 'purchase_cost','Licensed To Name' => 'order_number','Licensed To Email' => 'notes',- 'licenseName' => 'name',- 'manufacturer' => 'category',- 'Notes' => 'company',- 'Serial number' => 'license_email',- 'Order Number' => 'expiration_date',- 'purchase Cost' => 'maintained',- 'purchase Date' => 'reassignable',- 'seats' => 'license_name',- 'supplier' => 'manufacturer'- ]+ 'licenseName' => 'name',+ 'manufacturer' => 'category',+ 'Notes' => 'company',+ 'Serial number' => 'license_email',+ 'Order Number' => 'expiration_date',+ 'purchase Cost' => 'maintained',+ 'purchase Date' => 'reassignable',+ 'seats' => 'license_name',+ 'supplier' => 'manufacturer',+ ],])->assertOk();$newLicense = License::query()diff --git a/tests/Feature/Importing/Api/ImportLocationsTest.php b/tests/Feature/Importing/Api/ImportLocationsTest.phpindex b1488aaa18..34aea6251d 100644--- a/tests/Feature/Importing/Api/ImportLocationsTest.php+++ b/tests/Feature/Importing/Api/ImportLocationsTest.php@@ -2,9 +2,9 @@namespace Tests\Feature\Importing\Api;+use App\Models\Import;use App\Models\Location;use App\Models\User;-use App\Models\Import;use Illuminate\Foundation\Testing\WithFaker;use Illuminate\Support\Arr;use Illuminate\Testing\TestResponse;@@ -20,7 +20,7 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissionsprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'location';}@@ -36,7 +36,7 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissions}#[Test]- public function importLocation(): void+ public function import_location(): void{$importFileBuilder = ImportFileBuilder::new();$row = $importFileBuilder->firstRow();@@ -46,9 +46,9 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissions$this->importFileResponse(['import' => $import->id, 'send-welcome' => 0])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('locations.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('locations.index')],]);$newLocation = Location::query()@@ -60,7 +60,7 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissions}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -74,9 +74,8 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissions$this->importFileResponse(['import' => $import->id])->assertOk();}-#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new(['name' => '']);$import = Import::factory()->locations()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -86,17 +85,16 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissions$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => ['' => ['Location ""' => [- 'name' =>- ['The name field is required.'],+ 'name' => ['The name field is required.'],],- ]+ ],- ]+ ],]);$newLocation = Location::query()@@ -106,9 +104,8 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissions$this->assertCount(0, $newLocation);}-#[Test]- public function updateLocationFromImport(): void+ public function update_location_from_import(): void{$location = Location::factory()->create()->refresh();$importFileBuilder = ImportFileBuilder::new(['name' => $location->name, 'phone' => $location->phone]);@@ -132,5 +129,4 @@ class ImportLocationsTest extends ImportDataTestCase implements TestsPermissionsArr::except($updatedLocation->attributesToArray(), array_merge($updatedAttributes, $location->getDates())),);}-}diff --git a/tests/Feature/Importing/Api/ImportManufacturersTest.php b/tests/Feature/Importing/Api/ImportManufacturersTest.phpindex 28158af8af..f5c9276488 100644--- a/tests/Feature/Importing/Api/ImportManufacturersTest.php+++ b/tests/Feature/Importing/Api/ImportManufacturersTest.php@@ -2,9 +2,9 @@namespace Tests\Feature\Importing\Api;+use App\Models\Import;use App\Models\Manufacturer;use App\Models\User;-use App\Models\Import;use Illuminate\Foundation\Testing\WithFaker;use Illuminate\Support\Arr;use Illuminate\Testing\TestResponse;@@ -20,7 +20,7 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermissprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'manufacturer';}@@ -36,7 +36,7 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermiss}#[Test]- public function importManufacturer(): void+ public function import_manufacturer(): void{$importFileBuilder = ImportFileBuilder::new();$row = $importFileBuilder->firstRow();@@ -46,9 +46,9 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermiss$this->importFileResponse(['import' => $import->id, 'send-welcome' => 0])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('manufacturers.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('manufacturers.index')],]);$newManufacturer = Manufacturer::query()@@ -60,7 +60,7 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermiss}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -74,9 +74,8 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermiss$this->importFileResponse(['import' => $import->id])->assertOk();}-#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new(['name' => '']);$import = Import::factory()->manufacturers()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -86,17 +85,16 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermiss$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => ['' => ['Manufacturer ""' => [- 'name' =>- ['The name field is required.'],+ 'name' => ['The name field is required.'],],- ]+ ],- ]+ ],]);$newManufacturer = Manufacturer::query()@@ -106,9 +104,8 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermiss$this->assertCount(0, $newManufacturer);}-#[Test]- public function updateManufacturerFromImport(): void+ public function update_manufacturer_from_import(): void{$manufacturer = Manufacturer::factory()->create()->refresh();$importFileBuilder = ImportFileBuilder::new(['name' => $manufacturer->name, 'support_url' => $manufacturer->support_url, 'support_phone' => $manufacturer->support_phone, 'support_email' => $manufacturer->support_email]);@@ -134,5 +131,4 @@ class ImportManufacturersTest extends ImportDataTestCase implements TestsPermissArr::except($updatedManufacturer->attributesToArray(), array_merge($updatedAttributes, $manufacturer->getDates())),);}-}diff --git a/tests/Feature/Importing/Api/ImportSuppliersTest.php b/tests/Feature/Importing/Api/ImportSuppliersTest.phpindex 9ea9a19f64..1257e1abb0 100644--- a/tests/Feature/Importing/Api/ImportSuppliersTest.php+++ b/tests/Feature/Importing/Api/ImportSuppliersTest.php@@ -2,12 +2,11 @@namespace Tests\Feature\Importing\Api;+use App\Models\Import;use App\Models\Supplier;use App\Models\User;-use App\Models\Import;use Illuminate\Foundation\Testing\WithFaker;use Illuminate\Support\Arr;-use Illuminate\Support\Str;use Illuminate\Testing\TestResponse;use PHPUnit\Framework\Attributes\Test;use Tests\Concerns\TestsPermissionsRequirement;@@ -21,7 +20,7 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissionsprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'supplier';}@@ -37,7 +36,7 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissions}#[Test]- public function importSupplier(): void+ public function import_supplier(): void{$importFileBuilder = ImportFileBuilder::new();$row = $importFileBuilder->firstRow();@@ -47,9 +46,9 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissions$this->importFileResponse(['import' => $import->id, 'send-welcome' => 0])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('suppliers.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('suppliers.index')],]);$newSupplier = Supplier::query()@@ -61,7 +60,7 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissions}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -75,9 +74,8 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissions$this->importFileResponse(['import' => $import->id])->assertOk();}-#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new(['name' => '']);$import = Import::factory()->suppliers()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -87,17 +85,16 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissions$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => ['' => ['Supplier ""' => [- 'name' =>- ['The name field is required.'],+ 'name' => ['The name field is required.'],],- ]+ ],- ]+ ],]);$newSupplier = Supplier::query()@@ -107,9 +104,8 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissions$this->assertCount(0, $newSupplier);}-#[Test]- public function updateSupplierFromImport(): void+ public function update_supplier_from_import(): void{$supplier = Supplier::factory()->create()->refresh();$importFileBuilder = ImportFileBuilder::new(['name' => $supplier->name, 'url' => $supplier->url, 'phone' => $supplier->phone, 'fax' => $supplier->fax, 'contact' => $supplier->contact, 'email' => $supplier->email]);@@ -137,5 +133,4 @@ class ImportSuppliersTest extends ImportDataTestCase implements TestsPermissionsArr::except($updatedSupplier->attributesToArray(), array_merge($updatedAttributes, $supplier->getDates())),);}-}diff --git a/tests/Feature/Importing/Api/ImportUsersTest.php b/tests/Feature/Importing/Api/ImportUsersTest.phpindex 6066d672c4..c7caa307ef 100644--- a/tests/Feature/Importing/Api/ImportUsersTest.php+++ b/tests/Feature/Importing/Api/ImportUsersTest.php@@ -24,7 +24,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequprotected function importFileResponse(array $parameters = []): TestResponse{- if (!array_key_exists('import-type', $parameters)) {+ if (! array_key_exists('import-type', $parameters)) {$parameters['import-type'] = 'user';}@@ -40,7 +40,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function userWithImportAssetsPermissionCanImportUsers(): void+ public function user_with_import_assets_permission_can_import_users(): void{$this->actingAsForApi(User::factory()->canImport()->create());@@ -50,7 +50,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function importUsers(): void+ public function import_users(): void{Notification::fake();@@ -62,9 +62,9 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ$this->importFileResponse(['import' => $import->id, 'send-welcome' => 1])->assertOk()->assertExactJson([- 'payload' => null,- 'status' => 'success',- 'messages' => ['redirect_url' => route('users.index')]+ 'payload' => null,+ 'status' => 'success',+ 'messages' => ['redirect_url' => route('users.index')],]);$newUser = User::query()@@ -118,7 +118,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function willIgnoreUnknownColumnsWhenFileContainsUnknownColumns(): void+ public function will_ignore_unknown_columns_when_file_contains_unknown_columns(): void{$row = ImportFileBuilder::new()->definition();$row['unknownColumnInCsvFile'] = 'foo';@@ -133,7 +133,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function willNotCreateNewUserWhenUserWithUserNameAlreadyExist(): void+ public function will_not_create_new_user_when_user_with_user_name_already_exist(): void{$user = User::factory()->create(['username' => Str::random()]);$importFileBuilder = ImportFileBuilder::times(4)->replace(['username' => $user->username]);@@ -150,7 +150,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function willGenerateUsernameWhenUsernameFieldIsMissing(): void+ public function will_generate_username_when_username_field_is_missing(): void{$importFileBuilder = ImportFileBuilder::new()->forget('username');$row = $importFileBuilder->firstRow();@@ -169,7 +169,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function willUpdateLocationOfAllAssetsAssignedToUser(): void+ public function will_update_location_of_all_assets_assigned_to_user(): void{$user = User::factory()->create(['username' => Str::random()]);$assetsAssignedToUser = Asset::factory()->create(['assigned_to' => $user->id, 'assigned_type' => User::class]);@@ -188,7 +188,7 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function whenRequiredColumnsAreMissingInImportFile(): void+ public function when_required_columns_are_missing_in_import_file(): void{$importFileBuilder = ImportFileBuilder::new(['firstName' => ''])->forget(['username']);$import = Import::factory()->users()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -198,15 +198,15 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ$this->importFileResponse(['import' => $import->id])->assertInternalServerError()->assertExactJson([- 'status' => 'import-errors',- 'payload' => null,+ 'status' => 'import-errors',+ 'payload' => null,'messages' => ['' => ['User' => ['first_name' => ['The first name field is required.'],- ]- ]- ]+ ],+ ],+ ],]);$newUsers = User::query()@@ -217,10 +217,10 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ}#[Test]- public function updateUserFromImport(): void+ public function update_user_from_import(): void{$user = User::factory()->create(['username' => Str::random()])->refresh();- $importFileBuilder = ImportFileBuilder::new(['username' => $user->username]);+ $importFileBuilder = ImportFileBuilder::new(['username' => $user->username]);$row = $importFileBuilder->firstRow();$import = Import::factory()->users()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);@@ -260,26 +260,24 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ);}-/*** Some of these should mismatch on purpose to ensure the mapping is working- * @return void*/#[Test]- public function customColumnMapping(): void+ public function custom_column_mapping(): void{$faker = ImportFileBuilder::new()->definition();$row = [- 'companyName' => $faker['username'],- 'email' => $faker['position'],+ 'companyName' => $faker['username'],+ 'email' => $faker['position'],'employeeNumber' => $faker['phoneNumber'],- 'firstName' => $faker['location'],- 'lastName' => $faker['lastName'],- 'location' => $faker['firstName'],- 'phoneNumber' => $faker['employeeNumber'],- 'position' => $faker['email'],- 'username' => $faker['companyName'],- 'dumbName' => $faker['displayName'],+ 'firstName' => $faker['location'],+ 'lastName' => $faker['lastName'],+ 'location' => $faker['firstName'],+ 'phoneNumber' => $faker['employeeNumber'],+ 'position' => $faker['email'],+ 'username' => $faker['companyName'],+ 'dumbName' => $faker['displayName'],];$importFileBuilder = new ImportFileBuilder([$row]);@@ -290,21 +288,20 @@ class ImportUsersTest extends ImportDataTestCase implements TestsPermissionsRequ$this->importFileResponse(['import' => $import->id,'column-mappings' => [- 'Company' => 'username',- 'email' => 'jobtitle',+ 'Company' => 'username',+ 'email' => 'jobtitle','Employee Number' => 'phone_number',- 'First Name' => 'location',- 'Last Name' => 'last_name',- 'Location' => 'first_name',- 'Phone Number' => 'employee_num',- 'Job Title' => 'email',- 'Username' => 'company',- 'dumbName' => 'display_name',- ]+ 'First Name' => 'location',+ 'Last Name' => 'last_name',+ 'Location' => 'first_name',+ 'Phone Number' => 'employee_num',+ 'Job Title' => 'email',+ 'Username' => 'company',+ 'dumbName' => 'display_name',+ ],])->assertOk()->json();-$newUser = User::query()->with(['company', 'location'])->where('username', $row['companyName'])diff --git a/tests/Feature/Importing/Ui/ImportTest.php b/tests/Feature/Importing/Ui/ImportTest.phpindex b549dc415d..4446a01a6f 100644--- a/tests/Feature/Importing/Ui/ImportTest.php+++ b/tests/Feature/Importing/Ui/ImportTest.php@@ -9,50 +9,51 @@ use Tests\TestCase;class ImportTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('imports.index'))->assertOk();}- public function testStoreInternationalAsset(): void+ public function test_store_international_asset(): void{- $evil_string = 'це'; //cyrillic - windows-1251 (ONE)+ $evil_string = 'це'; // cyrillic - windows-1251 (ONE)$csv_contents = "a,b,c\n$evil_string,$evil_string,$evil_string\n";// now, deliberately transform our UTF-8 into Windows-1251 so we can test out the character-set detection$transliterated_contents = iconv('UTF-8', 'WINDOWS-1251', $csv_contents);- //\Log::error("RAW TRANSLITERATED CONTENTS: $transliterated_contents"); // should show 'unicode missing glyph' symbol in logs.+ // \Log::error("RAW TRANSLITERATED CONTENTS: $transliterated_contents"); // should show 'unicode missing glyph' symbol in logs.$this->actingAsForApi(User::factory()->superuser()->create());- $results = $this->post(route('api.imports.store'), ['files' => [UploadedFile::fake()->createWithContent("myname.csv", $transliterated_contents)]])+ $results = $this->post(route('api.imports.store'), ['files' => [UploadedFile::fake()->createWithContent('myname.csv', $transliterated_contents)]])->assertOk()->assertJsonStructure([- "files" => [+ 'files' => [[- "created_at",- "field_map",- "file_path",- "filesize",- "first_row",- "header_row",- "id",- "import_type",- "name",- ]- ]+ 'created_at',+ 'field_map',+ 'file_path',+ 'filesize',+ 'first_row',+ 'header_row',+ 'id',+ 'import_type',+ 'name',+ ],+ ],]);$this->assertEquals($evil_string, $results->json()['files'][0]['first_row'][0]);}- public function testStoreInternationalAssetMisparse(): void+ public function test_store_international_asset_misparse(): void{$evil_maker = function ($arr) {$results = '';foreach ($arr as $thing) {$results .= chr($thing);}+return $results;};@@ -60,9 +61,9 @@ class ImportTest extends TestCase$evil_content = $evil_maker([0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x98]);$this->actingAsForApi(User::factory()->superuser()->create());- $results = $this->post(route('api.imports.store'), ['files' => [UploadedFile::fake()->createWithContent("myname.csv", $evil_content)]])+ $results = $this->post(route('api.imports.store'), ['files' => [UploadedFile::fake()->createWithContent('myname.csv', $evil_content)]])->assertStatus(422)->assertStatusMessageIs('error')- ->assertMessagesAre(trans('admin/hardware/message.import.transliterate_failure', ["encoding" => "windows-1251"]));+ ->assertMessagesAre(trans('admin/hardware/message.import.transliterate_failure', ['encoding' => 'windows-1251']));}}diff --git a/tests/Feature/LicenseSeats/Api/LicenseSeatUpdateTest.php b/tests/Feature/LicenseSeats/Api/LicenseSeatUpdateTest.phpindex a8839151b5..8cac165cc1 100644--- a/tests/Feature/LicenseSeats/Api/LicenseSeatUpdateTest.php+++ b/tests/Feature/LicenseSeats/Api/LicenseSeatUpdateTest.php@@ -240,7 +240,7 @@ class LicenseSeatUpdateTest extends TestCase$this->assertEquals($targetUser->id, $licenseSeat->assigned_to);$this->assertEquals('Checking out the seat to a user', $licenseSeat->notes);- $this->assertHasTheseActionLogs($licenseSeat->license, ['add seats', 'create', 'checkout']); //FIXME - backwards+ $this->assertHasTheseActionLogs($licenseSeat->license, ['add seats', 'create', 'checkout']); // FIXME - backwards}public function test_license_seat_can_be_checked_out_to_asset_when_updating()@@ -259,7 +259,7 @@ class LicenseSeatUpdateTest extends TestCase$licenseSeat->refresh();$this->assertEquals($targetAsset->id, $licenseSeat->asset_id);$this->assertEquals('Checking out the seat to an asset', $licenseSeat->notes);- $this->assertHasTheseActionLogs($licenseSeat->license, ['add seats', 'create', 'checkout']); //FIXME - backwards+ $this->assertHasTheseActionLogs($licenseSeat->license, ['add seats', 'create', 'checkout']); // FIXME - backwards}public function test_license_seat_checked_out_to_asset_can_be_checked_in_when_updating()diff --git a/tests/Feature/Licenses/Api/DeleteLicensesTest.php b/tests/Feature/Licenses/Api/DeleteLicensesTest.phpindex 08380209bd..6b352c524b 100644--- a/tests/Feature/Licenses/Api/DeleteLicensesTest.php+++ b/tests/Feature/Licenses/Api/DeleteLicensesTest.php@@ -53,7 +53,7 @@ class DeleteLicensesTest extends TestCase implements TestsFullMultipleCompaniesS$this->assertSoftDeleted($licenseC);}- public function testLicenseCannotBeDeletedIfStillAssigned()+ public function test_license_cannot_be_deleted_if_still_assigned(){$license = License::factory()->create(['seats' => 2]);$license->freeSeat()->update(['assigned_to' => User::factory()->create()->id]);@@ -65,7 +65,7 @@ class DeleteLicensesTest extends TestCase implements TestsFullMultipleCompaniesS$this->assertNotSoftDeleted($license);}- public function testCanDeleteLicense()+ public function test_can_delete_license(){$license = License::factory()->create();@@ -76,7 +76,7 @@ class DeleteLicensesTest extends TestCase implements TestsFullMultipleCompaniesS$this->assertSoftDeleted($license);}- public function testLicenseSeatsAreDeletedWhenLicenseIsDeleted()+ public function test_license_seats_are_deleted_when_license_is_deleted(){$license = License::factory()->create(['seats' => 2]);diff --git a/tests/Feature/Licenses/Api/LicenseIndexTest.php b/tests/Feature/Licenses/Api/LicenseIndexTest.phpindex 1df7864278..63140e106e 100644--- a/tests/Feature/Licenses/Api/LicenseIndexTest.php+++ b/tests/Feature/Licenses/Api/LicenseIndexTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class LicenseIndexTest extends TestCase{- public function testLicensesIndexAdheresToCompanyScoping()+ public function test_licenses_index_adheres_to_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Feature/Licenses/Api/LicenseUploadTest.php b/tests/Feature/Licenses/Api/LicenseUploadTest.phpindex 50dac35da4..ed2e03ca2d 100644--- a/tests/Feature/Licenses/Api/LicenseUploadTest.php+++ b/tests/Feature/Licenses/Api/LicenseUploadTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class LicenseUploadTest extends TestCase{- public function testLicenseApiAcceptsFileUpload()+ public function test_license_api_accepts_file_upload(){// Upload a file to a model@@ -19,17 +19,17 @@ class LicenseUploadTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'licenses', 'id' => $license->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testLicenseApiListsFiles()+ public function test_license_api_lists_files(){// List all files on a model@@ -47,13 +47,13 @@ class LicenseUploadTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testLicenseFailsIfInvalidTypePassedInUrl()+ public function test_license_fails_if_invalid_type_passed_in_url(){// List all files on a model@@ -71,7 +71,7 @@ class LicenseUploadTest extends TestCase->assertStatus(404);}- public function testLicenseFailsIfInvalidIdPassedInUrl()+ public function test_license_fails_if_invalid_id_passed_in_url(){// List all files on a model@@ -90,7 +90,7 @@ class LicenseUploadTest extends TestCase->assertStatusMessageIs('error');}- public function testLicenseApiDownloadsFile()+ public function test_license_api_downloads_file(){// Download a file from a model@@ -104,14 +104,14 @@ class LicenseUploadTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'licenses', 'id' => $license->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -119,15 +119,15 @@ class LicenseUploadTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'licenses', 'id' => $license->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],- 'notes' => 'manual'+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],+ 'notes' => 'manual',])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -139,19 +139,19 @@ class LicenseUploadTest extends TestCase->assertOk()->assertJsonStructure([- 'total',- 'rows'=>[- '*' => [- 'id',- 'filename',- 'url',- 'created_by',- 'created_at',- 'deleted_at',- 'note',- 'available_actions'- ]- ]+ 'total',+ 'rows' => [+ '*' => [+ 'id',+ 'filename',+ 'url',+ 'created_by',+ 'created_at',+ 'deleted_at',+ 'note',+ 'available_actions',+ ],+ ],])->assertJsonPath('rows.0.note', null)@@ -162,16 +162,16 @@ class LicenseUploadTest extends TestCase->get(route('api.files.show', [- 'object_type' => 'licenses',- 'id' => $license->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'licenses',+ 'id' => $license->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk();}- public function testLicenseApiDeletesFile()+ public function test_license_api_deletes_file(){// Delete a file from a model@@ -181,11 +181,11 @@ class LicenseUploadTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'licenses', 'id' => $license->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -202,18 +202,18 @@ class LicenseUploadTest extends TestCase->delete(route('api.files.destroy', [- 'object_type' => 'licenses',- 'id' => $license->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'licenses',+ 'id' => $license->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);}-}\ No newline at end of file+}diff --git a/tests/Feature/Licenses/Ui/CreateLicenseTest.php b/tests/Feature/Licenses/Ui/CreateLicenseTest.phpindex b08c029035..d6baf82dd7 100644--- a/tests/Feature/Licenses/Ui/CreateLicenseTest.php+++ b/tests/Feature/Licenses/Ui/CreateLicenseTest.php@@ -3,14 +3,14 @@namespace Tests\Feature\Licenses\Ui;use App\Models\Category;-use App\Models\License;use App\Models\Depreciation;+use App\Models\License;use App\Models\User;use Tests\TestCase;class CreateLicenseTest extends TestCase{- public function testPermissionRequiredToCreateLicense()+ public function test_permission_required_to_create_license(){$license = License::factory()->create();$this->actingAs(User::factory()->create())@@ -18,14 +18,14 @@ class CreateLicenseTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('licenses.create'))->assertOk();}- public function testLicenseWithoutPurchaseDateFailsValidation()+ public function test_license_without_purchase_date_fails_validation(){$response = $this->actingAs(User::factory()->superuser()->create())->from(route('licenses.create'))@@ -33,7 +33,7 @@ class CreateLicenseTest extends TestCase'name' => 'Test Invalid License','seats' => '10','category_id' => Category::factory()->forLicenses()->create()->id,- 'depreciation_id' => Depreciation::factory()->create()->id+ 'depreciation_id' => Depreciation::factory()->create()->id,]);$response->assertStatus(302);$response->assertRedirect(route('licenses.create'));@@ -44,7 +44,7 @@ class CreateLicenseTest extends TestCase}- public function testLicenseCreate()+ public function test_license_create(){$response = $this->actingAs(User::factory()->superuser()->create())->from(route('licenses.create'))@@ -56,15 +56,15 @@ class CreateLicenseTest extends TestCase$response->assertStatus(302);$license = License::where('name', 'Test Valid License')->sole();$this->assertNotNull($license);- //$license->assetlog()->has_one_of_();+ // $license->assetlog()->has_one_of_();$this->assertDatabaseHas('action_logs', ['action_type' => 'create', 'item_id' => $license->id, 'item_type' => License::class]);$this->assertDatabaseHas('action_logs', ['action_type' => 'add seats', 'item_id' => $license->id, 'item_type' => License::class]);$this->assertEquals($license->licenseseats()->count(), 10);- //test log entries? Sure.+ // test log entries? Sure.}- public function testTooManySeatsLicenseCreate()+ public function test_too_many_seats_license_create(){$response = $this->actingAs(User::factory()->superuser()->create())->from(route('licenses.create'))@@ -76,12 +76,10 @@ class CreateLicenseTest extends TestCase$response->assertStatus(302);$license = License::where('name', 'Test Valid License')->first();$this->assertNull($license);- //$license->assetlog()->has_one_of_();-// $this->assertDatabaseMissing('action_logs', ['action_type' => 'create', 'item_id' => $license->id, 'item_type' => License::class]);-// $this->assertDatabaseMissing('action_logs', ['action_type' => 'add seats', 'item_id' => $license->id, 'item_type' => License::class]);- //test log entries? Sure.+ // $license->assetlog()->has_one_of_();+ // $this->assertDatabaseMissing('action_logs', ['action_type' => 'create', 'item_id' => $license->id, 'item_type' => License::class]);+ // $this->assertDatabaseMissing('action_logs', ['action_type' => 'add seats', 'item_id' => $license->id, 'item_type' => License::class]);+ // test log entries? Sure.}--}diff --git a/tests/Feature/Licenses/Ui/LicenseIndexTest.php b/tests/Feature/Licenses/Ui/LicenseIndexTest.phpindex 3eb33e5ee4..3763179d13 100644--- a/tests/Feature/Licenses/Ui/LicenseIndexTest.php+++ b/tests/Feature/Licenses/Ui/LicenseIndexTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class LicenseIndexTest extends TestCase{- public function testPermissionRequiredToViewLicenseList()+ public function test_permission_required_to_view_license_list(){$this->actingAs(User::factory()->create())->get(route('licenses.index'))->assertForbidden();}- public function testUserCanListLicenses()+ public function test_user_can_list_licenses(){$this->actingAs(User::factory()->superuser()->create())->get(route('licenses.index'))diff --git a/tests/Feature/Licenses/Ui/LicenseViewTest.php b/tests/Feature/Licenses/Ui/LicenseViewTest.phpindex 8bf5bf77fa..199afde4d1 100644--- a/tests/Feature/Licenses/Ui/LicenseViewTest.php+++ b/tests/Feature/Licenses/Ui/LicenseViewTest.php@@ -2,14 +2,14 @@namespace Tests\Feature\Licenses\Ui;-use App\Models\License;use App\Models\Depreciation;+use App\Models\License;use App\Models\User;use Tests\TestCase;class LicenseViewTest extends TestCase{- public function testPermissionRequiredToViewLicense()+ public function test_permission_required_to_view_license(){$license = License::factory()->create();$this->actingAs(User::factory()->create())@@ -17,14 +17,14 @@ class LicenseViewTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('licenses.show', License::factory()->create()->id))->assertOk();}-- public function testLicenseWithPurchaseDateDepreciatesCorrectly()++ public function test_license_with_purchase_date_depreciates_correctly(){$depreciation = Depreciation::factory()->create(['months' => 12]);$license = License::factory()->create(['depreciation_id' => $depreciation->id, 'purchase_date' => '2020-01-01']);@@ -32,7 +32,7 @@ class LicenseViewTest extends TestCase->get(route('licenses.show', $license))->assertOk()->assertSee([- '2021-01-01'+ '2021-01-01',], false);}}diff --git a/tests/Feature/Licenses/Ui/StoreLicenseWithFullMultipleCompanySupportTest.php b/tests/Feature/Licenses/Ui/StoreLicenseWithFullMultipleCompanySupportTest.phpindex de6ffbaaee..8a1477e9f6 100644--- a/tests/Feature/Licenses/Ui/StoreLicenseWithFullMultipleCompanySupportTest.php+++ b/tests/Feature/Licenses/Ui/StoreLicenseWithFullMultipleCompanySupportTest.php@@ -13,7 +13,7 @@ class StoreLicenseWithFullMultipleCompanySupportTest extends TestCaseuse ProvidesDataForFullMultipleCompanySupportTesting;#[DataProvider('dataForFullMultipleCompanySupportTesting')]- public function testAdheresToFullMultipleCompaniesSupportScoping($data)+ public function test_adheres_to_full_multiple_companies_support_scoping($data){['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();diff --git a/tests/Feature/Licenses/Ui/UpdateLicenseTest.php b/tests/Feature/Licenses/Ui/UpdateLicenseTest.phpindex 46c4f70785..f45cf790f0 100644--- a/tests/Feature/Licenses/Ui/UpdateLicenseTest.php+++ b/tests/Feature/Licenses/Ui/UpdateLicenseTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class UpdateLicenseTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('licenses.edit', License::factory()->create()->id))->assertOk();}- public function testCanUpdateLicenseSeats()+ public function test_can_update_license_seats(){$admin = User::factory()->superuser()->create();$license_category = Category::factory()->forLicenses()->create()->id;@@ -44,7 +44,7 @@ class UpdateLicenseTest extends TestCase$this->assertEquals($license->licenseseats()->count(), 19999);}- public function testCannotUpdateLicenseSeatsTooMuch()+ public function test_cannot_update_license_seats_too_much(){$admin = User::factory()->superuser()->create();$license_category = Category::factory()->forLicenses()->create()->id;@@ -72,7 +72,7 @@ class UpdateLicenseTest extends TestCase$this->assertEquals($license->licenseseats()->count(), 9999);}- public function testCanRemoveLicenseSeats()+ public function test_can_remove_license_seats(){$admin = User::factory()->superuser()->create();$license_category = Category::factory()->forLicenses()->create()->id;@@ -99,6 +99,4 @@ class UpdateLicenseTest extends TestCase$this->assertEquals($license->licenseseats()->count(), $license->seats);$this->assertEquals($license->licenseseats()->count(), 5000);}--}diff --git a/tests/Feature/Livewire/CategoryEditFormTest.php b/tests/Feature/Livewire/CategoryEditFormTest.phpindex 1bc0448917..ea44600da9 100644--- a/tests/Feature/Livewire/CategoryEditFormTest.php+++ b/tests/Feature/Livewire/CategoryEditFormTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class CategoryEditFormTest extends TestCase{- public function testTheComponentCanRender()+ public function test_the_component_can_render(){Livewire::test(CategoryEditForm::class, ['sendCheckInEmail' => true,@@ -16,7 +16,7 @@ class CategoryEditFormTest extends TestCase])->assertStatus(200);}- public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula()+ public function test_eula_field_enabled_on_load_when_not_using_default_eula(){Livewire::test(CategoryEditForm::class, ['sendCheckInEmail' => false,diff --git a/tests/Feature/Livewire/ImporterTest.php b/tests/Feature/Livewire/ImporterTest.phpindex b8af8f9bc0..d7dd82c0c2 100644--- a/tests/Feature/Livewire/ImporterTest.php+++ b/tests/Feature/Livewire/ImporterTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class ImporterTest extends TestCase{- public function testRendersSuccessfully()+ public function test_renders_successfully(){Livewire::actingAs(User::factory()->canImport()->create())->test(Importer::class)->assertStatus(200);}- public function testRequiresPermission()+ public function test_requires_permission(){Livewire::actingAs(User::factory()->create())->test(Importer::class)diff --git a/tests/Feature/Locations/Api/CreateLocationsTest.php b/tests/Feature/Locations/Api/CreateLocationsTest.phpindex fc2686ae72..bafc75c64a 100644--- a/tests/Feature/Locations/Api/CreateLocationsTest.php+++ b/tests/Feature/Locations/Api/CreateLocationsTest.php@@ -8,16 +8,14 @@ use Tests\TestCase;class CreateLocationsTest extends TestCase{-- public function testRequiresPermissionToCreateLocation()+ public function test_requires_permission_to_create_location(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.locations.store'))->assertForbidden();}-- public function testCanCreateLocation()+ public function test_can_create_location(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.locations.store'), [@@ -36,7 +34,7 @@ class CreateLocationsTest extends TestCase$this->assertEquals('Test Note', $location->notes);}- public function testCannotCreateNewLocationsWithTheSameName()+ public function test_cannot_create_new_locations_with_the_same_name(){$location = Location::factory()->create();$location2 = Location::factory()->create();@@ -50,10 +48,9 @@ class CreateLocationsTest extends TestCase->assertStatus(200)->json();-}- public function testUserCannotCreateLocationsThatAreTheirOwnParent()+ public function test_user_cannot_create_locations_that_are_their_own_parent(){$location = Location::factory()->create();@@ -65,12 +62,10 @@ class CreateLocationsTest extends TestCase->assertStatusMessageIs('error')->assertJson(['messages' => [- 'parent_id' => ['The parent id must not create a circular reference.'],+ 'parent_id' => ['The parent id must not create a circular reference.'],],])->json();-}-}diff --git a/tests/Feature/Locations/Api/DeleteLocationsTest.php b/tests/Feature/Locations/Api/DeleteLocationsTest.phpindex 5dab3c5d6b..2afbd62d65 100644--- a/tests/Feature/Locations/Api/DeleteLocationsTest.php+++ b/tests/Feature/Locations/Api/DeleteLocationsTest.php@@ -24,7 +24,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testErrorReturnedViaApiIfLocationDoesNotExist()+ public function test_error_returned_via_api_if_location_does_not_exist(){$this->actingAsForApi(User::factory()->superuser()->create())->deleteJson(route('api.locations.destroy', 'invalid-id'))@@ -35,7 +35,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen}- public function testErrorReturnedViaApiIfLocationIsAlreadyDeleted()+ public function test_error_returned_via_api_if_location_is_already_deleted(){$location = Location::factory()->deletedLocation()->create();$this->actingAsForApi(User::factory()->superuser()->create())@@ -46,7 +46,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen->json();}- public function testDisallowLocationDeletionViaApiIfStillHasPeople()+ public function test_disallow_location_deletion_via_api_if_still_has_people(){$location = Location::factory()->create();User::factory()->count(5)->create(['location_id' => $location->id]);@@ -62,7 +62,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testDisallowLocationDeletionViaApiIfStillHasChildLocations()+ public function test_disallow_location_deletion_via_api_if_still_has_child_locations(){$parent = Location::factory()->create();Location::factory()->count(5)->create(['parent_id' => $parent->id]);@@ -77,7 +77,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($parent);}- public function testDisallowLocationDeletionViaApiIfStillHasAssetsAssigned()+ public function test_disallow_location_deletion_via_api_if_still_has_assets_assigned(){$location = Location::factory()->create();Asset::factory()->count(5)->assignedToLocation($location)->create();@@ -93,7 +93,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testDisallowLocationDeletionViaApiIfStillHasAssetsAsLocation()+ public function test_disallow_location_deletion_via_api_if_still_has_assets_as_location(){$location = Location::factory()->create();Asset::factory()->count(5)->create(['location_id' => $location->id]);@@ -109,7 +109,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testDisallowLocationDeletionViaApiIfStillHasConsumablesAsLocation()+ public function test_disallow_location_deletion_via_api_if_still_has_consumables_as_location(){$location = Location::factory()->create();Consumable::factory()->count(5)->create(['location_id' => $location->id]);@@ -125,7 +125,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testDisallowLocationDeletionViaApiIfStillHasComponentsAsLocation()+ public function test_disallow_location_deletion_via_api_if_still_has_components_as_location(){$location = Location::factory()->create();Component::factory()->count(5)->create(['location_id' => $location->id]);@@ -142,7 +142,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testDisallowLocationDeletionViaApiIfStillHasAccessoriesAssigned()+ public function test_disallow_location_deletion_via_api_if_still_has_accessories_assigned(){$location = Location::factory()->create();Accessory::factory()->count(5)->checkedOutToLocation($location)->create();@@ -158,7 +158,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testDisallowLocationDeletionViaApiIfStillHasAccessoriesAsLocation()+ public function test_disallow_location_deletion_via_api_if_still_has_accessories_as_location(){$location = Location::factory()->create();Accessory::factory()->count(5)->create(['location_id' => $location->id]);@@ -175,7 +175,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($location);}- public function testCanDeleteLocation()+ public function test_can_delete_location(){$location = Location::factory()->create();diff --git a/tests/Feature/Locations/Api/IndexLocationsTest.php b/tests/Feature/Locations/Api/IndexLocationsTest.phpindex 7b3b104638..03e2f9a69b 100644--- a/tests/Feature/Locations/Api/IndexLocationsTest.php+++ b/tests/Feature/Locations/Api/IndexLocationsTest.php@@ -2,7 +2,6 @@namespace Tests\Feature\Locations\Api;-use App\Models\Company;use App\Models\Location;use App\Models\User;use Illuminate\Testing\Fluent\AssertableJson;@@ -10,19 +9,19 @@ use Tests\TestCase;class IndexLocationsTest extends TestCase{- public function testViewingLocationIndexRequiresAuthentication()+ public function test_viewing_location_index_requires_authentication(){$this->getJson(route('api.locations.index'))->assertRedirect();}- public function testViewingLocationIndexRequiresPermission()+ public function test_viewing_location_index_requires_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.locations.index'))->assertForbidden();}- public function testLocationIndexReturnsExpectedLocations()+ public function test_location_index_returns_expected_locations(){Location::factory()->count(3)->create();@@ -39,7 +38,6 @@ class IndexLocationsTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());}-}diff --git a/tests/Feature/Locations/Api/LocationFileTest.php b/tests/Feature/Locations/Api/LocationFileTest.phpindex 50c18050f3..7758e2db03 100644--- a/tests/Feature/Locations/Api/LocationFileTest.php+++ b/tests/Feature/Locations/Api/LocationFileTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class LocationFileTest extends TestCase{- public function testLocationApiAcceptsFileUpload()+ public function test_location_api_accepts_file_upload(){// Create a model to work with$location = Location::factory()->create();@@ -17,17 +17,17 @@ class LocationFileTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'locations', 'id' => $location->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testLocationApiListsFiles()+ public function test_location_api_lists_files(){// List all files on a model@@ -45,13 +45,13 @@ class LocationFileTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testLocationFailsIfInvalidTypePassedInUrl()+ public function test_location_fails_if_invalid_type_passed_in_url(){// List all files on a model@@ -69,7 +69,7 @@ class LocationFileTest extends TestCase->assertStatus(404);}- public function testLocationFailsIfInvalidIdPassedInUrl()+ public function test_location_fails_if_invalid_id_passed_in_url(){// List all files on a model@@ -88,7 +88,7 @@ class LocationFileTest extends TestCase->assertStatusMessageIs('error');}- public function testLocationApiDownloadsFile()+ public function test_location_api_downloads_file(){// Download a file from a model@@ -102,14 +102,14 @@ class LocationFileTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'locations', 'id' => $location->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -117,15 +117,15 @@ class LocationFileTest extends TestCase$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'locations', 'id' => $location->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],- 'notes' => 'manual'+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],+ 'notes' => 'manual',])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -137,19 +137,19 @@ class LocationFileTest extends TestCase->assertOk()->assertJsonStructure([- 'total',- 'rows'=>[- '*' => [- 'id',- 'filename',- 'url',- 'created_by',- 'created_at',- 'deleted_at',- 'note',- 'available_actions'- ]- ]+ 'total',+ 'rows' => [+ '*' => [+ 'id',+ 'filename',+ 'url',+ 'created_by',+ 'created_at',+ 'deleted_at',+ 'note',+ 'available_actions',+ ],+ ],])->assertJsonPath('rows.0.note', null)@@ -160,16 +160,16 @@ class LocationFileTest extends TestCase->get(route('api.files.show', [- 'object_type' => 'locations',- 'id' => $location->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'locations',+ 'id' => $location->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk();}- public function testLocationApiDeletesFile()+ public function test_location_api_deletes_file(){// Delete a file from a model@@ -179,11 +179,11 @@ class LocationFileTest extends TestCase// Create a superuser to run this as$user = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($user)->post(route('api.files.store', ['object_type' => 'locations', 'id' => $location->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -200,18 +200,18 @@ class LocationFileTest extends TestCase->delete(route('api.files.destroy', [- 'object_type' => 'locations',- 'id' => $location->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'locations',+ 'id' => $location->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);}-}\ No newline at end of file+}diff --git a/tests/Feature/Locations/Api/LocationsForSelectListTest.php b/tests/Feature/Locations/Api/LocationsForSelectListTest.phpindex f34b97892f..33e7962c5f 100644--- a/tests/Feature/Locations/Api/LocationsForSelectListTest.php+++ b/tests/Feature/Locations/Api/LocationsForSelectListTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class LocationsForSelectListTest extends TestCase{- public function testGettingLocationListRequiresProperPermission()+ public function test_getting_location_list_requires_proper_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.locations.selectlist'))->assertForbidden();}- public function testLocationsReturned()+ public function test_locations_returned(){Location::factory()->create();@@ -32,10 +32,10 @@ class LocationsForSelectListTest extends TestCase'page','page_count',])- ->assertJson(fn(AssertableJson $json) => $json->has('results', 1)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('results', 1)->etc());}- public function testLocationsAreReturnedWhenUserIsUpdatingTheirProfileAndHasPermissionToUpdateLocation()+ public function test_locations_are_returned_when_user_is_updating_their_profile_and_has_permission_to_update_location(){$this->actingAsForApi(User::factory()->canEditOwnLocation()->create())->withHeader('referer', route('profile'))diff --git a/tests/Feature/Locations/Api/LocationsViewTest.php b/tests/Feature/Locations/Api/LocationsViewTest.phpindex cec020d1ca..3768d16d56 100644--- a/tests/Feature/Locations/Api/LocationsViewTest.php+++ b/tests/Feature/Locations/Api/LocationsViewTest.php@@ -2,14 +2,14 @@namespace Tests\Feature\Locations\Api;-use App\Models\Location;use App\Models\Asset;+use App\Models\Location;use App\Models\User;use Tests\TestCase;class LocationsViewTest extends TestCase{- public function testViewingLocationRequiresPermission()+ public function test_viewing_location_requires_permission(){$location = Location::factory()->create();$this->actingAsForApi(User::factory()->create())@@ -17,7 +17,7 @@ class LocationsViewTest extends TestCase->assertForbidden();}- public function testViewingLocationAssetIndexRequiresPermission()+ public function test_viewing_location_asset_index_requires_permission(){$location = Location::factory()->create();$this->actingAsForApi(User::factory()->create())@@ -25,7 +25,7 @@ class LocationsViewTest extends TestCase->assertForbidden();}- public function testViewingLocationAssetIndex()+ public function test_viewing_location_asset_index(){$location = Location::factory()->create();Asset::factory()->count(3)->create(['location_id' => $location->id]);@@ -42,7 +42,7 @@ class LocationsViewTest extends TestCase]);}- public function testViewingAssignedLocationAssetIndex()+ public function test_viewing_assigned_location_asset_index(){$location = Location::factory()->create();Asset::factory()->count(3)->assignedToLocation($location)->create();diff --git a/tests/Feature/Locations/Api/UpdateLocationsTest.php b/tests/Feature/Locations/Api/UpdateLocationsTest.phpindex 13b7cc00a3..7004dd1adb 100644--- a/tests/Feature/Locations/Api/UpdateLocationsTest.php+++ b/tests/Feature/Locations/Api/UpdateLocationsTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class UpdateLocationsTest extends TestCase{- public function testRequiresPermissionToEditLocation()+ public function test_requires_permission_to_edit_location(){$this->actingAsForApi(User::factory()->create())->patchJson(route('api.locations.update', Location::factory()->create()))->assertForbidden();}- public function testCanUpdateLocationViaPatch()+ public function test_can_update_location_via_patch(){$location = Location::factory()->create();diff --git a/tests/Feature/Locations/Ui/CreateLocationsTest.php b/tests/Feature/Locations/Ui/CreateLocationsTest.phpindex 794ee06c67..ca1dadbc55 100644--- a/tests/Feature/Locations/Ui/CreateLocationsTest.php+++ b/tests/Feature/Locations/Ui/CreateLocationsTest.php@@ -2,31 +2,31 @@namespace Tests\Feature\Locations\Ui;-use App\Models\Location;use App\Models\Company;+use App\Models\Location;use App\Models\User;use Tests\TestCase;class CreateLocationsTest extends TestCase{- public function testPermissionRequiredToCreateLocation()+ public function test_permission_required_to_create_location(){$this->actingAs(User::factory()->create())->post(route('locations.store'), ['name' => 'Test Location',- 'company_id' => Company::factory()->create()->id+ 'company_id' => Company::factory()->create()->id,])->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('locations.create'))->assertOk();}- public function testUserCanCreateLocations()+ public function test_user_can_create_locations(){$this->assertFalse(Location::where('name', 'Test Location')->exists());@@ -40,7 +40,7 @@ class CreateLocationsTest extends TestCase$this->assertTrue(Location::where('name', 'Test Location')->where('notes', 'Test Note')->exists());}- public function testUserCannotCreateLocationsWithInvalidParent()+ public function test_user_cannot_create_locations_with_invalid_parent(){$this->assertFalse(Location::where('name', 'Test Location')->exists());@@ -48,11 +48,10 @@ class CreateLocationsTest extends TestCase->from(route('locations.create'))->post(route('locations.store'), ['name' => 'Test Location',- 'parent_id' => '100000000'+ 'parent_id' => '100000000',])->assertRedirect(route('locations.create'));$this->assertFalse(Location::where('name', 'Test Location')->exists());}-}diff --git a/tests/Feature/Locations/Ui/DeleteLocationsTest.php b/tests/Feature/Locations/Ui/DeleteLocationsTest.phpindex f0edb866f7..bff5ac8b52 100644--- a/tests/Feature/Locations/Ui/DeleteLocationsTest.php+++ b/tests/Feature/Locations/Ui/DeleteLocationsTest.php@@ -2,24 +2,23 @@namespace Tests\Feature\Locations\Ui;+use App\Models\Accessory;+use App\Models\Asset;use App\Models\Consumable;-use Tests\TestCase;use App\Models\Location;-use App\Models\Accessory;use App\Models\User;-use App\Models\Asset;+use Tests\TestCase;class DeleteLocationsTest extends TestCase{-- public function testRequiresPermission()+ public function test_requires_permission(){$this->actingAs(User::factory()->create())->delete(route('locations.destroy', Location::factory()->create()))->assertForbidden();}- public function testCanDeleteLocation()+ public function test_can_delete_location(){$location = Location::factory()->create();@@ -32,9 +31,8 @@ class DeleteLocationsTest extends TestCase$this->assertSoftDeleted($location);}-- public function testCannotDeleteLocationWithAssetsAsLocation()+ public function test_cannot_delete_location_with_assets_as_location(){$location = Location::factory()->create();Asset::factory()->count(5)->create(['location_id' => $location->id]);@@ -48,7 +46,7 @@ class DeleteLocationsTest extends TestCase$this->assertNotSoftDeleted($location);}- public function testCannotDeleteLocationWithAssetsAssigned()+ public function test_cannot_delete_location_with_assets_assigned(){$location = Location::factory()->create();Asset::factory()->count(5)->assignedToLocation($location)->create();@@ -62,7 +60,7 @@ class DeleteLocationsTest extends TestCase$this->assertNotSoftDeleted($location);}- public function testCannotDeleteLocationWithChildren()+ public function test_cannot_delete_location_with_children(){$parent = Location::factory()->create();Location::factory()->count(5)->create(['parent_id' => $parent->id]);@@ -76,7 +74,7 @@ class DeleteLocationsTest extends TestCase$this->assertNotSoftDeleted($parent);}- public function testCannotDeleteLocationWithConsumableAsLocation()+ public function test_cannot_delete_location_with_consumable_as_location(){$location = Location::factory()->create();Consumable::factory()->count(5)->create(['location_id' => $location->id]);@@ -90,7 +88,7 @@ class DeleteLocationsTest extends TestCase$this->assertNotSoftDeleted($location);}- public function testCannotDeleteLocationWithAccessoriesAssigned()+ public function test_cannot_delete_location_with_accessories_assigned(){$location = Location::factory()->create();Accessory::factory()->count(5)->checkedOutToLocation($location)->create();@@ -104,7 +102,7 @@ class DeleteLocationsTest extends TestCase$this->assertNotSoftDeleted($location);}- public function testCannotDeleteLocationWithAccessoriesAsLocation()+ public function test_cannot_delete_location_with_accessories_as_location(){$location = Location::factory()->create();Accessory::factory()->count(5)->create(['location_id' => $location->id]);@@ -118,7 +116,7 @@ class DeleteLocationsTest extends TestCase$this->assertNotSoftDeleted($location);}- public function testCannotDeleteLocationWithPeople()+ public function test_cannot_delete_location_with_people(){$location = Location::factory()->create();User::factory()->count(5)->create(['location_id' => $location->id]);@@ -131,9 +129,4 @@ class DeleteLocationsTest extends TestCase$this->assertNotSoftDeleted($location);}-----}diff --git a/tests/Feature/Locations/Ui/IndexLocationsTest.php b/tests/Feature/Locations/Ui/IndexLocationsTest.phpindex 43f117cb64..125c3a9f2a 100644--- a/tests/Feature/Locations/Ui/IndexLocationsTest.php+++ b/tests/Feature/Locations/Ui/IndexLocationsTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class IndexLocationsTest extends TestCase{- public function testPermissionRequiredToViewLocationsList()+ public function test_permission_required_to_view_locations_list(){$this->actingAs(User::factory()->create())->get(route('locations.index'))->assertForbidden();}- public function testUserCanListLocations()+ public function test_user_can_list_locations(){$this->actingAs(User::factory()->superuser()->create())->get(route('locations.index'))diff --git a/tests/Feature/Locations/Ui/ShowLocationTest.php b/tests/Feature/Locations/Ui/ShowLocationTest.phpindex 023ba06dff..8d54541a3b 100644--- a/tests/Feature/Locations/Ui/ShowLocationTest.php+++ b/tests/Feature/Locations/Ui/ShowLocationTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class ShowLocationTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('locations.show', Location::factory()->create()))->assertOk();}- public function testDeniesAccessToRegularUser()+ public function test_denies_access_to_regular_user(){$this->actingAs(User::factory()->create())->get(route('locations.show', Location::factory()->create()))@@ -23,7 +23,7 @@ class ShowLocationTest extends TestCase->assertForbidden();}- public function testDeniesPrintAccessToRegularUser()+ public function test_denies_print_access_to_regular_user(){$this->actingAs(User::factory()->create())->get(route('locations.print_all_assigned', Location::factory()->create()))@@ -31,7 +31,7 @@ class ShowLocationTest extends TestCase->assertForbidden();}- public function testPageRendersForSuperAdmin()+ public function test_page_renders_for_super_admin(){$this->actingAs(User::factory()->superuser()->create())->get(route('locations.print_all_assigned', Location::factory()->create()))diff --git a/tests/Feature/Locations/Ui/UpdateLocationsTest.php b/tests/Feature/Locations/Ui/UpdateLocationsTest.phpindex 7dabdf8371..d6bce14aa5 100644--- a/tests/Feature/Locations/Ui/UpdateLocationsTest.php+++ b/tests/Feature/Locations/Ui/UpdateLocationsTest.php@@ -2,16 +2,16 @@namespace Tests\Feature\Locations\Ui;+use App\Models\Actionlog;use App\Models\Location;use App\Models\User;-use App\Models\Actionlog;-use Tests\TestCase;use Illuminate\Http\UploadedFile;use Illuminate\Support\Facades\Storage;+use Tests\TestCase;class UpdateLocationsTest extends TestCase{- public function testPermissionRequiredToStoreLocation()+ public function test_permission_required_to_store_location(){$this->actingAs(User::factory()->create())->post(route('locations.store'), [@@ -21,14 +21,14 @@ class UpdateLocationsTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('locations.edit', Location::factory()->create()))->assertOk();}- public function testUserCanEditLocations()+ public function test_user_can_edit_locations(){$location = Location::factory()->create(['name' => 'Test Location']);$this->assertTrue(Location::where('name', 'Test Location')->exists());@@ -46,7 +46,7 @@ class UpdateLocationsTest extends TestCase$this->assertTrue(Location::where('name', 'Test Location Edited')->where('notes', 'Test Note Edited')->exists());}- public function testUserCannotEditLocationsToMakeThemTheirOwnParent()+ public function test_user_cannot_edit_locations_to_make_them_their_own_parent(){$location = Location::factory()->create();@@ -62,14 +62,14 @@ class UpdateLocationsTest extends TestCase$this->assertFalse(Location::where('name', 'Test Location')->exists());}- public function testUserCannotEditLocationsWithInvalidParent()+ public function test_user_cannot_edit_locations_with_invalid_parent(){$location = Location::factory()->create();$response = $this->actingAs(User::factory()->superuser()->create())->from(route('locations.edit', $location))->put(route('locations.update', ['location' => $location]), ['name' => 'Test Location',- 'parent_id' => '100000000'+ 'parent_id' => '100000000',])->assertRedirect(route('locations.edit', ['location' => $location->id]));@@ -77,8 +77,7 @@ class UpdateLocationsTest extends TestCase$this->assertFalse(Location::where('name', 'Test Location')->exists());}-- public function testFileIsUploadedAndLogged()+ public function test_file_is_uploaded_and_logged(){$location = Location::factory()->create();Storage::fake('local');@@ -86,13 +85,12 @@ class UpdateLocationsTest extends TestCase$this->actingAs(User::factory()->superuser()->create())->post(route('ui.files.store', ['object_type' => 'locations', 'id' => $location->id]), [- 'file' => [$file],- 'notes' => 'Test Upload',- ])+ 'file' => [$file],+ 'notes' => 'Test Upload',+ ])->assertStatus(302)->assertSessionHasNoErrors();-$location->refresh();$logentry = Actionlog::where('item_type', Location::class)@@ -100,14 +98,11 @@ class UpdateLocationsTest extends TestCase->where('action_type', 'uploaded')->first();- $this->assertTrue(Actionlog::where('item_type', Location:: class)->where('item_id', $location->id)->where('filename', $logentry->filename)->exists());-+ $this->assertTrue(Actionlog::where('item_type', Location::class)->where('item_id', $location->id)->where('filename', $logentry->filename)->exists());// Assert the file was stored...// This doesn't work with the way we handle files :( Should try to fix this.// Storage::disk('local')->assertExists($logentry->filename);}--}diff --git a/tests/Feature/Maintenances/Api/CreateMaintenanceTest.php b/tests/Feature/Maintenances/Api/CreateMaintenanceTest.phpindex 5924b1c1fa..3635eaa857 100644--- a/tests/Feature/Maintenances/Api/CreateMaintenanceTest.php+++ b/tests/Feature/Maintenances/Api/CreateMaintenanceTest.php@@ -4,25 +4,22 @@ namespace Tests\Feature\Maintenances\Api;use App\Models\Asset;use App\Models\Maintenance;-use App\Models\Category;use App\Models\Supplier;use App\Models\User;use Illuminate\Http\UploadedFile;use Illuminate\Support\Facades\Storage;-use Illuminate\Testing\Fluent\AssertableJson;use Tests\TestCase;class CreateMaintenanceTest extends TestCase{--- public function testRequiresPermissionToCreateMaintenance()+ public function test_requires_permission_to_create_maintenance(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.maintenances.store'))->assertForbidden();}- public function testCanCreateMaintenance()++ public function test_can_create_maintenance(){Storage::fake('public');@@ -70,7 +67,4 @@ class CreateMaintenanceTest extends TestCase$this->assertHasTheseActionLogs($maintenance, ['create']);}---}diff --git a/tests/Feature/Maintenances/Api/DeleteMaintenancesTest.php b/tests/Feature/Maintenances/Api/DeleteMaintenancesTest.phpindex 526e10f69e..dea20c4d55 100644--- a/tests/Feature/Maintenances/Api/DeleteMaintenancesTest.php+++ b/tests/Feature/Maintenances/Api/DeleteMaintenancesTest.php@@ -2,8 +2,8 @@namespace Tests\Feature\Maintenances\Api;-use App\Models\Maintenance;use App\Models\Company;+use App\Models\Maintenance;use App\Models\User;use Tests\Concerns\TestsFullMultipleCompaniesSupport;use Tests\Concerns\TestsPermissionsRequirement;@@ -58,7 +58,7 @@ class DeleteMaintenancesTest extends TestCase implements TestsFullMultipleCompan$this->assertHasTheseActionLogs($maintenanceC, ['create', 'delete']);}- public function testCanDeleteMaintenance()+ public function test_can_delete_maintenance(){$maintenance = Maintenance::factory()->create();diff --git a/tests/Feature/Maintenances/Api/EditMaintenanceTest.php b/tests/Feature/Maintenances/Api/EditMaintenanceTest.phpindex c3a4dd337f..9c566f55af 100644--- a/tests/Feature/Maintenances/Api/EditMaintenanceTest.php+++ b/tests/Feature/Maintenances/Api/EditMaintenanceTest.php@@ -2,7 +2,6 @@namespace Tests\Feature\Maintenances\Api;-use App\Models\Asset;use App\Models\Maintenance;use App\Models\Supplier;use App\Models\User;@@ -12,15 +11,14 @@ use Tests\TestCase;class EditMaintenanceTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('maintenances.update', Maintenance::factory()->create()->id))->assertOk();}-- public function testCanEditMaintenance()+ public function test_can_edit_maintenance(){Storage::fake('public');$actor = User::factory()->superuser()->create();@@ -29,7 +27,7 @@ class EditMaintenanceTest extends TestCase$response = $this->actingAs($actor)->followingRedirects()- ->patch(route('maintenances.update', $maintenance), [+ ->patch(route('maintenances.update', $maintenance), ['name' => 'Test Maintenance','supplier_id' => $supplier->id,'asset_maintenance_type' => 'Maintenance',@@ -48,7 +46,6 @@ class EditMaintenanceTest extends TestCase// Assert file was stored...Storage::disk('public')->assertExists(app('maintenances_path').$maintenance->image);-$this->assertDatabaseHas('maintenances', ['supplier_id' => $supplier->id,'asset_maintenance_type' => 'Maintenance',diff --git a/tests/Feature/Maintenances/Ui/CreateMaintenanceTest.php b/tests/Feature/Maintenances/Ui/CreateMaintenanceTest.phpindex a731828899..cd16ff67af 100644--- a/tests/Feature/Maintenances/Ui/CreateMaintenanceTest.php+++ b/tests/Feature/Maintenances/Ui/CreateMaintenanceTest.php@@ -12,22 +12,21 @@ use Tests\TestCase;class CreateMaintenanceTest extends TestCase{- public function testPageRequiresPermission()+ public function test_page_requires_permission(){$this->actingAs(User::factory()->create())->get(route('maintenances.create'))->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('maintenances.create'))->assertOk();}-- public function testCanCreateMaintenance()+ public function test_can_create_maintenance(){Storage::fake('public');$actor = User::factory()->superuser()->create();@@ -57,7 +56,6 @@ class CreateMaintenanceTest extends TestCase// Assert file was stored...Storage::disk('public')->assertExists(app('maintenances_path').$maintenance->image);-$this->assertDatabaseHas('maintenances', ['asset_id' => $asset->id,'supplier_id' => $supplier->id,diff --git a/tests/Feature/Maintenances/Ui/EditMaintenanceTest.php b/tests/Feature/Maintenances/Ui/EditMaintenanceTest.phpindex cf92a10499..62397e73ed 100644--- a/tests/Feature/Maintenances/Ui/EditMaintenanceTest.php+++ b/tests/Feature/Maintenances/Ui/EditMaintenanceTest.php@@ -12,14 +12,14 @@ use Tests\TestCase;class EditMaintenanceTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('maintenances.edit', Maintenance::factory()->create()->id))->assertOk();}- public function testCanUpdateMaintenance()+ public function test_can_update_maintenance(){$actor = User::factory()->superuser()->create();$asset = Asset::factory()->create();@@ -65,5 +65,4 @@ class EditMaintenanceTest extends TestCase$this->assertHasTheseActionLogs($maintenance, ['create', 'update']);}-}diff --git a/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.php b/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.phpindex b6e3793e5e..daa41b7c7a 100644--- a/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.php+++ b/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class MaintenanceIndexTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('maintenances.index'))diff --git a/tests/Feature/Maintenances/Ui/ShowMaintenanceTest.php b/tests/Feature/Maintenances/Ui/ShowMaintenanceTest.phpindex fb366d1d54..4495676f5c 100644--- a/tests/Feature/Maintenances/Ui/ShowMaintenanceTest.php+++ b/tests/Feature/Maintenances/Ui/ShowMaintenanceTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowMaintenanceTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('maintenances.show', Maintenance::factory()->create()->id))diff --git a/tests/Feature/Manufacturers/Api/CreateManufacturersTest.php b/tests/Feature/Manufacturers/Api/CreateManufacturersTest.phpindex df62928dc7..57ce200e53 100644--- a/tests/Feature/Manufacturers/Api/CreateManufacturersTest.php+++ b/tests/Feature/Manufacturers/Api/CreateManufacturersTest.php@@ -8,16 +8,14 @@ use Tests\TestCase;class CreateManufacturersTest extends TestCase{--- public function testRequiresPermissionToCreateManufacturer()+ public function test_requires_permission_to_create_manufacturer(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.manufacturers.store'))->assertForbidden();}- public function testCanCreateManufacturer()+ public function test_can_create_manufacturer(){$response = $this->actingAsForApi(User::factory()->superuser()->create())->postJson(route('api.manufacturers.store'), [@@ -35,5 +33,4 @@ class CreateManufacturersTest extends TestCase$this->assertEquals('Test Manufacturer', $manufacturer->name);$this->assertEquals('Test Note', $manufacturer->notes);}-}diff --git a/tests/Feature/Manufacturers/Api/DeleteManufacturersTest.php b/tests/Feature/Manufacturers/Api/DeleteManufacturersTest.phpindex a18978b089..29ffc2e84b 100644--- a/tests/Feature/Manufacturers/Api/DeleteManufacturersTest.php+++ b/tests/Feature/Manufacturers/Api/DeleteManufacturersTest.php@@ -22,7 +22,7 @@ class DeleteManufacturersTest extends TestCase implements TestsPermissionsRequir$this->assertNotSoftDeleted($manufacturer);}- public function testCannotDeleteManufacturerWithAssociatedData()+ public function test_cannot_delete_manufacturer_with_associated_data(){$manufacturerWithAccessories = Manufacturer::factory()->hasAccessories()->create();$manufacturerWithConsumables = Manufacturer::factory()->hasConsumables()->create();@@ -50,7 +50,7 @@ class DeleteManufacturersTest extends TestCase implements TestsPermissionsRequir$this->assertNotSoftDeleted($manufacturerWithLicenses);}- public function testCanDeleteManufacturer()+ public function test_can_delete_manufacturer(){$manufacturer = Manufacturer::factory()->create();diff --git a/tests/Feature/Manufacturers/Api/UpdateManufacturersTest.php b/tests/Feature/Manufacturers/Api/UpdateManufacturersTest.phpindex 92a376e756..16e999d21b 100644--- a/tests/Feature/Manufacturers/Api/UpdateManufacturersTest.php+++ b/tests/Feature/Manufacturers/Api/UpdateManufacturersTest.php@@ -3,13 +3,12 @@namespace Tests\Feature\Manufacturers\Api;use App\Models\Manufacturer;-use App\Models\Category;use App\Models\User;use Tests\TestCase;class UpdateManufacturersTest extends TestCase{- public function testPermissionRequiredToStoreManufacturer()+ public function test_permission_required_to_store_manufacturer(){$this->actingAs(User::factory()->create())->post(route('manufacturers.store'), [@@ -19,14 +18,14 @@ class UpdateManufacturersTest extends TestCase->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('manufacturers.edit', Manufacturer::factory()->create()->id))->assertOk();}- public function testUserCanEditManufacturers()+ public function test_user_can_edit_manufacturers(){$manufacturer = Manufacturer::factory()->create(['name' => 'Test Manufacturer']);$this->assertTrue(Manufacturer::where('name', 'Test Manufacturer')->exists());@@ -44,7 +43,4 @@ class UpdateManufacturersTest extends TestCase$this->assertTrue(Manufacturer::where('name', 'Test Manufacturer Edited')->where('notes', 'Test Note Edited')->exists());}---}diff --git a/tests/Feature/Manufacturers/Ui/BulkDeleteManufacturersTest.php b/tests/Feature/Manufacturers/Ui/BulkDeleteManufacturersTest.phpindex 7dd5ae97f1..5235f558c4 100644--- a/tests/Feature/Manufacturers/Ui/BulkDeleteManufacturersTest.php+++ b/tests/Feature/Manufacturers/Ui/BulkDeleteManufacturersTest.php@@ -14,19 +14,19 @@ class BulkDeleteManufacturersTest extends TestCase implements TestsPermissionsRe{$this->actingAs(User::factory()->create())->post(route('manufacturers.bulk.delete'), [- 'ids' => [1, 2, 3]+ 'ids' => [1, 2, 3],])->assertForbidden();}public function test_manufacturer_cannot_be_bulk_deleted_if_models_still_associated(){- //TODO: better test for specific messages+ // TODO: better test for specific messages$manufacturer = Manufacturer::factory()->create();Accessory::factory()->for($manufacturer)->create();$this->actingAs(User::factory()->deleteManufacturers()->create())->post(route('manufacturers.bulk.delete'), [- 'ids' => [$manufacturer->id]+ 'ids' => [$manufacturer->id],]);$this->assertModelExists($manufacturer);$this->assertNotSoftDeleted($manufacturer);@@ -40,7 +40,7 @@ class BulkDeleteManufacturersTest extends TestCase implements TestsPermissionsRe$this->actingAs(User::factory()->deleteManufacturers()->create())->post(route('manufacturers.bulk.delete'), [- 'ids' => [$manufacturer1->id, $manufacturer2->id, $manufacturer3->id]+ 'ids' => [$manufacturer1->id, $manufacturer2->id, $manufacturer3->id],])->assertRedirect(route('manufacturers.index'));@@ -48,5 +48,4 @@ class BulkDeleteManufacturersTest extends TestCase implements TestsPermissionsRe$this->assertSoftDeleted($manufacturer2);$this->assertSoftDeleted($manufacturer3);}-}diff --git a/tests/Feature/Manufacturers/Ui/CreateManufacturerTest.php b/tests/Feature/Manufacturers/Ui/CreateManufacturerTest.phpindex 4eb9d4fb7e..e40f9c3eec 100644--- a/tests/Feature/Manufacturers/Ui/CreateManufacturerTest.php+++ b/tests/Feature/Manufacturers/Ui/CreateManufacturerTest.php@@ -2,20 +2,20 @@namespace Tests\Feature\Manufacturers\Ui;-use App\Models\User;use App\Models\Manufacturer;+use App\Models\User;use Tests\TestCase;class CreateManufacturerTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('manufacturers.create'))->assertOk();}- public function testUserCanCreateManufacturer()+ public function test_user_can_create_manufacturer(){$this->assertFalse(Manufacturer::where('name', 'Test Manufacturer')->exists());@@ -28,5 +28,4 @@ class CreateManufacturerTest extends TestCase$this->assertTrue(Manufacturer::where('name', 'Test Manufacturer')->where('notes', 'Test Note')->exists());}-}diff --git a/tests/Feature/Manufacturers/Ui/IndexManufacturersTest.php b/tests/Feature/Manufacturers/Ui/IndexManufacturersTest.phpindex 675063ec8d..505fbc1e60 100644--- a/tests/Feature/Manufacturers/Ui/IndexManufacturersTest.php+++ b/tests/Feature/Manufacturers/Ui/IndexManufacturersTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class IndexManufacturersTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('manufacturers.index'))->assertOk();}- public function testCannotSeedIfManufacturersExist()+ public function test_cannot_seed_if_manufacturers_exist(){Manufacturer::factory()->create();diff --git a/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.php b/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.phpindex 9a40819a10..8d780a1af0 100644--- a/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.php+++ b/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowManufacturerTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('manufacturers.show', Manufacturer::factory()->create()))diff --git a/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.php b/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.phpindex 9d5861300f..472e73f740 100644--- a/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.php+++ b/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class UpdateManufacturerTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('manufacturers.edit', Manufacturer::factory()->create()))->assertOk();}- public function testUserCanEditManufacturers()+ public function test_user_can_edit_manufacturers(){$manufacturer = Manufacturer::factory()->create(['name' => 'Test Manufacturer']);$this->assertTrue(Manufacturer::where('name', 'Test Manufacturer')->exists());@@ -32,5 +32,4 @@ class UpdateManufacturerTest extends TestCase$this->followRedirects($response)->assertSee('Success');$this->assertTrue(Manufacturer::where('name', 'Test Manufacturer Edited')->where('notes', 'Test Note Edited')->exists());}-}diff --git a/tests/Feature/Modals/Ui/ShowModalsTest.php b/tests/Feature/Modals/Ui/ShowModalsTest.phpindex 6da781d319..2dc77ccd34 100644--- a/tests/Feature/Modals/Ui/ShowModalsTest.php+++ b/tests/Feature/Modals/Ui/ShowModalsTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class ShowModalsTest extends TestCase{- public function testUserModalRenders()+ public function test_user_modal_renders(){$admin = User::factory()->createUsers()->create();$response = $this->actingAs($admin)@@ -20,47 +20,45 @@ class ShowModalsTest extends TestCase$response->assertDontSee($admin->email);}- public function testDepartmentModalRenders()+ public function test_department_modal_renders(){$this->actingAs(User::factory()->superuser()->create())->get('modals/model')->assertOk();}- public function testStatusLabelModalRenders()+ public function test_status_label_modal_renders(){$this->actingAs(User::factory()->superuser()->create())->get('modals/statuslabel')->assertOk();}- public function testLocationModalRenders()+ public function test_location_modal_renders(){$this->actingAs(User::factory()->superuser()->create())->get('modals/location')->assertOk();}- public function testCategoryModalRenders()+ public function test_category_modal_renders(){$this->actingAs(User::factory()->superuser()->create())->get('modals/category')->assertOk();}- public function testManufacturerModalRenders()+ public function test_manufacturer_modal_renders(){$this->actingAs(User::factory()->superuser()->create())->get('modals/manufacturer')->assertOk();}- public function testSupplierModalRenders()+ public function test_supplier_modal_renders(){$this->actingAs(User::factory()->superuser()->create())->get('modals/supplier')->assertOk();}--}diff --git a/tests/Feature/Notes/CreateNotesTest.php b/tests/Feature/Notes/CreateNotesTest.phpindex a2caae6459..c5f153714f 100644--- a/tests/Feature/Notes/CreateNotesTest.php+++ b/tests/Feature/Notes/CreateNotesTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class CreateNotesTest extends TestCase{- public function testRequiresPermission()+ public function test_requires_permission(){$this->actingAs(User::factory()->create())->post(route('notes.store'))->assertForbidden();}- public function testValidation()+ public function test_validation(){$asset = Asset::factory()->create();@@ -27,7 +27,7 @@ class CreateNotesTest extends TestCase->assertSessionHas('errors');}- public function testAssetMustExist()+ public function test_asset_must_exist(){$this->actingAs(User::factory()->editAssets()->create())->post(route('notes.store'), [@@ -38,7 +38,7 @@ class CreateNotesTest extends TestCase->assertStatus(302);}- public function testCanCreateNoteForAsset()+ public function test_can_create_note_for_asset(){$actor = User::factory()->editAssets()->create();@@ -52,7 +52,7 @@ class CreateNotesTest extends TestCase'type' => 'asset','note' => 'my special note',])- ->assertRedirect(route('hardware.show', $asset->id) . '#history')+ ->assertRedirect(route('hardware.show', $asset->id).'#history')->assertSessionHas('success', trans('general.note_added'));$this->assertDatabaseHas('action_logs', [diff --git a/tests/Feature/Notifications/Email/AcceptanceReminderTest.php b/tests/Feature/Notifications/Email/AcceptanceReminderTest.phpindex a8845a895c..e530a19b6b 100644--- a/tests/Feature/Notifications/Email/AcceptanceReminderTest.php+++ b/tests/Feature/Notifications/Email/AcceptanceReminderTest.php@@ -24,6 +24,7 @@ use Tests\TestCase;class AcceptanceReminderTest extends TestCase{private User $admin;+private User $assignee;protected function setUp(): void@@ -36,7 +37,7 @@ class AcceptanceReminderTest extends TestCase$this->assignee = User::factory()->create();}- public function testMustHavePermissionToSendReminder()+ public function test_must_have_permission_to_send_reminder(){$checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();$userWithoutPermission = User::factory()->create();@@ -50,7 +51,7 @@ class AcceptanceReminderTest extends TestCaseMail::assertNotSent(CheckoutAssetMail::class);}- public function testReminderNotSentIfAcceptanceDoesNotExist()+ public function test_reminder_not_sent_if_acceptance_does_not_exist(){$this->actingAs($this->admin)->post(route('reports/unaccepted_assets_sent_reminder', [@@ -60,7 +61,7 @@ class AcceptanceReminderTest extends TestCaseMail::assertNotSent(CheckoutAssetMail::class);}- public function testReminderNotSentIfAcceptanceAlreadyAccepted()+ public function test_reminder_not_sent_if_acceptance_already_accepted(){$checkoutAcceptanceAlreadyAccepted = CheckoutAcceptance::factory()->accepted()->create();@@ -80,7 +81,7 @@ class AcceptanceReminderTest extends TestCase->pending()->forAssignedTo(['email' => null])->create();- }+ },];yield 'User with empty string email address' => [@@ -89,12 +90,12 @@ class AcceptanceReminderTest extends TestCase->pending()->forAssignedTo(['email' => ''])->create();- }+ },];}#[DataProvider('checkoutAcceptancesToUsersWithoutEmailAddresses')]- public function testUserWithoutEmailAddressHandledGracefully($callback)+ public function test_user_without_email_address_handled_gracefully($callback){$checkoutAcceptance = $callback();@@ -108,7 +109,7 @@ class AcceptanceReminderTest extends TestCaseMail::assertNotSent(CheckoutAssetMail::class);}- public function testReminderIsSentToUserForAccessory()+ public function test_reminder_is_sent_to_user_for_accessory(){$accessory = Accessory::factory()->requiringAcceptance()->create();@@ -143,7 +144,7 @@ class AcceptanceReminderTest extends TestCase});}- public function testReminderIsSentToUserForAsset()+ public function test_reminder_is_sent_to_user_for_asset(){$asset = Asset::factory()->requiresAcceptance()->create();@@ -172,7 +173,7 @@ class AcceptanceReminderTest extends TestCase});}- public function testReminderIsSentToUserForConsumable()+ public function test_reminder_is_sent_to_user_for_consumable(){$consumable = Consumable::factory()->requiringAcceptance()->create();@@ -201,7 +202,7 @@ class AcceptanceReminderTest extends TestCase});}- public function testReminderIsSentToUserForLicenseSeat()+ public function test_reminder_is_sent_to_user_for_license_seat(){$licenseSeat = LicenseSeat::factory()->requiringAcceptance()->create();diff --git a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.phpindex 4a1658e9fb..ee9252d202 100644--- a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php+++ b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php@@ -18,6 +18,7 @@ use Tests\TestCase;class BulkCheckoutEmailTest extends TestCase{private Collection $assets;+private Model $assignee;protected function setUp(): void@@ -97,7 +98,7 @@ class BulkCheckoutEmailTest extends TestCase->withNoLocalOrGlobalEula()->create();- $this->assets->each(fn($asset) => $asset->model->category()->associate($category)->save());+ $this->assets->each(fn ($asset) => $asset->model->category()->associate($category)->save());$this->sendRequest();@@ -115,7 +116,7 @@ class BulkCheckoutEmailTest extends TestCase->hasLocalEula()->create();- $this->assets->each(fn($asset) => $asset->model->category()->associate($category)->save());+ $this->assets->each(fn ($asset) => $asset->model->category()->associate($category)->save());$this->sendRequest();@@ -137,7 +138,7 @@ class BulkCheckoutEmailTest extends TestCase->sendsCheckinEmail()->create();- $this->assets->each(fn($asset) => $asset->model->category()->associate($category)->save());+ $this->assets->each(fn ($asset) => $asset->model->category()->associate($category)->save());$this->sendRequest();@@ -182,7 +183,7 @@ class BulkCheckoutEmailTest extends TestCase->withNoLocalOrGlobalEula()->create();- $this->assets->each(fn($asset) => $asset->model->category()->associate($category)->save());+ $this->assets->each(fn ($asset) => $asset->model->category()->associate($category)->save());$this->sendRequest();@@ -205,7 +206,7 @@ class BulkCheckoutEmailTest extends TestCase->withNoLocalOrGlobalEula()->create();- $this->assets->each(fn($asset) => $asset->model->category()->associate($category)->save());+ $this->assets->each(fn ($asset) => $asset->model->category()->associate($category)->save());$this->sendRequest();@@ -235,11 +236,11 @@ class BulkCheckoutEmailTest extends TestCase$this->actingAs(User::factory()->checkoutAssets()->viewAssets()->create())->followingRedirects()->post(route('hardware.bulkcheckout.store'), [- 'selected_assets' => $this->assets->pluck('id')->toArray(),- 'checkout_at' => now()->subWeek()->format('Y-m-d'),- 'expected_checkin' => now()->addWeek()->format('Y-m-d'),- 'note' => null,- ] + $assigned)+ 'selected_assets' => $this->assets->pluck('id')->toArray(),+ 'checkout_at' => now()->subWeek()->format('Y-m-d'),+ 'expected_checkin' => now()->addWeek()->format('Y-m-d'),+ 'note' => null,+ ] + $assigned)->assertOk();}diff --git a/tests/Feature/Notifications/Email/CheckoutResponseEmailTest.php b/tests/Feature/Notifications/Email/CheckoutResponseEmailTest.phpindex 4fe996461a..987a237ebd 100644--- a/tests/Feature/Notifications/Email/CheckoutResponseEmailTest.php+++ b/tests/Feature/Notifications/Email/CheckoutResponseEmailTest.php@@ -76,7 +76,7 @@ class CheckoutResponseEmailTest extends TestCaseprivate function assertEmailSentTo(User $user, string $type): void{Mail::assertSent(CheckoutAcceptanceResponseMail::class, function (CheckoutAcceptanceResponseMail $mail) use ($type, $user) {- return $mail->hasTo($user->email) && $mail->assertHasSubject('A checkout you initiated was ' . $type);+ return $mail->hasTo($user->email) && $mail->assertHasSubject('A checkout you initiated was '.$type);});}diff --git a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.phpindex 5125980187..1248e20867 100644--- a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php+++ b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php@@ -16,8 +16,11 @@ use Tests\TestCase;class EmailNotificationsToAdminAlertEmailUponCheckinTest extends TestCase{private Asset $asset;+private AssetModel $assetModel;+private Category $category;+private User $user;protected function setUp(): voiddiff --git a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.phpindex d881ae7dab..d5a59540d1 100644--- a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php+++ b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php@@ -16,8 +16,11 @@ use Tests\TestCase;class EmailNotificationsToAdminAlertEmailUponCheckoutTest extends TestCase{private Asset $asset;+private AssetModel $assetModel;+private Category $category;+private User $user;protected function setUp(): voiddiff --git a/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckinTest.php b/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckinTest.phpindex 432ce88b4b..cacaa055b7 100644--- a/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckinTest.php+++ b/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckinTest.php@@ -2,15 +2,15 @@namespace Tests\Feature\Notifications\Email;+use App\Events\CheckoutableCheckedIn;use App\Mail\CheckinAssetMail;use App\Models\Accessory;+use App\Models\Asset;use App\Models\Consumable;use App\Models\LicenseSeat;+use App\Models\User;use Illuminate\Support\Facades\Mail;use PHPUnit\Framework\Attributes\Group;-use App\Events\CheckoutableCheckedIn;-use App\Models\Asset;-use App\Models\User;use Tests\TestCase;#[Group('notifications')]@@ -32,8 +32,8 @@ class EmailNotificationsToUserUponCheckinTest extends TestCase$this->fireCheckInEvent($asset, $user);- Mail::assertSent(CheckinAssetMail::class, function($mail) use ($user) {- return $mail->hasTo($user->email);+ Mail::assertSent(CheckinAssetMail::class, function ($mail) use ($user) {+ return $mail->hasTo($user->email);});}diff --git a/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckoutTest.php b/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckoutTest.phpindex e5741da8ec..4a6d3b0b8b 100644--- a/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckoutTest.php+++ b/tests/Feature/Notifications/Email/EmailNotificationsToUserUponCheckoutTest.php@@ -16,8 +16,11 @@ use Tests\TestCase;class EmailNotificationsToUserUponCheckoutTest extends TestCase{private Asset $asset;+private AssetModel $assetModel;+private Category $category;+private User $user;protected function setUp(): voiddiff --git a/tests/Feature/Notifications/Email/ExpiringAlertsNotificationTest.php b/tests/Feature/Notifications/Email/ExpiringAlertsNotificationTest.phpindex 707f5468d4..15b4df0a0a 100644--- a/tests/Feature/Notifications/Email/ExpiringAlertsNotificationTest.php+++ b/tests/Feature/Notifications/Email/ExpiringAlertsNotificationTest.php@@ -11,150 +11,146 @@ use App\Models\Setting;use Illuminate\Support\Facades\Mail;use Tests\TestCase;-class ExpiringAlertsNotificationTest extends TestCase{- public function testExpiringAssetsEmailNotification()- {- Mail::fake();-- $this->settings->enableAlertEmail('[email protected]');- $this->settings->setAlertInterval(30);-- $alert_email = Setting::first()->alert_email;-- $expiringWarrantyAsset = Asset::factory()->create([- 'purchase_date' => now()->subDays(356)->format('Y-m-d'),- 'warranty_months' => 12,- 'archived' => 0,- ]);--- $alreadyExpiredAsset = Asset::factory()->create([- 'purchase_date' => now()->subDays(396)->format('Y-m-d'),- 'warranty_months' => 12,- 'archived' => 0,- ]);-- // Asset has a manually entered EOL date that's coming up- $expiringEOLAsset = Asset::factory()->create([- 'archived' => 0,- ]);-- // We have to set this here because of the configure() method in the Asset factory :(- $expiringEOLAsset->asset_eol_date = now()->addDays(5)->format('Y-m-d');- $expiringEOLAsset->save();-- $notExpiringAsset = Asset::factory()->create([- 'purchase_date' => now()->addDays(330)->format('Y-m-d'),- 'warranty_months' => 12,- 'archived' => 0,- ]);- // We have to set this here because of the configure() method in the Asset factory :(- $notExpiringAsset->asset_eol_date = null;- $expiringEOLAsset->save();--- $this->artisan('snipeit:expiring-alerts')->assertExitCode(0);-- Mail::assertSent(ExpiringAssetsMail::class, function($mail) use ($alert_email, $expiringWarrantyAsset, $expiringEOLAsset) {- return $mail->hasTo($alert_email) && ($mail->assets->contains($expiringEOLAsset) || $mail->assets->contains($expiringWarrantyAsset));- });--- Mail::assertNotSent(ExpiringAssetsMail::class, function($mail) use ($alert_email, $notExpiringAsset, $alreadyExpiredAsset) {- return $mail->assets->contains($alert_email) || ($mail->assets->contains($alreadyExpiredAsset) && ($mail->assets->contains($notExpiringAsset)));- });- }-- public function testExpiringLicensesEmailNotification()- {- Mail::fake();- $this->settings->enableAlertEmail('[email protected]');- $this->settings->setAlertInterval(60);-- $alert_email = Setting::first()->alert_email;-- $expiringLicense = License::factory()->create([- 'expiration_date' => now()->addDays(30)->format('Y-m-d'),- 'deleted_at' => null,- 'termination_date' => null,- ]);-- $expiredLicense = License::factory()->create([- 'expiration_date' => now()->subDays(10)->format('Y-m-d'),- 'deleted_at' => null,- ]);- $notExpiringLicense = License::factory()->create([- 'expiration_date' => now()->addMonths(3)->format('Y-m-d'),- 'deleted_at' => null,- ]);-- $expiringButTerminatedLicense = License::factory()->create([- 'termination_date' => now()->subDays(10)->format('Y-m-d'),- 'expiration_date' => now()->subDays(10)->format('Y-m-d'),- 'deleted_at' => null,- ]);-- $deletedExpiringLicense = License::factory()->create([- 'expiration_date' => now()->addDays(30)->format('Y-m-d'),- 'deleted_at' => now()->subDays(10)->format('Y-m-d'),- ]);-- $this->artisan('snipeit:expiring-alerts')->assertExitCode(0);-- Mail::assertSent(ExpiringLicenseMail::class, function($mail) use ($alert_email, $expiringLicense) {- return $mail->hasTo($alert_email) && $mail->licenses->contains($expiringLicense);- });-- Mail::assertNotSent(ExpiringLicenseMail::class, function($mail) use ($alert_email, $expiredLicense) {- return $mail->hasTo($alert_email) && $mail->licenses->contains($expiredLicense);- });-- Mail::assertNotSent(ExpiringLicenseMail::class, function($mail) use ($alert_email, $notExpiringLicense) {- return $mail->licenses->contains($alert_email) || $mail->licenses->contains($notExpiringLicense);- });-- Mail::assertNotSent(ExpiringLicenseMail::class, function($mail) use ($alert_email, $expiringButTerminatedLicense) {- return $mail->licenses->contains($alert_email) || $mail->licenses->contains($expiringButTerminatedLicense);- });-- Mail::assertNotSent(ExpiringLicenseMail::class, function($mail) use ($alert_email, $deletedExpiringLicense) {- return $mail->licenses->contains($alert_email) || $mail->licenses->contains($deletedExpiringLicense);- });-- }-- public function testAuditWarningThresholdEmailNotification()- {- Mail::fake();- $this->settings->enableAlertEmail('[email protected]');- $this->settings->setAuditWarningDays(15);-- $alert_email = Setting::first()->alert_email;-- $upcomingAuditableAsset = Asset::factory()->create([- 'next_audit_date' => now()->addDays(14)->format('Y-m-d'),- 'deleted_at' => null,- ]);-- $overDueForAuditableAsset = Asset::factory()->create([- 'next_audit_date' => now()->subDays(1)->format('Y-m-d'),- 'deleted_at' => null,- ]);-- $notAuditableAsset = Asset::factory()->create([- 'next_audit_date' => now()->addDays(30)->format('Y-m-d'),- 'deleted_at' => null,- ]);-- $this->artisan('snipeit:upcoming-audits')->assertExitCode(0);-- Mail::assertSent(SendUpcomingAuditMail::class, function($mail) use ($alert_email, $upcomingAuditableAsset, $overDueForAuditableAsset) {- return $mail->hasTo($alert_email) && ($mail->assets->contains($upcomingAuditableAsset) && $mail->assets->contains($overDueForAuditableAsset));- });- Mail::assertNotSent(SendUpcomingAuditMail::class, function($mail) use ($alert_email, $notAuditableAsset) {- return $mail->hasTo($alert_email) && $mail->assets->contains($notAuditableAsset);- });- }-}\ No newline at end of file+ public function test_expiring_assets_email_notification()+ {+ Mail::fake();++ $this->settings->enableAlertEmail('[email protected]');+ $this->settings->setAlertInterval(30);++ $alert_email = Setting::first()->alert_email;++ $expiringWarrantyAsset = Asset::factory()->create([+ 'purchase_date' => now()->subDays(356)->format('Y-m-d'),+ 'warranty_months' => 12,+ 'archived' => 0,+ ]);++ $alreadyExpiredAsset = Asset::factory()->create([+ 'purchase_date' => now()->subDays(396)->format('Y-m-d'),+ 'warranty_months' => 12,+ 'archived' => 0,+ ]);++ // Asset has a manually entered EOL date that's coming up+ $expiringEOLAsset = Asset::factory()->create([+ 'archived' => 0,+ ]);++ // We have to set this here because of the configure() method in the Asset factory :(+ $expiringEOLAsset->asset_eol_date = now()->addDays(5)->format('Y-m-d');+ $expiringEOLAsset->save();++ $notExpiringAsset = Asset::factory()->create([+ 'purchase_date' => now()->addDays(330)->format('Y-m-d'),+ 'warranty_months' => 12,+ 'archived' => 0,+ ]);+ // We have to set this here because of the configure() method in the Asset factory :(+ $notExpiringAsset->asset_eol_date = null;+ $expiringEOLAsset->save();++ $this->artisan('snipeit:expiring-alerts')->assertExitCode(0);++ Mail::assertSent(ExpiringAssetsMail::class, function ($mail) use ($alert_email, $expiringWarrantyAsset, $expiringEOLAsset) {+ return $mail->hasTo($alert_email) && ($mail->assets->contains($expiringEOLAsset) || $mail->assets->contains($expiringWarrantyAsset));+ });++ Mail::assertNotSent(ExpiringAssetsMail::class, function ($mail) use ($alert_email, $notExpiringAsset, $alreadyExpiredAsset) {+ return $mail->assets->contains($alert_email) || ($mail->assets->contains($alreadyExpiredAsset) && ($mail->assets->contains($notExpiringAsset)));+ });+ }++ public function test_expiring_licenses_email_notification()+ {+ Mail::fake();+ $this->settings->enableAlertEmail('[email protected]');+ $this->settings->setAlertInterval(60);++ $alert_email = Setting::first()->alert_email;++ $expiringLicense = License::factory()->create([+ 'expiration_date' => now()->addDays(30)->format('Y-m-d'),+ 'deleted_at' => null,+ 'termination_date' => null,+ ]);++ $expiredLicense = License::factory()->create([+ 'expiration_date' => now()->subDays(10)->format('Y-m-d'),+ 'deleted_at' => null,+ ]);+ $notExpiringLicense = License::factory()->create([+ 'expiration_date' => now()->addMonths(3)->format('Y-m-d'),+ 'deleted_at' => null,+ ]);++ $expiringButTerminatedLicense = License::factory()->create([+ 'termination_date' => now()->subDays(10)->format('Y-m-d'),+ 'expiration_date' => now()->subDays(10)->format('Y-m-d'),+ 'deleted_at' => null,+ ]);++ $deletedExpiringLicense = License::factory()->create([+ 'expiration_date' => now()->addDays(30)->format('Y-m-d'),+ 'deleted_at' => now()->subDays(10)->format('Y-m-d'),+ ]);++ $this->artisan('snipeit:expiring-alerts')->assertExitCode(0);++ Mail::assertSent(ExpiringLicenseMail::class, function ($mail) use ($alert_email, $expiringLicense) {+ return $mail->hasTo($alert_email) && $mail->licenses->contains($expiringLicense);+ });++ Mail::assertNotSent(ExpiringLicenseMail::class, function ($mail) use ($alert_email, $expiredLicense) {+ return $mail->hasTo($alert_email) && $mail->licenses->contains($expiredLicense);+ });++ Mail::assertNotSent(ExpiringLicenseMail::class, function ($mail) use ($alert_email, $notExpiringLicense) {+ return $mail->licenses->contains($alert_email) || $mail->licenses->contains($notExpiringLicense);+ });++ Mail::assertNotSent(ExpiringLicenseMail::class, function ($mail) use ($alert_email, $expiringButTerminatedLicense) {+ return $mail->licenses->contains($alert_email) || $mail->licenses->contains($expiringButTerminatedLicense);+ });++ Mail::assertNotSent(ExpiringLicenseMail::class, function ($mail) use ($alert_email, $deletedExpiringLicense) {+ return $mail->licenses->contains($alert_email) || $mail->licenses->contains($deletedExpiringLicense);+ });++ }++ public function test_audit_warning_threshold_email_notification()+ {+ Mail::fake();+ $this->settings->enableAlertEmail('[email protected]');+ $this->settings->setAuditWarningDays(15);++ $alert_email = Setting::first()->alert_email;++ $upcomingAuditableAsset = Asset::factory()->create([+ 'next_audit_date' => now()->addDays(14)->format('Y-m-d'),+ 'deleted_at' => null,+ ]);++ $overDueForAuditableAsset = Asset::factory()->create([+ 'next_audit_date' => now()->subDays(1)->format('Y-m-d'),+ 'deleted_at' => null,+ ]);++ $notAuditableAsset = Asset::factory()->create([+ 'next_audit_date' => now()->addDays(30)->format('Y-m-d'),+ 'deleted_at' => null,+ ]);++ $this->artisan('snipeit:upcoming-audits')->assertExitCode(0);++ Mail::assertSent(SendUpcomingAuditMail::class, function ($mail) use ($alert_email, $upcomingAuditableAsset, $overDueForAuditableAsset) {+ return $mail->hasTo($alert_email) && ($mail->assets->contains($upcomingAuditableAsset) && $mail->assets->contains($overDueForAuditableAsset));+ });+ Mail::assertNotSent(SendUpcomingAuditMail::class, function ($mail) use ($alert_email, $notAuditableAsset) {+ return $mail->hasTo($alert_email) && $mail->assets->contains($notAuditableAsset);+ });+ }+}diff --git a/tests/Feature/Notifications/Webhooks/NotificationTests.php b/tests/Feature/Notifications/Webhooks/NotificationTests.phpindex 4537673f30..72886d38d5 100644--- a/tests/Feature/Notifications/Webhooks/NotificationTests.php+++ b/tests/Feature/Notifications/Webhooks/NotificationTests.php@@ -1,4 +1,5 @@<?php+namespace Tests\Feature\Notifications\Webhooks;use App\Models\Asset;@@ -7,7 +8,6 @@ use App\Notifications\AuditNotification;use Illuminate\Support\Facades\Notification;use PHPUnit\Framework\Attributes\Group;use Tests\TestCase;-use Tests\Support\Settings;#[Group('notifications')]class NotificationTests extends TestCase@@ -18,7 +18,8 @@ class NotificationTests extends TestCaseNotification::fake();}- public function testAuditNotificationThrowsWhenItemIsNull()++ public function test_audit_notification_throws_when_item_is_null(){try {new AuditNotification([@@ -31,17 +32,17 @@ class NotificationTests extends TestCase}}- public function testAuditNotificationFires()+ public function test_audit_notification_fires(){$webhook_options = ['enableSlackWebhook','enableMicrosoftTeamsWebhook',- 'enableGoogleChatWebhook'+ 'enableGoogleChatWebhook',];Notification::fake();- //tests every webhook option- foreach($webhook_options as $option) {+ // tests every webhook option+ foreach ($webhook_options as $option) {$this->settings->{$option}();@@ -49,13 +50,13 @@ class NotificationTests extends TestCase$item = Asset::factory()->create();try {- $user->notify(new \App\Notifications\AuditNotification([- 'item' => $item,+ $user->notify(new AuditNotification([+ 'item' => $item,]));} catch (\InvalidArgumentException $e) {$this->fail("AuditNotification threw for [{$option}]: {$e->getMessage()}");}}- Notification::assertSentTimes(AuditNotification::class, count($webhook_options));+ Notification::assertSentTimes(AuditNotification::class, count($webhook_options));}}diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.phpindex d366103d74..76becbb19d 100644--- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php+++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php@@ -2,23 +2,23 @@namespace Tests\Feature\Notifications\Webhooks;-use App\Models\AssetModel;-use App\Models\Category;-use App\Notifications\CheckinComponentNotification;-use PHPUnit\Framework\Attributes\DataProvider;-use PHPUnit\Framework\Attributes\Group;use App\Events\CheckoutableCheckedIn;use App\Models\Accessory;use App\Models\Asset;+use App\Models\AssetModel;+use App\Models\Category;use App\Models\Component;use App\Models\LicenseSeat;use App\Models\Location;use App\Models\User;use App\Notifications\CheckinAccessoryNotification;use App\Notifications\CheckinAssetNotification;+use App\Notifications\CheckinComponentNotification;use App\Notifications\CheckinLicenseSeatNotification;use Illuminate\Database\Eloquent\Model;use Illuminate\Support\Facades\Notification;+use PHPUnit\Framework\Attributes\DataProvider;+use PHPUnit\Framework\Attributes\Group;use Tests\TestCase;#[Group('notifications')]@@ -34,21 +34,21 @@ class SlackNotificationsUponCheckinTest extends TestCasepublic static function assetCheckInTargets(): array{return [- 'Asset checked out to user' => [fn() => User::factory()->create()],- 'Asset checked out to asset' => [fn() => Asset::factory()->laptopMbp()->create()],- 'Asset checked out to location' => [fn() => Location::factory()->create()],+ 'Asset checked out to user' => [fn () => User::factory()->create()],+ 'Asset checked out to asset' => [fn () => Asset::factory()->laptopMbp()->create()],+ 'Asset checked out to location' => [fn () => Location::factory()->create()],];}public static function licenseCheckInTargets(): array{return [- 'License checked out to user' => [fn() => User::factory()->create()],- 'License checked out to asset' => [fn() => Asset::factory()->laptopMbp()->create()],+ 'License checked out to user' => [fn () => User::factory()->create()],+ 'License checked out to asset' => [fn () => Asset::factory()->laptopMbp()->create()],];}- public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled()+ public function test_accessory_checkin_sends_slack_notification_when_setting_enabled(){$this->settings->enableSlackWebhook();@@ -60,7 +60,7 @@ class SlackNotificationsUponCheckinTest extends TestCase$this->assertSlackNotificationSent(CheckinAccessoryNotification::class);}- public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled()+ public function test_accessory_checkin_does_not_send_slack_notification_when_setting_disabled(){$this->settings->disableSlackWebhook();@@ -73,7 +73,7 @@ class SlackNotificationsUponCheckinTest extends TestCase}#[DataProvider('assetCheckInTargets')]- public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)+ public function test_asset_checkin_sends_slack_notification_when_setting_enabled($checkoutTarget){$this->settings->enableSlackWebhook();@@ -86,7 +86,7 @@ class SlackNotificationsUponCheckinTest extends TestCase}#[DataProvider('assetCheckInTargets')]- public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)+ public function test_asset_checkin_does_not_send_slack_notification_when_setting_disabled($checkoutTarget){$this->settings->disableSlackWebhook();@@ -97,8 +97,9 @@ class SlackNotificationsUponCheckinTest extends TestCase$this->assertNoSlackNotificationSent(CheckinAssetNotification::class);}+#[DataProvider('assetCheckInTargets')]- public function testComponentCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)+ public function test_component_checkin_sends_slack_notification_when_setting_enabled($checkoutTarget){$this->settings->enableSlackWebhook();@@ -111,7 +112,7 @@ class SlackNotificationsUponCheckinTest extends TestCase}#[DataProvider('assetCheckInTargets')]- public function testComponentCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)+ public function test_component_checkin_does_not_send_slack_notification_when_setting_disabled($checkoutTarget){$this->settings->disableSlackWebhook();@@ -123,7 +124,7 @@ class SlackNotificationsUponCheckinTest extends TestCase$this->assertNoSlackNotificationSent(CheckinComponentNotification::class);}- public function testSlackNotificationIsStillSentWhenCategoryEmailIsNotSetToSendEmails()+ public function test_slack_notification_is_still_sent_when_category_email_is_not_set_to_send_emails(){$this->settings->enableSlackWebhook();@@ -145,7 +146,7 @@ class SlackNotificationsUponCheckinTest extends TestCase}#[DataProvider('licenseCheckInTargets')]- public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)+ public function test_license_checkin_sends_slack_notification_when_setting_enabled($checkoutTarget){$this->settings->enableSlackWebhook();@@ -158,7 +159,7 @@ class SlackNotificationsUponCheckinTest extends TestCase}#[DataProvider('licenseCheckInTargets')]- public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)+ public function test_license_checkin_does_not_send_slack_notification_when_setting_disabled($checkoutTarget){$this->settings->disableSlackWebhook();diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.phpindex 908acddf3b..5bbfb77dcb 100644--- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php+++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php@@ -2,15 +2,11 @@namespace Tests\Feature\Notifications\Webhooks;-use App\Models\AssetModel;-use App\Models\Category;-use App\Notifications\CheckoutComponentNotification;-use Illuminate\Support\Facades\Mail;-use PHPUnit\Framework\Attributes\DataProvider;-use PHPUnit\Framework\Attributes\Group;use App\Events\CheckoutableCheckedOut;use App\Models\Accessory;use App\Models\Asset;+use App\Models\AssetModel;+use App\Models\Category;use App\Models\Component;use App\Models\Consumable;use App\Models\LicenseSeat;@@ -18,10 +14,14 @@ use App\Models\Location;use App\Models\User;use App\Notifications\CheckoutAccessoryNotification;use App\Notifications\CheckoutAssetNotification;+use App\Notifications\CheckoutComponentNotification;use App\Notifications\CheckoutConsumableNotification;use App\Notifications\CheckoutLicenseSeatNotification;use Illuminate\Database\Eloquent\Model;+use Illuminate\Support\Facades\Mail;use Illuminate\Support\Facades\Notification;+use PHPUnit\Framework\Attributes\DataProvider;+use PHPUnit\Framework\Attributes\Group;use Tests\TestCase;#[Group('notifications')]@@ -38,21 +38,21 @@ class SlackNotificationsUponCheckoutTest extends TestCasepublic static function assetCheckoutTargets(): array{return [- 'Asset checked out to user' => [fn() => User::factory()->create(['email' => null])],- 'Asset checked out to asset' => [fn() => Asset::factory()->laptopMbp()->create()],- 'Asset checked out to location' => [fn() => Location::factory()->create()],+ 'Asset checked out to user' => [fn () => User::factory()->create(['email' => null])],+ 'Asset checked out to asset' => [fn () => Asset::factory()->laptopMbp()->create()],+ 'Asset checked out to location' => [fn () => Location::factory()->create()],];}public static function licenseCheckoutTargets(): array{return [- 'License checked out to user' => [fn() => User::factory()->create(['email' => null])],- 'License checked out to asset' => [fn() => Asset::factory()->laptopMbp()->create()],+ 'License checked out to user' => [fn () => User::factory()->create(['email' => null])],+ 'License checked out to asset' => [fn () => Asset::factory()->laptopMbp()->create()],];}- public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled()+ public function test_accessory_checkout_sends_slack_notification_when_setting_enabled(){$this->settings->enableSlackWebhook();@@ -64,7 +64,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase$this->assertSlackNotificationSent(CheckoutAccessoryNotification::class);}- public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()+ public function test_accessory_checkout_does_not_send_slack_notification_when_setting_disabled(){$this->settings->disableSlackWebhook();@@ -77,7 +77,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase}#[DataProvider('assetCheckoutTargets')]- public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)+ public function test_asset_checkout_sends_slack_notification_when_setting_enabled($checkoutTarget){$this->settings->enableSlackWebhook();@@ -90,7 +90,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase}#[DataProvider('assetCheckoutTargets')]- public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)+ public function test_asset_checkout_does_not_send_slack_notification_when_setting_disabled($checkoutTarget){$this->settings->disableSlackWebhook();@@ -101,8 +101,9 @@ class SlackNotificationsUponCheckoutTest extends TestCase$this->assertNoSlackNotificationSent(CheckoutAssetNotification::class);}+#[DataProvider('assetCheckoutTargets')]- public function testComponentCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)+ public function test_component_checkout_sends_slack_notification_when_setting_enabled($checkoutTarget){$this->settings->enableSlackWebhook();$component = Component::factory()->create([@@ -120,7 +121,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase}#[DataProvider('assetCheckoutTargets')]- public function testComponentCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)+ public function test_component_checkout_does_not_send_slack_notification_when_setting_disabled($checkoutTarget){$this->settings->disableSlackWebhook();$component = Component::factory()->create([@@ -136,7 +137,8 @@ class SlackNotificationsUponCheckoutTest extends TestCase$this->assertNoSlackNotificationSent(CheckoutComponentNotification::class);}- public function testSlackNotificationIsStillSentWhenCategoryEmailIsNotSetToSendEmails()++ public function test_slack_notification_is_still_sent_when_category_email_is_not_set_to_send_emails(){$this->settings->enableSlackWebhook();@@ -157,7 +159,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase$this->assertSlackNotificationSent(CheckoutAssetNotification::class);}- public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled()+ public function test_consumable_checkout_sends_slack_notification_when_setting_enabled(){$this->settings->enableSlackWebhook();@@ -169,7 +171,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase$this->assertSlackNotificationSent(CheckoutConsumableNotification::class);}- public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()+ public function test_consumable_checkout_does_not_send_slack_notification_when_setting_disabled(){$this->settings->disableSlackWebhook();@@ -182,7 +184,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase}#[DataProvider('licenseCheckoutTargets')]- public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)+ public function test_license_checkout_sends_slack_notification_when_setting_enabled($checkoutTarget){$this->settings->enableSlackWebhook();@@ -195,7 +197,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase}#[DataProvider('licenseCheckoutTargets')]- public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)+ public function test_license_checkout_does_not_send_slack_notification_when_setting_disabled($checkoutTarget){$this->settings->disableSlackWebhook();diff --git a/tests/Feature/PredefinedKits/Api/DeletePredefinedKitsTest.php b/tests/Feature/PredefinedKits/Api/DeletePredefinedKitsTest.phpindex 4722af912a..57941e03e8 100644--- a/tests/Feature/PredefinedKits/Api/DeletePredefinedKitsTest.php+++ b/tests/Feature/PredefinedKits/Api/DeletePredefinedKitsTest.php@@ -21,7 +21,7 @@ class DeletePredefinedKitsTest extends TestCase implements TestsPermissionsRequi$this->assertDatabaseHas('kits', ['id' => $predefinedKit->id]);}- public function testCanDeletePredefinedKits()+ public function test_can_delete_predefined_kits(){$predefinedKit = PredefinedKit::factory()->create();@@ -33,7 +33,7 @@ class DeletePredefinedKitsTest extends TestCase implements TestsPermissionsRequi$this->assertDatabaseMissing('kits', ['id' => $predefinedKit->id]);}- public function testAssociatedDataDetachedWhenPredefinedKitDeleted()+ public function test_associated_data_detached_when_predefined_kit_deleted(){$predefinedKit = PredefinedKit::factory()->hasAccessories()diff --git a/tests/Feature/PredefinedKits/Ui/CreatePredefinedKitTest.php b/tests/Feature/PredefinedKits/Ui/CreatePredefinedKitTest.phpindex 0f958f66f8..9a037175df 100644--- a/tests/Feature/PredefinedKits/Ui/CreatePredefinedKitTest.php+++ b/tests/Feature/PredefinedKits/Ui/CreatePredefinedKitTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class CreatePredefinedKitTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('kits.create'))diff --git a/tests/Feature/PredefinedKits/Ui/IndexPredefinedKitsTest.php b/tests/Feature/PredefinedKits/Ui/IndexPredefinedKitsTest.phpindex 844e804f68..b99a6f892a 100644--- a/tests/Feature/PredefinedKits/Ui/IndexPredefinedKitsTest.php+++ b/tests/Feature/PredefinedKits/Ui/IndexPredefinedKitsTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class IndexPredefinedKitsTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('kits.index'))diff --git a/tests/Feature/PredefinedKits/Ui/ShowPredefinedKitTest.php b/tests/Feature/PredefinedKits/Ui/ShowPredefinedKitTest.phpindex 16d730831c..2a0e9e7a9b 100644--- a/tests/Feature/PredefinedKits/Ui/ShowPredefinedKitTest.php+++ b/tests/Feature/PredefinedKits/Ui/ShowPredefinedKitTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowPredefinedKitTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('kits.show', PredefinedKit::factory()->create()->id))diff --git a/tests/Feature/PredefinedKits/Ui/UpdatePredefinedKitTest.php b/tests/Feature/PredefinedKits/Ui/UpdatePredefinedKitTest.phpindex 6eb97471fb..e09d0a1f27 100644--- a/tests/Feature/PredefinedKits/Ui/UpdatePredefinedKitTest.php+++ b/tests/Feature/PredefinedKits/Ui/UpdatePredefinedKitTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class UpdatePredefinedKitTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('kits.edit', PredefinedKit::factory()->create()->id))diff --git a/tests/Feature/Redirects/ModelNotFoundRedirectTest.php b/tests/Feature/Redirects/ModelNotFoundRedirectTest.phpindex 59180cbdb0..9ef88442ff 100644--- a/tests/Feature/Redirects/ModelNotFoundRedirectTest.php+++ b/tests/Feature/Redirects/ModelNotFoundRedirectTest.php@@ -7,42 +7,42 @@ use Tests\TestCase;class ModelNotFoundRedirectTest extends TestCase{- public function testHandlesAsset404()+ public function test_handles_asset404(){$this->actingAs(User::factory()->viewAssets()->create())->get(route('hardware.checkout.create', 9999))->assertRedirectToRoute('hardware.index');}- public function testHandlesMaintenance404()+ public function test_handles_maintenance404(){$this->actingAs(User::factory()->viewAssets()->create())->get(route('maintenances.show', 9999))->assertRedirectToRoute('maintenances.index');}- public function testHandlesAssetModel404()+ public function test_handles_asset_model404(){$this->actingAs(User::factory()->viewAssetModels()->create())->get(route('models.show', 9999))->assertRedirectToRoute('models.index');}- public function testHandlesLicenseSeat404()+ public function test_handles_license_seat404(){$this->actingAs(User::factory()->viewLicenses()->create())->get(route('licenses.checkin', 9999))->assertRedirectToRoute('licenses.index');}- public function testHandlesPredefinedKit404()+ public function test_handles_predefined_kit404(){$this->actingAs(User::factory()->viewPredefinedKits()->create())->get(route('kits.show', 9999))->assertRedirectToRoute('kits.index');}- public function testHandlesReportTemplate404()+ public function test_handles_report_template404(){$this->actingAs(User::factory()->canViewReports()->create())->get(route('report-templates.show', 9999))diff --git a/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php b/tests/Feature/ReportTemplates/DeleteReportTemplateTest.phpindex 8ccbe9a17e..f667155bfe 100644--- a/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php@@ -22,7 +22,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->assertNotSoftDeleted($reportTemplate);}- public function testCannotDeleteAnotherUsersReportTemplate()+ public function test_cannot_delete_another_users_report_template(){$reportTemplate = ReportTemplate::factory()->create();@@ -34,7 +34,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->assertNotSoftDeleted($reportTemplate);}- public function testCannotDeleteAnotherUsersSharedReportTemplate()+ public function test_cannot_delete_another_users_shared_report_template(){$reportTemplate = ReportTemplate::factory()->shared()->create();@@ -46,7 +46,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->assertNotSoftDeleted($reportTemplate);}- public function testCanDeleteAReportTemplate()+ public function test_can_delete_a_report_template(){$user = User::factory()->canViewReports()->create();$reportTemplate = ReportTemplate::factory()->for($user, 'creator')->create();diff --git a/tests/Feature/ReportTemplates/EditReportTemplateTest.php b/tests/Feature/ReportTemplates/EditReportTemplateTest.phpindex cfdf8aa048..63d1eed90b 100644--- a/tests/Feature/ReportTemplates/EditReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/EditReportTemplateTest.php@@ -18,7 +18,7 @@ class EditReportTemplateTest extends TestCase implements TestsPermissionsRequire->assertRedirectToRoute('reports/custom');}- public function testCannotLoadEditPageForAnotherUsersReportTemplate()+ public function test_cannot_load_edit_page_for_another_users_report_template(){$user = User::factory()->canViewReports()->create();$reportTemplate = ReportTemplate::factory()->create();@@ -28,7 +28,7 @@ class EditReportTemplateTest extends TestCase implements TestsPermissionsRequire->assertRedirectToRoute('reports/custom');}- public function testCannotLoadEditPageForAnotherUsersSharedReportTemplate()+ public function test_cannot_load_edit_page_for_another_users_shared_report_template(){$user = User::factory()->canViewReports()->create();$reportTemplate = ReportTemplate::factory()->shared()->create();@@ -38,7 +38,7 @@ class EditReportTemplateTest extends TestCase implements TestsPermissionsRequire->assertRedirectToRoute('report-templates.show', $reportTemplate->id);}- public function testCanLoadEditReportTemplatePage()+ public function test_can_load_edit_report_template_page(){$user = User::factory()->canViewReports()->create();$reportTemplate = ReportTemplate::factory()->for($user, 'creator')->create();diff --git a/tests/Feature/ReportTemplates/ShowReportTemplateTest.php b/tests/Feature/ReportTemplates/ShowReportTemplateTest.phpindex 47d314d8bb..a10e335b56 100644--- a/tests/Feature/ReportTemplates/ShowReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/ShowReportTemplateTest.php@@ -18,7 +18,7 @@ class ShowReportTemplateTest extends TestCase implements TestsPermissionsRequire->assertRedirectToRoute('reports/custom');}- public function testCanLoadASavedReportTemplate()+ public function test_can_load_a_saved_report_template(){$user = User::factory()->canViewReports()->create();$reportTemplate = ReportTemplate::factory()->make(['name' => 'My Awesome Template']);@@ -32,17 +32,17 @@ class ShowReportTemplateTest extends TestCase implements TestsPermissionsRequire}]);}- public function testCannotLoadAnotherUsersSavedReportTemplateIfNotShared()+ public function test_cannot_load_another_users_saved_report_template_if_not_shared(){$reportTemplate = ReportTemplate::factory()->create();$this->actingAs(User::factory()->canViewReports()->create())->get(route('report-templates.show', $reportTemplate))->assertRedirectToRoute('reports/custom')- ->assertSessionHas('error', trans('general.generic_model_not_found', ['model' => 'report template']));;+ ->assertSessionHas('error', trans('general.generic_model_not_found', ['model' => 'report template']));}- public function testCanLoadAnotherUsersSavedReportTemplateIfShared()+ public function test_can_load_another_users_saved_report_template_if_shared(){$user = User::factory()->canViewReports()->create();$reportTemplate = ReportTemplate::factory()->shared()->make(['name' => 'My Awesome Template']);@@ -54,7 +54,7 @@ class ShowReportTemplateTest extends TestCase implements TestsPermissionsRequire->assertViewHas(['template' => function (ReportTemplate $templatePassedToView) use ($reportTemplate) {return $templatePassedToView->is($reportTemplate);- }+ },]);}}diff --git a/tests/Feature/ReportTemplates/StoreReportTemplateTest.php b/tests/Feature/ReportTemplates/StoreReportTemplateTest.phpindex 1acd6bb7c6..87391e7bbc 100644--- a/tests/Feature/ReportTemplates/StoreReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/StoreReportTemplateTest.php@@ -18,7 +18,7 @@ class StoreReportTemplateTest extends TestCase implements TestsPermissionsRequir->assertForbidden();}- public function testSavingReportTemplateRequiresValidFields()+ public function test_saving_report_template_requires_valid_fields(){$this->actingAs(User::factory()->canViewReports()->create())->post(route('report-templates.store'), [@@ -27,7 +27,7 @@ class StoreReportTemplateTest extends TestCase implements TestsPermissionsRequir->assertSessionHasErrors('name');}- public function testRedirectingAfterValidationErrorRestoresInputs()+ public function test_redirecting_after_validation_error_restores_inputs(){$this->actingAs(User::factory()->canViewReports()->create())// start on the custom report page@@ -37,13 +37,13 @@ class StoreReportTemplateTest extends TestCase implements TestsPermissionsRequir'name' => '',// set some values to ensure they are still present// when returning to the custom report page.- 'by_company_id' => [2, 3]+ 'by_company_id' => [2, 3],])->assertViewHas(['template' => function (ReportTemplate $reportTemplate) {return data_get($reportTemplate, 'options.by_company_id') === [2, 3];}]);}- public function testCanSaveAReportTemplate()+ public function test_can_save_a_report_template(){$user = User::factory()->canViewReports()->create();diff --git a/tests/Feature/ReportTemplates/UpdateReportTemplateTest.php b/tests/Feature/ReportTemplates/UpdateReportTemplateTest.phpindex 3d5c1c0408..30cd1f7f94 100644--- a/tests/Feature/ReportTemplates/UpdateReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/UpdateReportTemplateTest.php@@ -18,7 +18,7 @@ class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequi->assertStatus(302);}- public function testCannotUpdateAnotherUsersReportTemplate()+ public function test_cannot_update_another_users_report_template(){$reportTemplate = ReportTemplate::factory()->create(['name' => 'Original']);@@ -32,7 +32,7 @@ class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->assertEquals('Original', $reportTemplate->fresh()->name);}- public function testCannotUpdateAnotherUsersSharedReportTemplate()+ public function test_cannot_update_another_users_shared_report_template(){$reportTemplate = ReportTemplate::factory()->shared()->create(['name' => 'Original']);@@ -47,7 +47,7 @@ class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->assertEquals('Original', $reportTemplate->fresh()->name);}- public function testUpdatingReportTemplateRequiresValidFields()+ public function test_updating_report_template_requires_valid_fields(){$user = User::factory()->canViewReports()->create();@@ -62,7 +62,7 @@ class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequi]);}- public function testCanUpdateAReportTemplate()+ public function test_can_update_a_report_template(){$user = User::factory()->canViewReports()->create();@@ -93,7 +93,7 @@ class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->assertEquals([3], $reportTemplate->selectValues('by_company_id'));}- public function testCanUpdateAReportTemplateWithTheSameName()+ public function test_can_update_a_report_template_with_the_same_name(){$user = User::factory()->canViewReports()->create();@@ -116,7 +116,7 @@ class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequi->assertSessionDoesntHaveErrors();}- public function testCanShareAReportTemplate()+ public function test_can_share_a_report_template(){$user = User::factory()->canViewReports()->create();diff --git a/tests/Feature/Reporting/ActivityReportTest.php b/tests/Feature/Reporting/ActivityReportTest.phpindex e094f86b6e..dd97a060e4 100644--- a/tests/Feature/Reporting/ActivityReportTest.php+++ b/tests/Feature/Reporting/ActivityReportTest.php@@ -2,27 +2,23 @@namespace Tests\Feature\Reporting;+use App\Models\Actionlog;use App\Models\Asset;use App\Models\Company;use App\Models\User;-use App\Models\Actionlog;-use Database\Factories\ActionlogFactory;use Illuminate\Testing\Fluent\AssertableJson;-use Illuminate\Testing\TestResponse;-use League\Csv\Reader;-use PHPUnit\Framework\Assert;use Tests\TestCase;class ActivityReportTest extends TestCase{- public function testRequiresPermissionToViewActivity()+ public function test_requires_permission_to_view_activity(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.activity.index'))->assertForbidden();}- public function testRecordsAreScopedToCompanyWhenMultipleCompanySupportEnabled()+ public function test_records_are_scoped_to_company_when_multiple_company_support_enabled(){$this->markTestIncomplete('This test returns strange results. Need to figure out why.');$this->settings->enableMultipleFullCompanySupport();@@ -60,8 +56,7 @@ class ActivityReportTest extends TestCase->assertJsonStructure(['rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 5)->etc());-+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 5)->etc());$this->actingAsForApi($userInCompanyB)->getJson(@@ -70,12 +65,7 @@ class ActivityReportTest extends TestCase->assertJsonStructure(['rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 7)->etc());----+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 7)->etc());}-}diff --git a/tests/Feature/Reporting/CustomReportTest.php b/tests/Feature/Reporting/CustomReportTest.phpindex 6e33e2a355..2a1882831f 100644--- a/tests/Feature/Reporting/CustomReportTest.php+++ b/tests/Feature/Reporting/CustomReportTest.php@@ -55,7 +55,7 @@ class CustomReportTest extends TestCase implements TestsPermissionsRequirement->assertForbidden();}- public function testCanLoadCustomReportPage()+ public function test_can_load_custom_report_page(){$this->actingAs(User::factory()->canViewReports()->create())->get(route('reports/custom'))@@ -64,11 +64,11 @@ class CustomReportTest extends TestCase implements TestsPermissionsRequirement'template' => function (ReportTemplate $template) {// the view should have an empty report by defaultreturn $template->exists() === false;- }+ },]);}- public function testSavedTemplatesOnPageAreScopedToTheUser()+ public function test_saved_templates_on_page_are_scoped_to_the_user(){// Given there is a saved template for one userReportTemplate::factory()->create(['name' => 'Report A']);@@ -84,12 +84,11 @@ class CustomReportTest extends TestCase implements TestsPermissionsRequirement->assertViewHas(['report_templates' => function (Collection $reports) {return $reports->pluck('name')->doesntContain('Report A');- }+ },]);}-- public function testCustomAssetReport()+ public function test_custom_asset_report(){Asset::factory()->create(['name' => 'Asset A']);Asset::factory()->create(['name' => 'Asset B']);@@ -105,7 +104,7 @@ class CustomReportTest extends TestCase implements TestsPermissionsRequirement->assertSeeTextInStreamedResponse('Asset B');}- public function testCustomAssetReportAdheresToCompanyScoping()+ public function test_custom_asset_report_adheres_to_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();@@ -151,7 +150,7 @@ class CustomReportTest extends TestCase implements TestsPermissionsRequirement->assertSeeTextInStreamedResponse('Asset B');}- public function testCanLimitAssetsByLastCheckIn()+ public function test_can_limit_assets_by_last_check_in(){Asset::factory()->create(['name' => 'Asset A', 'last_checkin' => '2023-08-01']);Asset::factory()->create(['name' => 'Asset B', 'last_checkin' => '2023-08-02']);diff --git a/tests/Feature/Reporting/UnacceptedAssetReportTest.php b/tests/Feature/Reporting/UnacceptedAssetReportTest.phpindex b3ec0b2e0b..738e68e5ca 100644--- a/tests/Feature/Reporting/UnacceptedAssetReportTest.php+++ b/tests/Feature/Reporting/UnacceptedAssetReportTest.php@@ -2,8 +2,6 @@namespace Tests\Feature\Reporting;-use App\Models\Asset;-use App\Models\Company;use App\Models\User;use Illuminate\Testing\TestResponse;use League\Csv\Reader;@@ -43,19 +41,17 @@ class UnacceptedAssetReportTest extends TestCase);}-- public function testPermissionRequiredToViewUnacceptedAssetReport()+ public function test_permission_required_to_view_unaccepted_asset_report(){$this->actingAs(User::factory()->create())->get(route('reports/unaccepted_assets'))->assertForbidden();}- public function testUserCanListUnacceptedAssets()+ public function test_user_can_list_unaccepted_assets(){$this->actingAs(User::factory()->superuser()->create())->get(route('reports/unaccepted_assets'))->assertOk();}-}diff --git a/tests/Feature/Settings/AlertsSettingTest.php b/tests/Feature/Settings/AlertsSettingTest.phpindex f8829d3825..97267978f1 100644--- a/tests/Feature/Settings/AlertsSettingTest.php+++ b/tests/Feature/Settings/AlertsSettingTest.php@@ -2,20 +2,19 @@namespace Tests\Feature\Settings;-use Tests\TestCase;use App\Models\User;-+use Tests\TestCase;class AlertsSettingTest extends TestCase{- public function testPermissionRequiredToViewAlertSettings()+ public function test_permission_required_to_view_alert_settings(){$this->actingAs(User::factory()->create())->get(route('settings.alerts.index'))->assertForbidden();}- public function testAdminCCEmailArrayCanBeSaved()+ public function test_admin_cc_email_array_can_be_saved(){$response = $this->actingAs(User::factory()->superuser()->create())->post(route('settings.alerts.save', [diff --git a/tests/Feature/Settings/BrandingSettingsTest.php b/tests/Feature/Settings/BrandingSettingsTest.phpindex 2cb052437c..4dc1a5935c 100644--- a/tests/Feature/Settings/BrandingSettingsTest.php+++ b/tests/Feature/Settings/BrandingSettingsTest.php@@ -2,16 +2,15 @@namespace Tests\Feature\Settings;-use Tests\TestCase;+use App\Models\Setting;+use App\Models\User;use Illuminate\Http\UploadedFile;use Illuminate\Support\Facades\Storage;-use App\Models\User;-use App\Models\Setting;-+use Tests\TestCase;class BrandingSettingsTest extends TestCase{- public function testSiteNameIsRequired()+ public function test_site_name_is_required(){$response = $this->actingAs(User::factory()->superuser()->create())->from(route('settings.branding.index'))@@ -24,7 +23,7 @@ class BrandingSettingsTest extends TestCase$this->followRedirects($response)->assertSee(trans('general.error'));}- public function testSiteNameCanBeSaved()+ public function test_site_name_can_be_saved(){$response = $this->actingAs(User::factory()->superuser()->create())->post(route('settings.branding.save', ['site_name' => 'My Awesome Site']))@@ -36,8 +35,7 @@ class BrandingSettingsTest extends TestCase$this->followRedirects($response)->assertSee('alert-success');}-- public function testLogoCanBeUploaded()+ public function test_logo_can_be_uploaded(){Storage::fake('public');$setting = Setting::factory()->create(['logo' => null]);@@ -52,15 +50,14 @@ class BrandingSettingsTest extends TestCase->assertSessionHasNoErrors();// Assert files was stored...- Storage::disk('public')->assertExists( $setting->logo);+ Storage::disk('public')->assertExists($setting->logo);$this->followRedirects($response)->assertSee('alert-success');$setting->refresh();}-- public function testLogoCanBeDeleted()+ public function test_logo_can_be_deleted(){Storage::fake('public');@@ -84,7 +81,7 @@ class BrandingSettingsTest extends TestCaseStorage::disk('public')->assertMissing($setting->logo);}- public function testEmailLogoCanBeUploaded()+ public function test_email_logo_can_be_uploaded(){Storage::fake('public');Setting::factory()->create(['email_logo' => null]);@@ -93,7 +90,7 @@ class BrandingSettingsTest extends TestCase->from(route('settings.branding.index'))->post(route('settings.branding.save',[- 'email_logo' => UploadedFile::fake()->image('new_test_email_logo.png')->storeAs('', 'new_test_email_logo.png', 'public')+ 'email_logo' => UploadedFile::fake()->image('new_test_email_logo.png')->storeAs('', 'new_test_email_logo.png', 'public'),]))->assertValid('email_logo')@@ -105,7 +102,7 @@ class BrandingSettingsTest extends TestCaseStorage::disk('public')->assertExists('new_test_email_logo.png');}- public function testEmailLogoCanBeDeleted()+ public function test_email_logo_can_be_deleted(){Storage::fake('public');UploadedFile::fake()->image('new_test_logo.png')->storeAs('uploads', 'new_test_logo.png', 'public');@@ -131,8 +128,7 @@ class BrandingSettingsTest extends TestCase}-- public function testLabelLogoCanBeUploaded()+ public function test_label_logo_can_be_uploaded(){Storage::fake('public');@@ -146,7 +142,7 @@ class BrandingSettingsTest extends TestCase->from(route('settings.branding.index'))->post(route('settings.branding.save',[- 'label_logo' => UploadedFile::fake()->image('new_test_label_logo.png')->storeAs('', 'new_test_label_logo.png', 'public')+ 'label_logo' => UploadedFile::fake()->image('new_test_label_logo.png')->storeAs('', 'new_test_label_logo.png', 'public'),]))->assertValid('label_logo')@@ -158,10 +154,9 @@ class BrandingSettingsTest extends TestCaseStorage::disk('public')->assertExists('new_test_label_logo.png');// Storage::disk('public')->assertMissing($original_file);-}- public function testLabelLogoCanBeDeleted()+ public function test_label_logo_can_be_deleted(){Storage::fake('public');@@ -187,7 +182,7 @@ class BrandingSettingsTest extends TestCase}- public function testDefaultAvatarCanBeUploaded()+ public function test_default_avatar_can_be_uploaded(){Storage::fake('public');@@ -195,7 +190,7 @@ class BrandingSettingsTest extends TestCase->from(route('settings.branding.index'))->post(route('settings.branding.save',[- 'default_avatar' => UploadedFile::fake()->image('default_avatar.png')->storeAs('', 'default_avatar.png', 'public')+ 'default_avatar' => UploadedFile::fake()->image('default_avatar.png')->storeAs('', 'default_avatar.png', 'public'),]))->assertValid('default_avatar')@@ -209,7 +204,7 @@ class BrandingSettingsTest extends TestCase// Storage::disk('public')->assertMissing($original_file);}- public function testDefaultAvatarCanBeDeleted()+ public function test_default_avatar_can_be_deleted(){Storage::fake('public');@@ -230,11 +225,11 @@ class BrandingSettingsTest extends TestCase$setting->refresh();$this->followRedirects($response)->assertSee(trans('alert-success'));- // $this->assertNull($setting->refresh()->default_avatar);+ // $this->assertNull($setting->refresh()->default_avatar);// Storage::disk('public')->assertMissing($original_file);}- public function testSnipeDefaultAvatarCanBeDeleted()+ public function test_snipe_default_avatar_can_be_deleted(){$setting = Setting::getSettings()->first();@@ -247,7 +242,6 @@ class BrandingSettingsTest extends TestCaseStorage::disk('public')->assertExists('avatars/default.png');-$this->actingAs(User::factory()->superuser()->create())->post(route('settings.branding.save',['clear_default_avatar' => '1']@@ -259,7 +253,7 @@ class BrandingSettingsTest extends TestCase}- public function testFaviconCanBeUploaded()+ public function test_favicon_can_be_uploaded(){$this->markTestIncomplete('This fails mimetype validation on the mock');Storage::fake('public');@@ -268,7 +262,7 @@ class BrandingSettingsTest extends TestCase->from(route('settings.branding.index'))->post(route('settings.branding.save',[- 'favicon' =>UploadedFile::fake()->image('favicon.svg')->storeAs('', 'favicon.svg', 'public')+ 'favicon' => UploadedFile::fake()->image('favicon.svg')->storeAs('', 'favicon.svg', 'public'),]))->assertValid('favicon')@@ -280,7 +274,7 @@ class BrandingSettingsTest extends TestCaseStorage::disk('public')->assertExists('favicon.png');}- public function testFaviconCanBeDeleted()+ public function test_favicon_can_be_deleted(){$this->markTestIncomplete('This fails mimetype validation on the mock');Storage::fake('public');@@ -306,7 +300,4 @@ class BrandingSettingsTest extends TestCase// This fails for some reason - the file is not being deleted, or at least the test doesn't think it is// Storage::disk('public')->assertMissing('favicon.png');}---}diff --git a/tests/Feature/Settings/LabelSettingTest.php b/tests/Feature/Settings/LabelSettingTest.phpindex e96c684a89..7258034c95 100644--- a/tests/Feature/Settings/LabelSettingTest.php+++ b/tests/Feature/Settings/LabelSettingTest.php@@ -2,17 +2,15 @@namespace Tests\Feature\Settings;-use Tests\TestCase;use App\Models\User;-+use Tests\TestCase;class LabelSettingTest extends TestCase{- public function testPermissionRequiredToViewLabelSettings()+ public function test_permission_required_to_view_label_settings(){$this->actingAs(User::factory()->create())->get(route('settings.labels.index'))->assertForbidden();}-}diff --git a/tests/Feature/Settings/LdapSettingsTest.php b/tests/Feature/Settings/LdapSettingsTest.phpindex 6d690fd89b..d9c7b0a335 100644--- a/tests/Feature/Settings/LdapSettingsTest.php+++ b/tests/Feature/Settings/LdapSettingsTest.php@@ -2,20 +2,19 @@namespace Tests\Feature\Settings;-use Tests\TestCase;use App\Models\User;-+use Tests\TestCase;class LdapSettingsTest extends TestCase{- public function testPermissionRequiredToViewLdapSettings()+ public function test_permission_required_to_view_ldap_settings(){$this->actingAs(User::factory()->create())->get(route('settings.ldap.index'))->assertForbidden();}- public function testLdapSettingsCanBeSaved()+ public function test_ldap_settings_can_be_saved(){$response = $this->actingAs(User::factory()->superuser()->create())->post(route('settings.ldap.save', [@@ -37,7 +36,7 @@ class LdapSettingsTest extends TestCase$this->followRedirects($response)->assertSee('alert-success');}- public function testLdapSettingsAreValidatedCorrectly()+ public function test_ldap_settings_are_validated_correctly(){$response = $this->actingAs(User::factory()->superuser()->create())->from(route('settings.ldap.index'))@@ -57,5 +56,4 @@ class LdapSettingsTest extends TestCase]);$this->followRedirects($response)->assertSee('alert-danger');}-}diff --git a/tests/Feature/Settings/SecuritySettingTest.php b/tests/Feature/Settings/SecuritySettingTest.phpindex 6edeee673b..2cfee68b2f 100644--- a/tests/Feature/Settings/SecuritySettingTest.php+++ b/tests/Feature/Settings/SecuritySettingTest.php@@ -2,17 +2,15 @@namespace Tests\Feature\Settings;-use Tests\TestCase;use App\Models\User;-+use Tests\TestCase;class SecuritySettingTest extends TestCase{- public function testPermissionRequiredToViewSecuritySettings()+ public function test_permission_required_to_view_security_settings(){$this->actingAs(User::factory()->create())->get(route('settings.security.index'))->assertForbidden();}-}diff --git a/tests/Feature/Settings/ShowSetUpPageTest.php b/tests/Feature/Settings/ShowSetUpPageTest.phpindex fe071491e8..134a892af2 100644--- a/tests/Feature/Settings/ShowSetUpPageTest.php+++ b/tests/Feature/Settings/ShowSetUpPageTest.php@@ -2,7 +2,6 @@namespace Tests\Feature\Settings;-use PHPUnit\Framework\Attributes\DataProvider;use App\Http\Controllers\SettingsController;use Illuminate\Database\Events\QueryExecuted;use Illuminate\Http\Client\ConnectionException;@@ -17,12 +16,13 @@ use Illuminate\Support\Facades\Log;use Illuminate\Support\Facades\URL;use Illuminate\Testing\TestResponse;use PDOException;+use PHPUnit\Framework\Attributes\DataProvider;use Tests\TestCase;class ShowSetUpPageTest extends TestCase{+ public static ?TestResponse $latestResponse;- static ?TestResponse $latestResponse;/*** We do not want to make actual http request on every test to check .env file* visibility because that can be really slow especially in some cases where an@@ -37,15 +37,16 @@ class ShowSetUpPageTest extends TestCase}self::$latestResponse = $this->get('/setup');+return self::$latestResponse;}- public function testView(): void+ public function test_view(): void{$this->getSetUpPageResponse()->assertOk()->assertViewIs('setup.index');}- public function testWillShowErrorMessageWhenDatabaseConnectionCannotBeEstablished(): void+ public function test_will_show_error_message_when_database_connection_cannot_be_established(): void{Event::listen(function (QueryExecuted $query) {if ($query->sql === 'select 2 + 2') {@@ -65,20 +66,21 @@ class ShowSetUpPageTest extends TestCaseif ($shouldSee) {self::$latestResponse->assertSee($errorMessage, false)->assertDontSee($successMessage, false);+return;}self::$latestResponse->assertSee($successMessage, false)->assertDontSee($errorMessage, false);}- public function testWillNotShowErrorMessageWhenDatabaseIsConnected(): void+ public function test_will_not_show_error_message_when_database_is_connected(): void{$this->getSetUpPageResponse()->assertOk();$this->assertSeeDatabaseConnectionErrorMessage(false);}- public function testWillShowErrorMessageWhenDebugModeIsEnabledAndAppEnvironmentIsSetToProduction(): void+ public function test_will_show_error_message_when_debug_mode_is_enabled_and_app_environment_is_set_to_production(): void{config(['app.debug' => true]);@@ -96,13 +98,14 @@ class ShowSetUpPageTest extends TestCaseif ($shouldSee) {self::$latestResponse->assertSee($errorMessage, false)->assertDontSee($successMessage, false);+return;}self::$latestResponse->assertSee($successMessage, false)->assertDontSee($errorMessage, false);}- public function testWillNotShowErrorWhenDebugModeIsEnabledAndAppEnvironmentIsSetToLocal(): void+ public function test_will_not_show_error_when_debug_mode_is_enabled_and_app_environment_is_set_to_local(): void{config(['app.debug' => true]);@@ -113,7 +116,7 @@ class ShowSetUpPageTest extends TestCase$this->assertSeeDebugModeMisconfigurationErrorMessage(false);}- public function testWillNotShowErrorWhenDebugModeIsDisabledAndAppEnvironmentIsSetToProduction(): void+ public function test_will_not_show_error_when_debug_mode_is_disabled_and_app_environment_is_set_to_production(): void{config(['app.debug' => false]);@@ -124,7 +127,7 @@ class ShowSetUpPageTest extends TestCase$this->assertSeeDebugModeMisconfigurationErrorMessage(false);}- public function testWillShowErrorWhenEnvironmentIsLocal(): void+ public function test_will_show_error_when_environment_is_local(): void{$this->app->bind('env', fn () => 'local');@@ -147,7 +150,7 @@ class ShowSetUpPageTest extends TestCaseself::$latestResponse->assertSee($successMessage, false)->assertDontSee($errorMessage, false);}- public function testWillNotShowErrorWhenEnvironmentIsProduction(): void+ public function test_will_not_show_error_when_environment_is_production(): void{$this->app->bind('env', fn () => 'production');@@ -156,19 +159,20 @@ class ShowSetUpPageTest extends TestCase$this->assertSeeEnvironmentMisconfigurationErrorMessage(false);}- public function testWillCheckDotEnvFileVisibility(): void+ public function test_will_check_dot_env_file_visibility(): void{$this->getSetUpPageResponse()->assertOk();Http::assertSent(function (Request $request) {$this->assertEquals('GET', $request->method());$this->assertEquals(URL::to('.env'), $request->url());+return true;});}#[DataProvider('willShowErrorWhenDotEnvFileIsAccessibleViaHttpData')]- public function testWillShowErrorWhenDotEnvFileIsAccessibleViaHttp(int $statusCode): void+ public function test_will_show_error_when_dot_env_file_is_accessible_via_http(int $statusCode): void{$this->preventStrayRequest = false;@@ -178,6 +182,7 @@ class ShowSetUpPageTest extends TestCaseHttp::assertSent(function (Request $request, Response $response) use ($statusCode) {$this->assertEquals($statusCode, $response->status());+return true;});@@ -205,14 +210,14 @@ class ShowSetUpPageTest extends TestCaseself::$latestResponse->assertSee($successMessage, false)->assertDontSee($errorMessage, false);}- public function testWillNotShowErrorWhenDotEnvFileIsNotAccessibleViaHttp(): void+ public function test_will_not_show_error_when_dot_env_file_is_not_accessible_via_http(): void{$this->getSetUpPageResponse()->assertOk();$this->assertSeeDotEnvFileExposedErrorMessage(false);}- public function testWillShowErrorWhenDotEnvFileVisibilityCheckRequestFails(): void+ public function test_will_show_error_when_dot_env_file_visibility_check_request_fails(): void{$this->preventStrayRequest = false;@@ -232,7 +237,7 @@ class ShowSetUpPageTest extends TestCase});}- public function testWillShowErrorMessageWhenAppUrlIsNotSameWithPageUrl(): void+ public function test_will_show_error_message_when_app_url_is_not_same_with_page_url(): void{config(['app.url' => 'http://www.github.com']);@@ -250,20 +255,21 @@ class ShowSetUpPageTest extends TestCaseif ($shouldSee) {self::$latestResponse->assertSee($errorMessage)->assertDontSee($successMessage);+return;}self::$latestResponse->assertSee($successMessage)->assertDontSee($errorMessage);}- public function testWillNotShowErrorMessageWhenAppUrlIsSameWithPageUrl(): void+ public function test_will_not_show_error_message_when_app_url_is_same_with_page_url(): void{$this->getSetUpPageResponse()->assertOk();$this->assertSeeAppUrlMisconfigurationErrorMessage(false);}- public function testWhenAppUrlContainsTrailingSlash(): void+ public function test_when_app_url_contains_trailing_slash(): void{config(['app.url' => 'http://www.github.com/']);@@ -272,7 +278,7 @@ class ShowSetUpPageTest extends TestCase$this->assertSeeAppUrlMisconfigurationErrorMessage();}- public function testWillSeeDirectoryPermissionErrorWhenStoragePathIsNotWritable(): void+ public function test_will_see_directory_permission_error_when_storage_path_is_not_writable(): void{File::shouldReceive('isWritable')->andReturn(false);@@ -290,13 +296,14 @@ class ShowSetUpPageTest extends TestCaseif ($shouldSee) {self::$latestResponse->assertSee($errorMessage, false)->assertDontSee($successMessage, false);+return;}- self::$latestResponse->assertSee($successMessage, false)->assertDontSee($errorMessage,false);+ self::$latestResponse->assertSee($successMessage, false)->assertDontSee($errorMessage, false);}- public function testWillNotSeeDirectoryPermissionErrorWhenStoragePathIsWritable(): void+ public function test_will_not_see_directory_permission_error_when_storage_path_is_writable(): void{File::shouldReceive('isWritable')->andReturn(true);@@ -305,10 +312,10 @@ class ShowSetUpPageTest extends TestCase$this->assertSeeDirectoryPermissionError(false);}- public function testInvalidTLSCertsOkWhenCheckingForEnvFile()+ public function test_invalid_tls_certs_ok_when_checking_for_env_file(){- //set the weird bad SSL cert place - https://self-signed.badssl.com- $this->markTestIncomplete("Not yet sure how to write this test, it requires messing with .env ...");- $this->assertTrue((new SettingsController())->dotEnvFileIsExposed());+ // set the weird bad SSL cert place - https://self-signed.badssl.com+ $this->markTestIncomplete('Not yet sure how to write this test, it requires messing with .env ...');+ $this->assertTrue((new SettingsController)->dotEnvFileIsExposed());}}diff --git a/tests/Feature/Setup/Ui/IndexSetupTest.php b/tests/Feature/Setup/Ui/IndexSetupTest.phpindex ee924eae54..113265403d 100644--- a/tests/Feature/Setup/Ui/IndexSetupTest.php+++ b/tests/Feature/Setup/Ui/IndexSetupTest.php@@ -7,13 +7,13 @@ use Tests\TestCase;class IndexSetupTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->get(route('setup'))->assertOk();}- public function testPageRedirectsIfNoRecordsFound()+ public function test_page_redirects_if_no_records_found(){$this->assertDatabaseEmpty('users');@@ -22,14 +22,16 @@ class IndexSetupTest extends TestCase->assertRedirectToRoute('setup');}- public function testPageRedirectsIfRecordsFound() {+ public function test_page_redirects_if_records_found()+ {$this->actingAs(User::factory()->superuser()->create())->get(route('setup'))->assertStatus(302)->assertRedirectToRoute('home');}- public function testMigrationPageRenders() {+ public function test_migration_page_renders()+ {$this->assertDatabaseEmpty('users');@@ -38,7 +40,8 @@ class IndexSetupTest extends TestCase}- public function testCreateFirstUserPageRenders() {+ public function test_create_first_user_page_renders()+ {$this->assertDatabaseEmpty('users');@@ -47,7 +50,8 @@ class IndexSetupTest extends TestCase}- public function testCreateFirstUserValidation() {+ public function test_create_first_user_validation()+ {$this->assertDatabaseEmpty('users');@@ -59,7 +63,8 @@ class IndexSetupTest extends TestCase}- public function testCreateFirstUserSaved() {+ public function test_create_first_user_saved()+ {$this->assertDatabaseEmpty('users');@@ -77,8 +82,6 @@ class IndexSetupTest extends TestCase->assertStatus(302)->assertSessionHas('success');--$this->assertDatabaseCount('users', 1);}diff --git a/tests/Feature/StatusLabels/Api/DeleteStatusLabelsTest.php b/tests/Feature/StatusLabels/Api/DeleteStatusLabelsTest.phpindex 9131eb3cde..dafb4091b2 100644--- a/tests/Feature/StatusLabels/Api/DeleteStatusLabelsTest.php+++ b/tests/Feature/StatusLabels/Api/DeleteStatusLabelsTest.php@@ -20,7 +20,7 @@ class DeleteStatusLabelsTest extends TestCase implements TestsPermissionsRequire$this->assertNotSoftDeleted($statusLabel);}- public function testCannotDeleteStatusLabelWhileStillAssociatedToAssets()+ public function test_cannot_delete_status_label_while_still_associated_to_assets(){$statusLabel = Statuslabel::factory()->hasAssets()->create();@@ -33,7 +33,7 @@ class DeleteStatusLabelsTest extends TestCase implements TestsPermissionsRequire$this->assertNotSoftDeleted($statusLabel);}- public function testCanDeleteStatusLabel()+ public function test_can_delete_status_label(){$statusLabel = Statuslabel::factory()->create();diff --git a/tests/Feature/StatusLabels/Ui/CreateStatusLabelTest.php b/tests/Feature/StatusLabels/Ui/CreateStatusLabelTest.phpindex 6312ea4e33..90580a95df 100644--- a/tests/Feature/StatusLabels/Ui/CreateStatusLabelTest.php+++ b/tests/Feature/StatusLabels/Ui/CreateStatusLabelTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class CreateStatusLabelTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('statuslabels.create'))diff --git a/tests/Feature/StatusLabels/Ui/IndexStatusLabelsTest.php b/tests/Feature/StatusLabels/Ui/IndexStatusLabelsTest.phpindex 97451666d0..e819def7ca 100644--- a/tests/Feature/StatusLabels/Ui/IndexStatusLabelsTest.php+++ b/tests/Feature/StatusLabels/Ui/IndexStatusLabelsTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class IndexStatusLabelsTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('statuslabels.index'))diff --git a/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.php b/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.phpindex 96e8d75528..e51e0a3f22 100644--- a/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.php+++ b/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowStatusLabelTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('statuslabels.show', Statuslabel::factory()->create()))diff --git a/tests/Feature/StatusLabels/Ui/UpdateStatusLabelTest.php b/tests/Feature/StatusLabels/Ui/UpdateStatusLabelTest.phpindex 6726637ea9..bc4aecaa58 100644--- a/tests/Feature/StatusLabels/Ui/UpdateStatusLabelTest.php+++ b/tests/Feature/StatusLabels/Ui/UpdateStatusLabelTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class UpdateStatusLabelTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('statuslabels.edit', Statuslabel::factory()->create()->id))diff --git a/tests/Feature/Suppliers/Api/DeleteSuppliersTest.php b/tests/Feature/Suppliers/Api/DeleteSuppliersTest.phpindex d2fee33ef2..9382223fb6 100644--- a/tests/Feature/Suppliers/Api/DeleteSuppliersTest.php+++ b/tests/Feature/Suppliers/Api/DeleteSuppliersTest.php@@ -21,7 +21,7 @@ class DeleteSuppliersTest extends TestCase implements TestsPermissionsRequiremen$this->assertNotSoftDeleted($supplier);}- public function testCannotDeleteSupplierWithDataStillAssociated()+ public function test_cannot_delete_supplier_with_data_still_associated(){$supplierWithAsset = Supplier::factory()->hasAssets()->create();$supplierWithMaintenance = Supplier::factory()->has(Maintenance::factory(), 'maintenances')->create();@@ -33,13 +33,12 @@ class DeleteSuppliersTest extends TestCase implements TestsPermissionsRequiremen$actor->deleteJson(route('api.suppliers.destroy', $supplierWithMaintenance))->assertStatusMessageIs('error');$actor->deleteJson(route('api.suppliers.destroy', $supplierWithLicense))->assertStatusMessageIs('error');-$this->assertNotSoftDeleted($supplierWithAsset);$this->assertNotSoftDeleted($supplierWithMaintenance);$this->assertNotSoftDeleted($supplierWithLicense);}- public function testCanDeleteSupplier()+ public function test_can_delete_supplier(){$supplier = Supplier::factory()->create();diff --git a/tests/Feature/Suppliers/Ui/BulkDeleteSuppliersTest.php b/tests/Feature/Suppliers/Ui/BulkDeleteSuppliersTest.phpindex fb41aff23a..bf07145f72 100644--- a/tests/Feature/Suppliers/Ui/BulkDeleteSuppliersTest.php+++ b/tests/Feature/Suppliers/Ui/BulkDeleteSuppliersTest.php@@ -14,7 +14,7 @@ class BulkDeleteSuppliersTest extends TestCase implements TestsPermissionsRequir{$this->actingAs(User::factory()->create())->post(route('suppliers.bulk.delete'), [- 'ids' => [1, 2, 3]+ 'ids' => [1, 2, 3],])->assertForbidden();}@@ -23,12 +23,12 @@ class BulkDeleteSuppliersTest extends TestCase implements TestsPermissionsRequir{$supplier = Supplier::factory()->create();Asset::factory()->create(['supplier_id' => $supplier->id]);-+$this->actingAs(User::factory()->deleteSuppliers()->create())->post(route('suppliers.bulk.delete'), [- 'ids' => [$supplier->id]+ 'ids' => [$supplier->id],]);-+$this->assertModelExists($supplier);$this->assertNotSoftDeleted($supplier);}@@ -41,7 +41,7 @@ class BulkDeleteSuppliersTest extends TestCase implements TestsPermissionsRequir$this->actingAs(User::factory()->deleteSuppliers()->create())->post(route('suppliers.bulk.delete'), [- 'ids' => [$supplier1->id, $supplier2->id, $supplier3->id]+ 'ids' => [$supplier1->id, $supplier2->id, $supplier3->id],])->assertRedirect(route('suppliers.index'));diff --git a/tests/Feature/Suppliers/Ui/CreateSupplierTest.php b/tests/Feature/Suppliers/Ui/CreateSupplierTest.phpindex ec0765a796..d850dc8fa8 100644--- a/tests/Feature/Suppliers/Ui/CreateSupplierTest.php+++ b/tests/Feature/Suppliers/Ui/CreateSupplierTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class CreateSupplierTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('suppliers.create'))diff --git a/tests/Feature/Suppliers/Ui/IndexSuppliersTest.php b/tests/Feature/Suppliers/Ui/IndexSuppliersTest.phpindex e04941f6ea..b812992d7a 100644--- a/tests/Feature/Suppliers/Ui/IndexSuppliersTest.php+++ b/tests/Feature/Suppliers/Ui/IndexSuppliersTest.php@@ -7,7 +7,7 @@ use Tests\TestCase;class IndexSuppliersTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('suppliers.index'))diff --git a/tests/Feature/Suppliers/Ui/ShowSupplierTest.php b/tests/Feature/Suppliers/Ui/ShowSupplierTest.phpindex d041e179f1..252c15395b 100644--- a/tests/Feature/Suppliers/Ui/ShowSupplierTest.php+++ b/tests/Feature/Suppliers/Ui/ShowSupplierTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class ShowSupplierTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('suppliers.show', Supplier::factory()->create()->id))diff --git a/tests/Feature/Suppliers/Ui/UpdateSupplierTest.php b/tests/Feature/Suppliers/Ui/UpdateSupplierTest.phpindex f3be726319..04ae6be9aa 100644--- a/tests/Feature/Suppliers/Ui/UpdateSupplierTest.php+++ b/tests/Feature/Suppliers/Ui/UpdateSupplierTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class UpdateSupplierTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('suppliers.edit', Supplier::factory()->create()->id))diff --git a/tests/Feature/Users/Api/CreateUserTest.php b/tests/Feature/Users/Api/CreateUserTest.phpindex bbed8479d5..b00ee0cae2 100644--- a/tests/Feature/Users/Api/CreateUserTest.php+++ b/tests/Feature/Users/Api/CreateUserTest.php@@ -12,7 +12,7 @@ use Tests\TestCase;class CreateUserTest extends TestCase{- public function testRequiresPermission()+ public function test_requires_permission(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.users.store'), [@@ -24,7 +24,7 @@ class CreateUserTest extends TestCase->assertForbidden();}- public function testCompanyIdNeedsToBeInteger()+ public function test_company_id_needs_to_be_integer(){$company = Company::factory()->create();@@ -42,7 +42,7 @@ class CreateUserTest extends TestCase});}- public function testDepartmentIdNeedsToBeInteger()+ public function test_department_id_needs_to_be_integer(){$department = Department::factory()->create();@@ -60,7 +60,7 @@ class CreateUserTest extends TestCase});}- public function testCanCreateUser()+ public function test_can_create_user(){Notification::fake();@@ -91,7 +91,7 @@ class CreateUserTest extends TestCaseNotification::assertNothingSent();}- public function testCanCreateAndNotifyUser()+ public function test_can_create_and_notify_user(){Notification::fake();diff --git a/tests/Feature/Users/Api/DeleteUsersTest.php b/tests/Feature/Users/Api/DeleteUsersTest.phpindex 5af828371c..fafa880b59 100644--- a/tests/Feature/Users/Api/DeleteUsersTest.php+++ b/tests/Feature/Users/Api/DeleteUsersTest.php@@ -23,7 +23,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp$this->assertNotSoftDeleted($user);}- public function testErrorReturnedViaApiIfUserDoesNotExist()+ public function test_error_returned_via_api_if_user_does_not_exist(){$this->actingAsForApi(User::factory()->deleteUsers()->create())->deleteJson(route('api.users.destroy', 'invalid-id'))@@ -33,7 +33,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp->json();}- public function testErrorReturnedViaApiIfUserIsAlreadyDeleted()+ public function test_error_returned_via_api_if_user_is_already_deleted(){$user = User::factory()->deletedUser()->create();$this->actingAsForApi(User::factory()->deleteUsers()->create())@@ -44,7 +44,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp->json();}- public function testDisallowUserDeletionViaApiIfStillManagingPeople()+ public function test_disallow_user_deletion_via_api_if_still_managing_people(){$manager = User::factory()->create();User::factory()->count(5)->create(['manager_id' => $manager->id]);@@ -58,7 +58,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp->json();}- public function testDisallowUserDeletionViaApiIfStillManagingLocations()+ public function test_disallow_user_deletion_via_api_if_still_managing_locations(){$manager = User::factory()->create();Location::factory()->count(5)->create(['manager_id' => $manager->id]);@@ -73,7 +73,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp->json();}- public function testDisallowUserDeletionViaApiIfStillHasLicenses()+ public function test_disallow_user_deletion_via_api_if_still_has_licenses(){$manager = User::factory()->create();LicenseSeat::factory()->count(5)->create(['assigned_to' => $manager->id]);@@ -88,7 +88,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp->json();}- public function testUsersCannotDeleteThemselves()+ public function test_users_cannot_delete_themselves(){$user = User::factory()->deleteUsers()->create();$this->actingAsForApi($user)@@ -111,7 +111,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp$userFromB = User::factory()->deleteUsers()->for($companyB)->create();$this->actingAsForApi($userFromA)- ->deleteJson(route('api.users.destroy', $userFromB))+ ->deleteJson(route('api.users.destroy', $userFromB))->assertOk()->assertStatus(200)->assertStatusMessageIs('error')@@ -141,7 +141,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp$this->assertNotNull($userFromA->deleted_at);}- public function testCanDeleteUser()+ public function test_can_delete_user(){$user = User::factory()->create();@@ -153,7 +153,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp$this->assertSoftDeleted($user);}- public function testAdminCannotDeleteSuperUser()+ public function test_admin_cannot_delete_super_user(){$superuser = User::factory()->superuser()->create();$admin = User::factory()->admin()->create();@@ -165,7 +165,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp}- public function testUserCannotDeleteAdminUser()+ public function test_user_cannot_delete_admin_user(){$user = User::factory()->deleteUsers()->create();$admin = User::factory()->admin()->create();@@ -177,7 +177,7 @@ class DeleteUsersTest extends TestCase implements TestsFullMultipleCompaniesSupp}- public function testUserCannotDeleteSuperUser()+ public function test_user_cannot_delete_super_user(){$user = User::factory()->deleteUsers()->create();$superuser = User::factory()->superuser()->create();diff --git a/tests/Feature/Users/Api/IndexUsersTest.php b/tests/Feature/Users/Api/IndexUsersTest.phpindex cd6dfdd88e..0024ca6525 100644--- a/tests/Feature/Users/Api/IndexUsersTest.php+++ b/tests/Feature/Users/Api/IndexUsersTest.php@@ -9,14 +9,14 @@ use Tests\TestCase;class IndexUsersTest extends TestCase{- public function testRequiresPermission()+ public function test_requires_permission(){$this->actingAsForApi(User::factory()->create())->getJson(route('api.users.index'))->assertForbidden();}- public function testReturnsManagedUsersCountCorrectly()+ public function test_returns_managed_users_count_correctly(){$manager = User::factory()->create(['first_name' => 'Manages Users']);User::factory()->create(['first_name' => 'Does Not Manage Users']);@@ -37,7 +37,7 @@ class IndexUsersTest extends TestCase});}- public function testReturnsManagedLocationsCountCorrectly()+ public function test_returns_managed_locations_count_correctly(){$manager = User::factory()->create(['first_name' => 'Manages Locations']);User::factory()->create(['first_name' => 'Does Not Manage Locations']);@@ -71,7 +71,7 @@ class IndexUsersTest extends TestCase});}- public function testReturnsResultViaFilter()+ public function test_returns_result_via_filter(){User::factory()->count(3)->create(['first_name' => 'Awesome', 'last_name' => 'Admin', 'email' => '[email protected]']);@@ -84,7 +84,7 @@ class IndexUsersTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 3)->etc());$this->actingAsForApi(User::factory()->viewUsers()->create())->getJson(route('api.users.index', [@@ -95,6 +95,6 @@ class IndexUsersTest extends TestCase'total','rows',])- ->assertJson(fn(AssertableJson $json) => $json->has('rows', 0)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('rows', 0)->etc());}}diff --git a/tests/Feature/Users/Api/RestoreUserTest.php b/tests/Feature/Users/Api/RestoreUserTest.phpindex 0ffac8f07e..b4848bb023 100644--- a/tests/Feature/Users/Api/RestoreUserTest.php+++ b/tests/Feature/Users/Api/RestoreUserTest.php@@ -3,16 +3,12 @@namespace Tests\Feature\Users\Api;use App\Models\Company;-use App\Models\LicenseSeat;-use App\Models\Location;use App\Models\User;use Tests\TestCase;class RestoreUserTest extends TestCase{--- public function testErrorReturnedViaApiIfUserDoesNotExist()+ public function test_error_returned_via_api_if_user_does_not_exist(){$this->actingAsForApi(User::factory()->deleteUsers()->create())->postJson(route('api.users.restore', 'invalid-id'))@@ -22,7 +18,7 @@ class RestoreUserTest extends TestCase->json();}- public function testErrorReturnedViaApiIfUserIsNotDeleted()+ public function test_error_returned_via_api_if_user_is_not_deleted(){$user = User::factory()->create();$this->actingAsForApi(User::factory()->deleteUsers()->create())@@ -33,8 +29,7 @@ class RestoreUserTest extends TestCase->json();}-- public function testDeniedPermissionsForRestoringUserViaApi()+ public function test_denied_permissions_for_restoring_user_via_api(){$this->actingAsForApi(User::factory()->create())->postJson(route('api.users.restore', User::factory()->deletedUser()->create()))@@ -42,7 +37,7 @@ class RestoreUserTest extends TestCase->json();}- public function testSuccessPermissionsForRestoringUserViaApi()+ public function test_success_permissions_for_restoring_user_via_api(){$deleted_user = User::factory()->deletedUser()->create();@@ -57,7 +52,7 @@ class RestoreUserTest extends TestCase$this->assertNull($deleted_user->deleted_at);}- public function testPermissionsForRestoringIfNotInSameCompanyAndNotSuperadmin()+ public function test_permissions_for_restoring_if_not_in_same_company_and_not_superadmin(){$this->settings->enableMultipleFullCompanySupport();@@ -98,8 +93,4 @@ class RestoreUserTest extends TestCase$this->assertNull($userFromA->deleted_at);}----}diff --git a/tests/Feature/Users/Api/UpdateUserTest.php b/tests/Feature/Users/Api/UpdateUserTest.phpindex 558a443136..dd019da8ad 100644--- a/tests/Feature/Users/Api/UpdateUserTest.php+++ b/tests/Feature/Users/Api/UpdateUserTest.php@@ -13,7 +13,7 @@ use Tests\TestCase;class UpdateUserTest extends TestCase{- public function testCanUpdateUserViaPatch()+ public function test_can_update_user_via_patch(){$admin = User::factory()->superuser()->create();$manager = User::factory()->create();@@ -88,7 +88,7 @@ class UpdateUserTest extends TestCase$this->assertTrue($user->groups->contains($groupB), 'Not part of expected group');}- public function testCanUpdateUserViaPut()+ public function test_can_update_user_via_put(){$admin = User::factory()->superuser()->create();$manager = User::factory()->create();@@ -164,7 +164,7 @@ class UpdateUserTest extends TestCase$this->assertTrue($user->groups->contains($groupB), 'Not part of expected group');}- public function testApiUsersCanBeActivatedWithNumber()+ public function test_api_users_can_be_activated_with_number(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => 0]);@@ -177,7 +177,7 @@ class UpdateUserTest extends TestCase$this->assertEquals(1, $user->refresh()->activated);}- public function testApiUsersCanBeActivatedWithBooleanTrue()+ public function test_api_users_can_be_activated_with_boolean_true(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => false]);@@ -190,7 +190,7 @@ class UpdateUserTest extends TestCase$this->assertEquals(1, $user->refresh()->activated);}- public function testApiUsersCanBeDeactivatedWithNumber()+ public function test_api_users_can_be_deactivated_with_number(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => true]);@@ -203,7 +203,7 @@ class UpdateUserTest extends TestCase$this->assertEquals(0, $user->refresh()->activated);}- public function testApiUsersCanBeDeactivatedWithBooleanFalse()+ public function test_api_users_can_be_deactivated_with_boolean_false(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => true]);@@ -216,14 +216,13 @@ class UpdateUserTest extends TestCase$this->assertEquals(0, $user->refresh()->activated);}- public function testEditingUsersCannotEditEscalationFieldsForAdmins()+ public function test_editing_users_cannot_edit_escalation_fields_for_admins(){$hashed_original = Hash::make('!!094850394680980380kfejlskjfl');$hashed_new = Hash::make('!ABCDEFGIJKL123!!!');$editing_user = User::factory()->editUsers()->create();- $adminuser = User::factory()->admin()->create(['username' => 'TestAdminUser', 'email'=> '[email protected]', 'password' => $hashed_original, 'activated' => 1]);-+ $adminuser = User::factory()->admin()->create(['username' => 'TestAdminUser', 'email' => '[email protected]', 'password' => $hashed_original, 'activated' => 1]);// The admin being edited$this->assertDatabaseHas('users', [@@ -253,15 +252,13 @@ class UpdateUserTest extends TestCase}-- public function testAdminsCannotDeescalateSuperadmins()+ public function test_admins_cannot_deescalate_superadmins(){$hashed_original = Hash::make('my-awesome-password!!!!!12345');$hashed_new = Hash::make('!ABCDEFGIJKL123!!!');$editing_user = User::factory()->admin()->create();- $superuser = User::factory()->superuser()->create(['username' => 'TestSuperUser', 'email'=> '[email protected]', 'password' => $hashed_original, 'activated' => 1]);-+ $superuser = User::factory()->superuser()->create(['username' => 'TestSuperUser', 'email' => '[email protected]', 'password' => $hashed_original, 'activated' => 1]);// The admin being edited$this->assertDatabaseHas('users', [@@ -294,12 +291,12 @@ class UpdateUserTest extends TestCase}- public function testUsersScopedToCompanyDuringUpdateWhenMultipleFullCompanySupportEnabled()+ public function test_users_scoped_to_company_during_update_when_multiple_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();- $companyA = Company::factory()->create(['name'=>'Company A']);- $companyB = Company::factory()->create(['name'=>'Company B']);+ $companyA = Company::factory()->create(['name' => 'Company A']);+ $companyB = Company::factory()->create(['name' => 'Company B']);$adminA = User::factory(['company_id' => $companyA->id])->admin()->create();$adminB = User::factory(['company_id' => $companyB->id])->admin()->create();@@ -383,7 +380,7 @@ class UpdateUserTest extends TestCase->json();}- public function testUserGroupsAreOnlyUpdatedIfAuthenticatedUserIsSuperUser()+ public function test_user_groups_are_only_updated_if_authenticated_user_is_super_user(){$groupToJoin = Group::factory()->create();@@ -410,7 +407,7 @@ class UpdateUserTest extends TestCase$this->assertTrue($userToUpdateByToUserBySuperuser->refresh()->groups->contains($groupToJoin));}- public function testUserGroupsCanBeClearedBySuperUser()+ public function test_user_groups_can_be_cleared_by_super_user(){$normalUser = User::factory()->editUsers()->create();$superUser = User::factory()->superuser()->create();@@ -436,7 +433,7 @@ class UpdateUserTest extends TestCase$this->assertFalse($anotherUserToUpdate->refresh()->groups->contains($joinedGroup));}- public function testNonSuperuserCannotUpdateOwnGroups()+ public function test_non_superuser_cannot_update_own_groups(){$groupToJoin = Group::factory()->create();$user = User::factory()->editUsers()->create();@@ -452,7 +449,7 @@ class UpdateUserTest extends TestCase}- public function testNonSuperuserCannotUpdateGroups()+ public function test_non_superuser_cannot_update_groups(){$user = User::factory()->editUsers()->create();$group = Group::factory()->create();@@ -464,7 +461,6 @@ class UpdateUserTest extends TestCase'groups' => [$newGroupToJoin->id],]);-$this->assertFalse($user->refresh()->groups->contains($newGroupToJoin),'Non-super-user was able to modify user group membership');@@ -473,7 +469,7 @@ class UpdateUserTest extends TestCase}- public function testUsersGroupsAreNotClearedIfNoGroupPassedBySuperUser()+ public function test_users_groups_are_not_cleared_if_no_group_passed_by_super_user(){$user = User::factory()->create();$superUser = User::factory()->superuser()->create();@@ -487,13 +483,13 @@ class UpdateUserTest extends TestCase$this->assertTrue($user->refresh()->groups->contains($group));}- public function testMultipleGroupsUpdateBySuperUser()+ public function test_multiple_groups_update_by_super_user(){$user = User::factory()->create();$superUser = User::factory()->superuser()->create();- $groupA = Group::factory()->create(['name'=>'Group A']);- $groupB = Group::factory()->create(['name'=>'Group B']);+ $groupA = Group::factory()->create(['name' => 'Group A']);+ $groupB = Group::factory()->create(['name' => 'Group B']);$this->actingAsForApi($superUser)->patchJson(route('api.users.update', $user), [@@ -504,7 +500,7 @@ class UpdateUserTest extends TestCase$this->assertTrue($user->refresh()->groups->contains($groupB));}- public function testMultiCompanyUserCannotBeMovedIfHasAssetInDifferentCompany()+ public function test_multi_company_user_cannot_be_moved_if_has_asset_in_different_company(){$this->settings->enableMultipleFullCompanySupport();@@ -522,13 +518,13 @@ class UpdateUserTest extends TestCase// no assets assigned, therefore success$this->actingAsForApi($superUser)->patchJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','company_id' => $companyB->id,])->assertStatusMessageIs('success');// same test but PUT$this->actingAsForApi($superUser)->putJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','first_name' => 'Test','company_id' => $companyB->id,])->assertStatusMessageIs('success');@@ -537,19 +533,19 @@ class UpdateUserTest extends TestCase// asset assigned, therefore error$this->actingAsForApi($superUser)->patchJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','company_id' => $companyB->id,])->assertStatusMessageIs('error');// same test but PUT$this->actingAsForApi($superUser)->putJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','first_name' => 'Test','company_id' => $companyB->id,])->assertStatusMessageIs('error');}- public function testMultiCompanyUserCanBeUpdatedIfHasAssetInSameCompany()+ public function test_multi_company_user_can_be_updated_if_has_asset_in_same_company(){$this->settings->enableMultipleFullCompanySupport();@@ -567,13 +563,13 @@ class UpdateUserTest extends TestCase// no assets assigned from other company, therefore success$this->actingAsForApi($superUser)->patchJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','company_id' => $companyB->id,])->assertStatusMessageIs('success');// same test but PUT$this->actingAsForApi($superUser)->putJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','first_name' => 'Test','company_id' => $companyB->id,])->assertStatusMessageIs('success');@@ -582,16 +578,15 @@ class UpdateUserTest extends TestCase// asset assigned from other company, therefore error$this->actingAsForApi($superUser)->patchJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','company_id' => $companyB->id,])->assertStatusMessageIs('error');// same test but PUT$this->actingAsForApi($superUser)->putJson(route('api.users.update', $user), [- 'username' => 'test',+ 'username' => 'test','first_name' => 'Test','company_id' => $companyB->id,])->assertStatusMessageIs('error');}-}diff --git a/tests/Feature/Users/Api/UserFileTest.php b/tests/Feature/Users/Api/UserFileTest.phpindex 5128b3d407..b89a1dc29e 100644--- a/tests/Feature/Users/Api/UserFileTest.php+++ b/tests/Feature/Users/Api/UserFileTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class UserFileTest extends TestCase{- public function testUserApiAcceptsFileUpload()+ public function test_user_api_accepts_file_upload(){// Create a model to work with$user = User::factory()->create();@@ -16,17 +16,17 @@ class UserFileTest extends TestCase// Create a superuser to run this as$admin = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($admin)->post(route('api.files.store', ['object_type' => 'users', 'id' => $user->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();}- public function testUserApiListsFiles()+ public function test_user_api_lists_files(){// List all files on a model@@ -44,13 +44,13 @@ class UserFileTest extends TestCase->assertOk()->assertJsonStructure([- 'rows',- 'total',+ 'rows',+ 'total',]);}- public function testUserFailsIfInvalidTypePassedInUrl()+ public function test_user_fails_if_invalid_type_passed_in_url(){// List all files on a model@@ -68,7 +68,7 @@ class UserFileTest extends TestCase->assertStatus(404);}- public function testUserFailsIfInvalidIdPassedInUrl()+ public function test_user_fails_if_invalid_id_passed_in_url(){// List all files on a model@@ -87,7 +87,7 @@ class UserFileTest extends TestCase->assertStatusMessageIs('error');}- public function testUserApiDownloadsFile()+ public function test_user_api_downloads_file(){// Download a file from a model@@ -101,14 +101,14 @@ class UserFileTest extends TestCase$this->actingAsForApi($admin)->post(route('api.files.store', ['object_type' => 'users', 'id' => $user->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -116,15 +116,15 @@ class UserFileTest extends TestCase$this->actingAsForApi($admin)->post(route('api.files.store', ['object_type' => 'users', 'id' => $user->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)],- 'notes' => 'manual'+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],+ 'notes' => 'manual',])->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);@@ -136,19 +136,19 @@ class UserFileTest extends TestCase->assertOk()->assertJsonStructure([- 'total',- 'rows'=>[- '*' => [- 'id',- 'filename',- 'url',- 'created_by',- 'created_at',- 'deleted_at',- 'note',- 'available_actions'- ]- ]+ 'total',+ 'rows' => [+ '*' => [+ 'id',+ 'filename',+ 'url',+ 'created_by',+ 'created_at',+ 'deleted_at',+ 'note',+ 'available_actions',+ ],+ ],])->assertJsonPath('rows.0.note', null)@@ -159,16 +159,16 @@ class UserFileTest extends TestCase->get(route('api.files.show', [- 'object_type' => 'users',- 'id' => $user->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'users',+ 'id' => $user->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk();}- public function testUserApiDeletesFile()+ public function test_user_api_deletes_file(){// Delete a file from a model@@ -178,11 +178,11 @@ class UserFileTest extends TestCase// Create a superuser to run this as$admin = User::factory()->superuser()->create();- //Upload a file+ // Upload a file$this->actingAsForApi($admin)->post(route('api.files.store', ['object_type' => 'users', 'id' => $user->id]), [- 'file' => [UploadedFile::fake()->create("test.jpg", 100)]+ 'file' => [UploadedFile::fake()->create('test.jpg', 100)],])->assertOk();@@ -199,18 +199,18 @@ class UserFileTest extends TestCase->delete(route('api.files.destroy', [- 'object_type' => 'users',- 'id' => $user->id,- 'file_id' => $result->decodeResponseJson()->json()["rows"][0]["id"],+ 'object_type' => 'users',+ 'id' => $user->id,+ 'file_id' => $result->decodeResponseJson()->json()['rows'][0]['id'],]))->assertOk()->assertJsonStructure([- 'status',- 'messages',+ 'status',+ 'messages',]);}-}\ No newline at end of file+}diff --git a/tests/Feature/Users/Api/UserSearchTest.php b/tests/Feature/Users/Api/UserSearchTest.phpindex dc0ffdc803..2c28f3fb3e 100644--- a/tests/Feature/Users/Api/UserSearchTest.php+++ b/tests/Feature/Users/Api/UserSearchTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class UserSearchTest extends TestCase{- public function testCanSearchByUserFirstAndLastName()+ public function test_can_search_by_user_first_and_last_name(){User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);User::factory()->create(['first_name' => 'Darth', 'last_name' => 'Vader']);@@ -20,11 +20,11 @@ class UserSearchTest extends TestCase$results = collect($response->json('rows'));$this->assertEquals(1, $results->count());- $this->assertTrue($results->pluck('name')->contains(fn($text) => str_contains($text, 'Luke')));- $this->assertFalse($results->pluck('name')->contains(fn($text) => str_contains($text, 'Darth')));+ $this->assertTrue($results->pluck('name')->contains(fn ($text) => str_contains($text, 'Luke')));+ $this->assertFalse($results->pluck('name')->contains(fn ($text) => str_contains($text, 'Darth')));}- public function testResultsWhenSearchingForActiveUsers()+ public function test_results_when_searching_for_active_users(){User::factory()->create(['first_name' => 'Active', 'last_name' => 'User']);User::factory()->create(['first_name' => 'Deleted', 'last_name' => 'User'])->delete();@@ -53,7 +53,7 @@ class UserSearchTest extends TestCase);}- public function testResultsWhenSearchingForDeletedUsers()+ public function test_results_when_searching_for_deleted_users(){User::factory()->create(['first_name' => 'Active', 'last_name' => 'User']);User::factory()->create(['first_name' => 'Deleted', 'last_name' => 'User'])->delete();@@ -82,7 +82,7 @@ class UserSearchTest extends TestCase);}- public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled()+ public function test_users_scoped_to_company_when_multiple_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();@@ -101,16 +101,16 @@ class UserSearchTest extends TestCase$results = collect($response->json('rows'));$this->assertTrue(- $results->pluck('name')->contains(fn($text) => str_contains($text, 'Company A')),+ $results->pluck('name')->contains(fn ($text) => str_contains($text, 'Company A')),'User index does not contain expected user');$this->assertFalse(- $results->pluck('name')->contains(fn($text) => str_contains($text, 'Company B')),+ $results->pluck('name')->contains(fn ($text) => str_contains($text, 'Company B')),'User index contains unexpected user from another company');}- public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled()+ public function test_users_scoped_to_company_during_search_when_multiple_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();@@ -136,16 +136,16 @@ class UserSearchTest extends TestCase$results = collect($response->json('rows'));$this->assertTrue(- $results->pluck('name')->contains(fn($text) => str_contains($text, 'Company A')),+ $results->pluck('name')->contains(fn ($text) => str_contains($text, 'Company A')),'User index does not contain expected user');$this->assertFalse(- $results->pluck('name')->contains(fn($text) => str_contains($text, 'Company B')),+ $results->pluck('name')->contains(fn ($text) => str_contains($text, 'Company B')),'User index contains unexpected user from another company');}- public function testUsersIndexWhenInvalidSortFieldIsPassed()+ public function test_users_index_when_invalid_sort_field_is_passed(){$this->markIncompleteIfSqlite('This test is not compatible with SQLite');diff --git a/tests/Feature/Users/Api/UsersForSelectListTest.php b/tests/Feature/Users/Api/UsersForSelectListTest.phpindex 33ff402d9b..2923ebd6d9 100644--- a/tests/Feature/Users/Api/UsersForSelectListTest.php+++ b/tests/Feature/Users/Api/UsersForSelectListTest.php@@ -10,7 +10,7 @@ use Tests\TestCase;class UsersForSelectListTest extends TestCase{- public function testUsersAreReturned()+ public function test_users_are_returned(){$users = User::factory()->superuser()->count(3)->create();@@ -24,10 +24,10 @@ class UsersForSelectListTest extends TestCase'page','page_count',])- ->assertJson(fn(AssertableJson $json) => $json->has('results', 3)->etc());+ ->assertJson(fn (AssertableJson $json) => $json->has('results', 3)->etc());}- public function testUsersCanBeSearchedByFirstAndLastName()+ public function test_users_can_be_searched_by_first_and_last_name(){User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);@@ -37,10 +37,10 @@ class UsersForSelectListTest extends TestCase$results = collect($response->json('results'));$this->assertEquals(1, $results->count());- $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, 'Luke')));+ $this->assertTrue($results->pluck('text')->contains(fn ($text) => str_contains($text, 'Luke')));}- public function testUsersCanBeSearchedByEmail()+ public function test_users_can_be_searched_by_email(){User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker', 'email' => '[email protected]']);@@ -50,10 +50,10 @@ class UsersForSelectListTest extends TestCase$results = collect($response->json('results'));$this->assertEquals(1, $results->count());- $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, 'Luke')));+ $this->assertTrue($results->pluck('text')->contains(fn ($text) => str_contains($text, 'Luke')));}- public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled()+ public function test_users_scoped_to_company_when_multiple_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();@@ -74,14 +74,14 @@ class UsersForSelectListTest extends TestCase$this->assertEquals(3, $results->count());$this->assertTrue(- $results->pluck('text')->contains(fn($text) => str_contains($text, 'Luke'))+ $results->pluck('text')->contains(fn ($text) => str_contains($text, 'Luke')));$this->assertFalse(- $results->pluck('text')->contains(fn($text) => str_contains($text, 'Darth'))+ $results->pluck('text')->contains(fn ($text) => str_contains($text, 'Darth')));}- public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled()+ public function test_users_scoped_to_company_during_search_when_multiple_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();@@ -101,8 +101,8 @@ class UsersForSelectListTest extends TestCase$results = collect($response->json('results'));$this->assertEquals(3, $results->count());- $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, 'Luke')));- $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, 'Anakin')));+ $this->assertTrue($results->pluck('text')->contains(fn ($text) => str_contains($text, 'Luke')));+ $this->assertTrue($results->pluck('text')->contains(fn ($text) => str_contains($text, 'Anakin')));$response = $this->getJson(route('api.users.selectlist', ['search' => 'dvader']))->assertOk();$this->assertEquals(0, collect($response->json('results'))->count());diff --git a/tests/Feature/Users/Api/ViewUserTest.php b/tests/Feature/Users/Api/ViewUserTest.phpindex 07346dbbb8..b3f65ed31c 100644--- a/tests/Feature/Users/Api/ViewUserTest.php+++ b/tests/Feature/Users/Api/ViewUserTest.php@@ -2,16 +2,12 @@namespace Tests\Feature\Users\Api;-use App\Models\Company;use App\Models\User;-use Illuminate\Testing\Fluent\AssertableJson;-use Laravel\Passport\Passport;use Tests\TestCase;class ViewUserTest extends TestCase{-- public function testCanReturnUser()+ public function test_can_return_user(){$user = User::factory()->create();@@ -19,5 +15,4 @@ class ViewUserTest extends TestCase->getJson(route('api.users.show', $user))->assertOk();}-}diff --git a/tests/Feature/Users/Ui/CloneUserTest.php b/tests/Feature/Users/Ui/CloneUserTest.phpindex 97b4babd7b..2c7761a101 100644--- a/tests/Feature/Users/Ui/CloneUserTest.php+++ b/tests/Feature/Users/Ui/CloneUserTest.php@@ -7,12 +7,10 @@ use Tests\TestCase;class CloneUserTest extends TestCase{- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->superuser()->create())->get(route('users.clone.show', User::factory()->create()))->assertOk();}--}diff --git a/tests/Feature/Users/Ui/CreateUserTest.php b/tests/Feature/Users/Ui/CreateUserTest.phpindex f2f5c2ed67..4b6b553ae0 100644--- a/tests/Feature/Users/Ui/CreateUserTest.php+++ b/tests/Feature/Users/Ui/CreateUserTest.php@@ -9,15 +9,14 @@ use Tests\TestCase;class CreateUserTest extends TestCase{-- public function testPermissionRequiredToCreateUser()+ public function test_permission_required_to_create_user(){$this->actingAs(User::factory()->create())->get(route('users.create'))->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->createUsers()->create())->get(route('users.create'))@@ -25,7 +24,7 @@ class CreateUserTest extends TestCase}- public function testCanCreateUser()+ public function test_can_create_user(){Notification::fake();@@ -59,7 +58,7 @@ class CreateUserTest extends TestCase}- public function testCanCreateAndNotifyUser()+ public function test_can_create_and_notify_user(){Notification::fake();diff --git a/tests/Feature/Users/Ui/DeleteUserTest.php b/tests/Feature/Users/Ui/DeleteUserTest.phpindex 6d687ed0f8..b3a63177bc 100644--- a/tests/Feature/Users/Ui/DeleteUserTest.php+++ b/tests/Feature/Users/Ui/DeleteUserTest.php@@ -2,19 +2,17 @@namespace Tests\Feature\Users\Ui;-use Tests\TestCase;+use App\Models\Accessory;+use App\Models\Asset;+use App\Models\Company;use App\Models\LicenseSeat;use App\Models\Location;-use App\Models\Accessory;use App\Models\User;-use App\Models\Company;--use App\Models\Asset;+use Tests\TestCase;class DeleteUserTest extends TestCase{-- public function testUserCanDeleteAnotherUser()+ public function test_user_can_delete_another_user(){$user = User::factory()->deleteUsers()->viewUsers()->create();$this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($user->isDeletable());@@ -27,8 +25,7 @@ class DeleteUserTest extends TestCase$this->followRedirects($response)->assertSee(trans('general.notification_success'));}-- public function testErrorReturnedIfUserDoesNotExist()+ public function test_error_returned_if_user_does_not_exist(){$response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->delete(route('users.destroy', ['user' => '40596803548609346']))@@ -37,7 +34,7 @@ class DeleteUserTest extends TestCase$this->followRedirects($response)->assertSee(trans('alert-danger'));}- public function testErrorReturnedIfUserIsAlreadyDeleted()+ public function test_error_returned_if_user_is_already_deleted(){$user = User::factory()->deletedUser()->viewUsers()->create();$response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())@@ -45,10 +42,10 @@ class DeleteUserTest extends TestCase->assertStatus(302)->assertRedirect(route('users.index'));- $this->followRedirects($response)->assertSee(trans('general.error'));+ $this->followRedirects($response)->assertSee(trans('general.error'));}- public function testCanViewSoftDeletedUser()+ public function test_can_view_soft_deleted_user(){$user = User::factory()->deletedUser()->viewUsers()->create();$response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())@@ -56,8 +53,7 @@ class DeleteUserTest extends TestCase->assertStatus(200);}-- public function testFmcsPermissionsToDeleteUser()+ public function test_fmcs_permissions_to_delete_user(){$this->settings->enableMultipleFullCompanySupport();@@ -68,7 +64,7 @@ class DeleteUserTest extends TestCase$userFromA = User::factory()->deleteUsers()->for($companyA)->create();$userFromB = User::factory()->deleteUsers()->for($companyB)->create();- $response = $this->followingRedirects()->actingAs($userFromA)+ $response = $this->followingRedirects()->actingAs($userFromA)->delete(route('users.destroy', ['user' => $userFromB->id]))->assertStatus(403);$this->followRedirects($response)->assertSee('sad-panda.png');@@ -76,7 +72,6 @@ class DeleteUserTest extends TestCase$userFromB->refresh();$this->assertNull($userFromB->deleted_at);-$response = $this->actingAs($userFromB)->delete(route('users.destroy', ['user' => $userFromA->id]))->assertStatus(302)@@ -97,8 +92,7 @@ class DeleteUserTest extends TestCase}-- public function testDisallowUserDeletionIfStillManagingPeople()+ public function test_disallow_user_deletion_if_still_managing_people(){$manager = User::factory()->create();User::factory()->count(1)->create(['manager_id' => $manager->id]);@@ -113,7 +107,7 @@ class DeleteUserTest extends TestCase$this->followRedirects($response)->assertSee('Error');}- public function testDisallowUserDeletionIfStillManagingLocations()+ public function test_disallow_user_deletion_if_still_managing_locations(){$manager = User::factory()->create();Location::factory()->count(2)->create(['manager_id' => $manager->id]);@@ -125,10 +119,10 @@ class DeleteUserTest extends TestCase->assertStatus(302)->assertRedirect(route('users.index'));- $this->followRedirects($response)->assertSee('Error');+ $this->followRedirects($response)->assertSee('Error');}- public function testDisallowUserDeletionIfStillHaveAccessories()+ public function test_disallow_user_deletion_if_still_have_accessories(){$user = User::factory()->create();Accessory::factory()->count(3)->checkedOutToUser($user)->create();@@ -143,7 +137,7 @@ class DeleteUserTest extends TestCase$this->followRedirects($response)->assertSee('Error');}- public function testDisallowUserDeletionIfStillHaveLicenses()+ public function test_disallow_user_deletion_if_still_have_licenses(){$user = User::factory()->create();LicenseSeat::factory()->count(4)->create(['assigned_to' => $user->id]);@@ -158,8 +152,7 @@ class DeleteUserTest extends TestCase$this->followRedirects($response)->assertSee('Error');}-- public function testAllowUserDeletionIfNotManagingLocations()+ public function test_allow_user_deletion_if_not_managing_locations(){$manager = User::factory()->create();$this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable());@@ -173,14 +166,14 @@ class DeleteUserTest extends TestCase}- public function testDisallowUserDeletionIfNoDeletePermissions()+ public function test_disallow_user_deletion_if_no_delete_permissions(){$manager = User::factory()->create();Location::factory()->create(['manager_id' => $manager->id]);$this->actingAs(User::factory()->editUsers()->viewUsers()->create())->assertFalse($manager->isDeletable());}- public function testDisallowUserDeletionIfTheyStillHaveAssets()+ public function test_disallow_user_deletion_if_they_still_have_assets(){$user = User::factory()->create();$asset = Asset::factory()->create();@@ -202,8 +195,7 @@ class DeleteUserTest extends TestCase$this->followRedirects($response)->assertSee('Error');}-- public function testUsersCannotDeleteThemselves()+ public function test_users_cannot_delete_themselves(){$manager = User::factory()->deleteUsers()->viewUsers()->create();$this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable());@@ -215,6 +207,4 @@ class DeleteUserTest extends TestCase$this->followRedirects($response)->assertSee('Error');}--}diff --git a/tests/Feature/Users/Ui/EmailAssignedToUserTest.php b/tests/Feature/Users/Ui/EmailAssignedToUserTest.phpindex a6403679c0..4bdb73b830 100644--- a/tests/Feature/Users/Ui/EmailAssignedToUserTest.php+++ b/tests/Feature/Users/Ui/EmailAssignedToUserTest.php@@ -10,7 +10,7 @@ use Tests\TestCase;class EmailAssignedToUserTest extends TestCase{- public function testUserWithoutCompanyPermissionsCannotSendInventory()+ public function test_user_without_company_permissions_cannot_send_inventory(){Notification::fake();diff --git a/tests/Feature/Users/Ui/IndexUsersTest.php b/tests/Feature/Users/Ui/IndexUsersTest.phpindex b2b52538f5..fea2b3d81c 100644--- a/tests/Feature/Users/Ui/IndexUsersTest.php+++ b/tests/Feature/Users/Ui/IndexUsersTest.php@@ -7,14 +7,14 @@ use Tests\TestCase;class IndexUsersTest extends TestCase{- public function testRequiresPermission()+ public function test_requires_permission(){$this->actingAs(User::factory()->create())->get(route('users.index'))->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->viewUsers()->create())->get(route('users.index'))diff --git a/tests/Feature/Users/Ui/MergeUsersTest.php b/tests/Feature/Users/Ui/MergeUsersTest.phpindex a9ae11171b..8d5f72a16c 100644--- a/tests/Feature/Users/Ui/MergeUsersTest.php+++ b/tests/Feature/Users/Ui/MergeUsersTest.php@@ -3,17 +3,16 @@namespace Tests\Feature\Users\Ui;use App\Models\Accessory;+use App\Models\Actionlog;use App\Models\Asset;use App\Models\Consumable;use App\Models\LicenseSeat;use App\Models\User;-use App\Models\Actionlog;use Tests\TestCase;-class MergeUsersTest extends TestCase{- public function testAssetsAreTransferredOnUserMerge()+ public function test_assets_are_transferred_on_user_merge(){$user1 = User::factory()->create();$user2 = User::factory()->create();@@ -27,7 +26,7 @@ class MergeUsersTest extends TestCase->post(route('users.merge.save', $user1->id),['ids_to_merge' => [$user1->id, $user2->id],- 'merge_into_id' => $user_to_merge_into->id+ 'merge_into_id' => $user_to_merge_into->id,])->assertStatus(302)->assertRedirect(route('users.index'));@@ -39,7 +38,7 @@ class MergeUsersTest extends TestCase}- public function testLicensesAreTransferredOnUserMerge()+ public function test_licenses_are_transferred_on_user_merge(){$user1 = User::factory()->create();$user2 = User::factory()->create();@@ -55,7 +54,7 @@ class MergeUsersTest extends TestCase->post(route('users.merge.save', $user1->id),['ids_to_merge' => [$user1->id, $user2->id],- 'merge_into_id' => $user_to_merge_into->id+ 'merge_into_id' => $user_to_merge_into->id,])->assertStatus(302)->assertRedirect(route('users.index'));@@ -67,7 +66,7 @@ class MergeUsersTest extends TestCase}- public function testAccessoriesTransferredOnUserMerge()+ public function test_accessories_transferred_on_user_merge(){$user1 = User::factory()->create();$user2 = User::factory()->create();@@ -83,7 +82,7 @@ class MergeUsersTest extends TestCase->post(route('users.merge.save', $user1->id),['ids_to_merge' => [$user1->id, $user2->id],- 'merge_into_id' => $user_to_merge_into->id+ 'merge_into_id' => $user_to_merge_into->id,])->assertStatus(302)->assertRedirect(route('users.index'));@@ -95,7 +94,7 @@ class MergeUsersTest extends TestCase}- public function testConsumablesTransferredOnUserMerge()+ public function test_consumables_transferred_on_user_merge(){$user1 = User::factory()->create();$user2 = User::factory()->create();@@ -111,7 +110,7 @@ class MergeUsersTest extends TestCase->post(route('users.merge.save', $user1->id),['ids_to_merge' => [$user1->id, $user2->id],- 'merge_into_id' => $user_to_merge_into->id+ 'merge_into_id' => $user_to_merge_into->id,])->assertStatus(302)->assertRedirect(route('users.index'));@@ -123,7 +122,7 @@ class MergeUsersTest extends TestCase}- public function testFilesAreTransferredOnUserMerge()+ public function test_files_are_transferred_on_user_merge(){$user1 = User::factory()->create();$user2 = User::factory()->create();@@ -139,7 +138,7 @@ class MergeUsersTest extends TestCase->post(route('users.merge.save', $user1->id),['ids_to_merge' => [$user1->id, $user2->id],- 'merge_into_id' => $user_to_merge_into->id+ 'merge_into_id' => $user_to_merge_into->id,])->assertStatus(302)->assertRedirect(route('users.index'));@@ -151,7 +150,7 @@ class MergeUsersTest extends TestCase}- public function testAcceptancesAreTransferredOnUserMerge()+ public function test_acceptances_are_transferred_on_user_merge(){$user1 = User::factory()->create();$user2 = User::factory()->create();@@ -167,7 +166,7 @@ class MergeUsersTest extends TestCase->post(route('users.merge.save', $user1->id),['ids_to_merge' => [$user1->id, $user2->id],- 'merge_into_id' => $user_to_merge_into->id+ 'merge_into_id' => $user_to_merge_into->id,])->assertStatus(302)->assertRedirect(route('users.index'));@@ -179,7 +178,7 @@ class MergeUsersTest extends TestCase}- public function testUserUpdateHistoryIsTransferredOnUserMerge()+ public function test_user_update_history_is_transferred_on_user_merge(){$user1 = User::factory()->create();$user2 = User::factory()->create();@@ -195,7 +194,7 @@ class MergeUsersTest extends TestCase->post(route('users.merge.save', $user1->id),['ids_to_merge' => [$user1->id, $user2->id],- 'merge_into_id' => $user_to_merge_into->id+ 'merge_into_id' => $user_to_merge_into->id,])->assertStatus(302)->assertRedirect(route('users.index'));@@ -208,6 +207,4 @@ class MergeUsersTest extends TestCase$this->assertEquals(2, $user2->refresh()->userlog->count());}--}diff --git a/tests/Feature/Users/Ui/PrintUserInventoryTest.php b/tests/Feature/Users/Ui/PrintUserInventoryTest.phpindex 4de7c7cddd..32a82fd1ca 100644--- a/tests/Feature/Users/Ui/PrintUserInventoryTest.php+++ b/tests/Feature/Users/Ui/PrintUserInventoryTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class PrintUserInventoryTest extends TestCase{- public function testPermissionRequiredToPrintUserInventory()+ public function test_permission_required_to_print_user_inventory(){$this->actingAs(User::factory()->create())->get(route('users.print', User::factory()->create()))->assertStatus(403);}- public function testCanPrintUserInventory()+ public function test_can_print_user_inventory(){$actor = User::factory()->viewUsers()->create();@@ -25,7 +25,7 @@ class PrintUserInventoryTest extends TestCase->assertStatus(200);}- public function testCannotPrintUserInventoryFromAnotherCompany()+ public function test_cannot_print_user_inventory_from_another_company(){$this->settings->enableMultipleFullCompanySupport();diff --git a/tests/Feature/Users/Ui/UpdateUserTest.php b/tests/Feature/Users/Ui/UpdateUserTest.phpindex 20dfd2519b..9001bace5c 100644--- a/tests/Feature/Users/Ui/UpdateUserTest.php+++ b/tests/Feature/Users/Ui/UpdateUserTest.php@@ -6,27 +6,26 @@ use App\Models\Asset;use App\Models\Company;use App\Models\User;use Error;-use Tests\TestCase;use Illuminate\Support\Facades\Hash;+use Tests\TestCase;class UpdateUserTest extends TestCase{-- public function testRequiresPermission()+ public function test_requires_permission(){$this->actingAs(User::factory()->create())->get(route('users.edit', User::factory()->create()->id))->assertForbidden();}- public function testPageRenders()+ public function test_page_renders(){$this->actingAs(User::factory()->editUsers()->create())->get(route('users.edit', User::factory()->create()->id))->assertOk();}- public function testCanViewEditPageForSoftDeletedUser()+ public function test_can_view_edit_page_for_soft_deleted_user(){$user = User::factory()->trashed()->create();@@ -35,7 +34,7 @@ class UpdateUserTest extends TestCase->assertRedirectToRoute('users.show', $user->id);}- public function testUsersCanBeActivatedWithNumber()+ public function test_users_can_be_activated_with_number(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => 0]);@@ -50,7 +49,7 @@ class UpdateUserTest extends TestCase$this->assertEquals(1, $user->refresh()->activated);}- public function testUsersCanBeActivatedWithBooleanTrue()+ public function test_users_can_be_activated_with_boolean_true(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => false]);@@ -65,7 +64,7 @@ class UpdateUserTest extends TestCase$this->assertEquals(1, $user->refresh()->activated);}- public function testUsersCanBeDeactivatedWithNumber()+ public function test_users_can_be_deactivated_with_number(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => true]);@@ -80,7 +79,7 @@ class UpdateUserTest extends TestCase$this->assertEquals(0, $user->refresh()->activated);}- public function testUsersCanBeDeactivatedWithBooleanFalse()+ public function test_users_can_be_deactivated_with_boolean_false(){$admin = User::factory()->editUsers()->create();$user = User::factory()->create(['activated' => true]);@@ -95,7 +94,7 @@ class UpdateUserTest extends TestCase$this->assertEquals(0, $user->refresh()->activated);}- public function testUsersUpdatingThemselvesDoNotDeactivateTheirAccount()+ public function test_users_updating_themselves_do_not_deactivate_their_account(){$admin = User::factory()->editUsers()->create(['activated' => true]);@@ -108,11 +107,11 @@ class UpdateUserTest extends TestCase$this->assertEquals(1, $admin->refresh()->activated);}- public function testEditingUsersCannotEditEscalationFieldsForAdmins()+ public function test_editing_users_cannot_edit_escalation_fields_for_admins(){$editing_user = User::factory()->editUsers()->create(['activated' => true]);$hashed_original = Hash::make('my-awesome-password!!!!!12345');- $admin = User::factory()->admin()->create(['username' => 'TestAdminUser', 'email'=> '[email protected]', 'password' => $hashed_original, 'activated' => true]);+ $admin = User::factory()->admin()->create(['username' => 'TestAdminUser', 'email' => '[email protected]', 'password' => $hashed_original, 'activated' => true]);$this->assertDatabaseHas('users', ['id' => $admin->id,@@ -130,7 +129,6 @@ class UpdateUserTest extends TestCase'password' => 'TOTALLY-DIFFERENT-awesome-password!!!!!12345',]);-$this->assertEquals('TestAdminUser', $admin->refresh()->username);$this->assertEquals('[email protected]', $admin->refresh()->email);$this->assertEquals(1, $admin->refresh()->activated);@@ -141,11 +139,11 @@ class UpdateUserTest extends TestCase$this->assertNotEquals(Hash::check('TOTALLY-DIFFERENT-awesome-password!!!!!12345', $admin->password), $admin->refresh()->password);}- public function testAdminUsersCannotEditFieldsForSuperAdmins()+ public function test_admin_users_cannot_edit_fields_for_super_admins(){$admin = User::factory()->admin()->create(['activated' => true]);$hashed_original = Hash::make('my-awesome-password!!!!!12345');- $superuser = User::factory()->superuser()->create(['username' => 'TestSuperUser', 'email'=> '[email protected]', 'password' => $hashed_original, 'activated' => true]);+ $superuser = User::factory()->superuser()->create(['username' => 'TestSuperUser', 'email' => '[email protected]', 'password' => $hashed_original, 'activated' => true]);$this->assertDatabaseHas('users', ['id' => $superuser->id,@@ -180,8 +178,7 @@ class UpdateUserTest extends TestCase$this->assertNotTrue(Hash::check('super-secret-new-password', $superuser->password), $superuser->refresh()->password);}-- public function testMultiCompanyUserCannotBeMovedIfHasAssetInDifferentCompany()+ public function test_multi_company_user_cannot_be_moved_if_has_asset_in_different_company(){$this->settings->enableMultipleFullCompanySupport();@@ -199,26 +196,26 @@ class UpdateUserTest extends TestCase// no assets assigned, therefore success$this->actingAs($superUser)->put(route('users.update', $user), [- 'first_name' => 'test',- 'username' => 'test',- 'company_id' => $companyB->id,- 'redirect_option' => 'index'+ 'first_name' => 'test',+ 'username' => 'test',+ 'company_id' => $companyB->id,+ 'redirect_option' => 'index',])->assertRedirect(route('users.index'));$asset->checkOut($user, $superUser);// asset assigned, therefore error$response = $this->actingAs($superUser)->patchJson(route('users.update', $user), [- 'first_name' => 'test',- 'username' => 'test',- 'company_id' => $companyB->id,- 'redirect_option' => 'index'+ 'first_name' => 'test',+ 'username' => 'test',+ 'company_id' => $companyB->id,+ 'redirect_option' => 'index',]);$this->followRedirects($response)->assertSee('error');}- public function testMultiCompanyUserCanBeUpdatedIfHasAssetInSameCompany()+ public function test_multi_company_user_can_be_updated_if_has_asset_in_same_company(){$this->settings->enableMultipleFullCompanySupport();@@ -235,20 +232,20 @@ class UpdateUserTest extends TestCase// no assets assigned, therefore success$this->actingAs($superUser)->put(route('users.update', $user), [- 'first_name' => 'test',- 'username' => 'test',- 'company_id' => $companyA->id,- 'redirect_option' => 'index'+ 'first_name' => 'test',+ 'username' => 'test',+ 'company_id' => $companyA->id,+ 'redirect_option' => 'index',])->assertRedirect(route('users.index'));$asset->checkOut($user, $superUser);// asset assigned, therefore error$response = $this->actingAs($superUser)->patchJson(route('users.update', $user), [- 'first_name' => 'test',- 'username' => 'test',- 'company_id' => $companyA->id,- 'redirect_option' => 'index'+ 'first_name' => 'test',+ 'username' => 'test',+ 'company_id' => $companyA->id,+ 'redirect_option' => 'index',]);$this->followRedirects($response)->assertSee('success');@@ -257,9 +254,10 @@ class UpdateUserTest extends TestCase/*** This can occur if the user edit screen is open in one tab and* the user is deleted in another before the edit form is submitted.+ ** @link https://app.shortcut.com/grokability/story/29166*/- public function testAttemptingToUpdateDeletedUserIsHandledGracefully()+ public function test_attempting_to_update_deleted_user_is_handled_gracefully(){[$companyA, $companyB] = Company::factory()->count(2)->create();$user = User::factory()->for($companyA)->create();diff --git a/tests/Feature/Users/Ui/ViewUserTest.php b/tests/Feature/Users/Ui/ViewUserTest.phpindex ca45601ffb..5089c92a02 100644--- a/tests/Feature/Users/Ui/ViewUserTest.php+++ b/tests/Feature/Users/Ui/ViewUserTest.php@@ -8,14 +8,14 @@ use Tests\TestCase;class ViewUserTest extends TestCase{- public function testRequiresPermissionToViewUser()+ public function test_requires_permission_to_view_user(){$this->actingAs(User::factory()->create())->get(route('users.show', User::factory()->create()))->assertStatus(403);}- public function testCanViewUser()+ public function test_can_view_user(){$actor = User::factory()->viewUsers()->create();@@ -25,7 +25,7 @@ class ViewUserTest extends TestCase->assertStatus(200);}- public function testCannotViewUserFromAnotherCompany()+ public function test_cannot_view_user_from_another_company(){$this->settings->enableMultipleFullCompanySupport();diff --git a/tests/Support/AssertHasActionLogs.php b/tests/Support/AssertHasActionLogs.phpindex 9db37ca317..d6a2221938 100644--- a/tests/Support/AssertHasActionLogs.php+++ b/tests/Support/AssertHasActionLogs.php@@ -2,17 +2,14 @@namespace Tests\Support;-use App\Models\Actionlog;use Illuminate\Database\Eloquent\Model;use PHPUnit\Framework\Assert;-use function PHPUnit\Framework\assertEquals;trait AssertHasActionLogs{public function assertHasTheseActionLogs(Model $item, array $statuses){- //note we have to do a 'reorder()' here because there is an implicit "order_by created_at" baked in to the relationship- Assert::assertEquals($statuses, $item->assetlog()->reorder('id')->pluck('action_type')->toArray(), "Failed asserting that action logs match");+ // note we have to do a 'reorder()' here because there is an implicit "order_by created_at" baked in to the relationship+ Assert::assertEquals($statuses, $item->assetlog()->reorder('id')->pluck('action_type')->toArray(), 'Failed asserting that action logs match');}--}\ No newline at end of file+}diff --git a/tests/Support/Importing/AccessoriesImportFileBuilder.php b/tests/Support/Importing/AccessoriesImportFileBuilder.phpindex 488c91fdc4..3abe7eaef6 100644--- a/tests/Support/Importing/AccessoriesImportFileBuilder.php+++ b/tests/Support/Importing/AccessoriesImportFileBuilder.php@@ -29,46 +29,46 @@ use Illuminate\Support\Str;class AccessoriesImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'category' => 'Category',- 'companyName' => 'Company',- 'itemName' => 'Item Name',- 'location' => 'Location',+ 'category' => 'Category',+ 'companyName' => 'Company',+ 'itemName' => 'Item Name',+ 'location' => 'Location','manufacturerName' => 'Manufacturer',- 'modelNumber' => 'Model Number',- 'notes' => 'Notes',- 'orderNumber' => 'Order Number',- 'purchaseCost' => 'Purchase Cost',- 'purchaseDate' => 'Purchase Date',- 'quantity' => 'Quantity',- 'supplierName' => 'Supplier',+ 'modelNumber' => 'Model Number',+ 'notes' => 'Notes',+ 'orderNumber' => 'Order Number',+ 'purchaseCost' => 'Purchase Cost',+ 'purchaseDate' => 'Purchase Date',+ 'quantity' => 'Quantity',+ 'supplierName' => 'Supplier',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'category' => Str::random(),- 'companyName' => Str::random(),- 'itemName' => Str::random(),- 'location' => "{$faker->city}, {$faker->country}",+ 'category' => Str::random(),+ 'companyName' => Str::random(),+ 'itemName' => Str::random(),+ 'location' => "{$faker->city}, {$faker->country}",'manufacturerName' => $faker->company,- 'modelNumber' => Str::random(),- 'notes' => $faker->sentence,- 'orderNumber' => Str::random(),- 'purchaseDate' => $faker->date(),- 'purchaseCost' => rand(1, 100),- 'quantity' => rand(1, 100),- 'supplierName' => $faker->company,+ 'modelNumber' => Str::random(),+ 'notes' => $faker->sentence,+ 'orderNumber' => Str::random(),+ 'purchaseDate' => $faker->date(),+ 'purchaseCost' => rand(1, 100),+ 'quantity' => rand(1, 100),+ 'supplierName' => $faker->company,];}}diff --git a/tests/Support/Importing/AssetModelsImportFileBuilder.php b/tests/Support/Importing/AssetModelsImportFileBuilder.phpindex 615e329e47..e5548c9370 100644--- a/tests/Support/Importing/AssetModelsImportFileBuilder.php+++ b/tests/Support/Importing/AssetModelsImportFileBuilder.php@@ -22,36 +22,36 @@ use Illuminate\Support\Str;class AssetModelsImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'name' => 'Name',- 'category' => 'Category',- 'manufacturer' => 'Manufacturer',- 'model_number' => 'Model Number',- 'fieldset' => 'Fieldset',- 'eol' => 'EOL',- 'min_amt' => 'Min Amount',- 'notes' => 'Notes',- 'requestable' => 'Requestable',+ 'name' => 'Name',+ 'category' => 'Category',+ 'manufacturer' => 'Manufacturer',+ 'model_number' => 'Model Number',+ 'fieldset' => 'Fieldset',+ 'eol' => 'EOL',+ 'min_amt' => 'Min Amount',+ 'notes' => 'Notes',+ 'requestable' => 'Requestable',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'name' => $faker->catchPhrase,- 'category' => Str::random(),- 'model_number' => $faker->creditCardNumber(),- 'notes' => 'Created by demo seeder',+ 'name' => $faker->catchPhrase,+ 'category' => Str::random(),+ 'model_number' => $faker->creditCardNumber(),+ 'notes' => 'Created by demo seeder',];}}diff --git a/tests/Support/Importing/AssetsImportFileBuilder.php b/tests/Support/Importing/AssetsImportFileBuilder.phpindex 381cf5dffc..23e55d29aa 100644--- a/tests/Support/Importing/AssetsImportFileBuilder.php+++ b/tests/Support/Importing/AssetsImportFileBuilder.php@@ -35,60 +35,60 @@ use Illuminate\Support\Str;class AssetsImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'id' => 'ID',- 'assigneeFullName' => 'Full Name',- 'assigneeEmail' => 'Email',- 'assigneeUsername' => 'Username',- 'category' => 'Category',- 'companyName' => 'Company',- 'itemName' => 'item Name',- 'location' => 'Location',- 'manufacturerName' => 'Manufacturer',- 'model' => 'Model name',- 'modelNumber' => 'Model Number',- 'notes' => 'Notes',- 'purchaseCost' => 'Purchase Cost',- 'purchaseDate' => 'Purchase Date',- 'serialNumber' => 'Serial number',- 'supplierName' => 'Supplier',- 'status' => 'Status',- 'tag' => 'Asset Tag',- 'warrantyInMonths' => 'Warranty',+ 'id' => 'ID',+ 'assigneeFullName' => 'Full Name',+ 'assigneeEmail' => 'Email',+ 'assigneeUsername' => 'Username',+ 'category' => 'Category',+ 'companyName' => 'Company',+ 'itemName' => 'item Name',+ 'location' => 'Location',+ 'manufacturerName' => 'Manufacturer',+ 'model' => 'Model name',+ 'modelNumber' => 'Model Number',+ 'notes' => 'Notes',+ 'purchaseCost' => 'Purchase Cost',+ 'purchaseDate' => 'Purchase Date',+ 'serialNumber' => 'Serial number',+ 'supplierName' => 'Supplier',+ 'status' => 'Status',+ 'tag' => 'Asset Tag',+ 'warrantyInMonths' => 'Warranty',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'asset_tag' => Str::random(),- 'assigneeFullName' => $faker->name,- 'assigneeEmail' => $faker->email,- 'assigneeUsername' => $faker->userName,- 'category' => Str::random(),- 'companyName' => Str::random() . " {$faker->companySuffix}",- 'itemName' => Str::random(),- 'location' => "{$faker->country},{$faker->city}",- 'manufacturerName' => $faker->company,- 'model' => Str::random(),- 'modelNumber' => Str::random(),- 'notes' => $faker->sentence(5),- 'purchaseCost' => rand(1, 100_000),- 'purchaseDate' => $faker->date,- 'serialNumber' => $faker->uuid,- 'supplierName' => $faker->company,- 'status' => $faker->randomElement(['Ready to Deploy', 'Archived', 'Pending']),- 'tag' => Str::random(),- 'warrantyInMonths' => rand(1, 12),+ 'asset_tag' => Str::random(),+ 'assigneeFullName' => $faker->name,+ 'assigneeEmail' => $faker->email,+ 'assigneeUsername' => $faker->userName,+ 'category' => Str::random(),+ 'companyName' => Str::random()." {$faker->companySuffix}",+ 'itemName' => Str::random(),+ 'location' => "{$faker->country},{$faker->city}",+ 'manufacturerName' => $faker->company,+ 'model' => Str::random(),+ 'modelNumber' => Str::random(),+ 'notes' => $faker->sentence(5),+ 'purchaseCost' => rand(1, 100_000),+ 'purchaseDate' => $faker->date,+ 'serialNumber' => $faker->uuid,+ 'supplierName' => $faker->company,+ 'status' => $faker->randomElement(['Ready to Deploy', 'Archived', 'Pending']),+ 'tag' => Str::random(),+ 'warrantyInMonths' => rand(1, 12),];}}diff --git a/tests/Support/Importing/CategoriesImportFileBuilder.php b/tests/Support/Importing/CategoriesImportFileBuilder.phpindex 42cfdff164..4177516248 100644--- a/tests/Support/Importing/CategoriesImportFileBuilder.php+++ b/tests/Support/Importing/CategoriesImportFileBuilder.php@@ -4,8 +4,6 @@ declare(strict_types=1);namespace Tests\Support\Importing;-use Illuminate\Support\Str;-/*** Build a users import file at runtime for testing.*@@ -26,31 +24,31 @@ use Illuminate\Support\Str;class CategoriesImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'name' => 'name',- 'notes' => 'notes',+ 'name' => 'name',+ 'notes' => 'notes',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'name' => $faker->company,- 'notes' => $faker->sentence,- 'category_type' => 'asset',+ 'name' => $faker->company,+ 'notes' => $faker->sentence,+ 'category_type' => 'asset','require_acceptance' => 1,- 'use_default_eula' => 1,- 'checkin_email' => 1,+ 'use_default_eula' => 1,+ 'checkin_email' => 1,];}}diff --git a/tests/Support/Importing/CleansUpImportFiles.php b/tests/Support/Importing/CleansUpImportFiles.phpindex 8e0cbc3108..b08b83e2d5 100644--- a/tests/Support/Importing/CleansUpImportFiles.php+++ b/tests/Support/Importing/CleansUpImportFiles.php@@ -13,7 +13,7 @@ trait CleansUpImportFilesImport::created(function (Import $import) {$this->beforeApplicationDestroyed(function () use ($import) {- Storage::delete('private_uploads/imports/' . $import->file_path);+ Storage::delete('private_uploads/imports/'.$import->file_path);});});}diff --git a/tests/Support/Importing/ComponentsImportFileBuilder.php b/tests/Support/Importing/ComponentsImportFileBuilder.phpindex 6d0b163419..afc4c0e8a5 100644--- a/tests/Support/Importing/ComponentsImportFileBuilder.php+++ b/tests/Support/Importing/ComponentsImportFileBuilder.php@@ -26,40 +26,40 @@ use Illuminate\Support\Str;class ComponentsImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'category' => 'Category',- 'companyName' => 'Company',- 'itemName' => 'item Name',- 'location' => 'Location',- 'orderNumber' => 'Order Number',+ 'category' => 'Category',+ 'companyName' => 'Company',+ 'itemName' => 'item Name',+ 'location' => 'Location',+ 'orderNumber' => 'Order Number','purchaseCost' => 'Purchase Cost','purchaseDate' => 'Purchase Date',- 'quantity' => 'Quantity',+ 'quantity' => 'Quantity','serialNumber' => 'Serial number',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'category' => Str::random(),- 'companyName' => Str::random() . " {$faker->companySuffix}",- 'itemName' => Str::random(),- 'location' => "{$faker->city}, {$faker->country}",- 'orderNumber' => "ON:COM:{$faker->uuid}",+ 'category' => Str::random(),+ 'companyName' => Str::random()." {$faker->companySuffix}",+ 'itemName' => Str::random(),+ 'location' => "{$faker->city}, {$faker->country}",+ 'orderNumber' => "ON:COM:{$faker->uuid}",'purchaseCost' => rand(1, 100_000),'purchaseDate' => $faker->date,- 'quantity' => rand(1, 100_000),- 'serialNumber' => 'SN:COM:' . Str::random(),+ 'quantity' => rand(1, 100_000),+ 'serialNumber' => 'SN:COM:'.Str::random(),];}}diff --git a/tests/Support/Importing/ConsumablesImportFileBuilder.php b/tests/Support/Importing/ConsumablesImportFileBuilder.phpindex 16722a2f05..0b78fc8144 100644--- a/tests/Support/Importing/ConsumablesImportFileBuilder.php+++ b/tests/Support/Importing/ConsumablesImportFileBuilder.php@@ -26,40 +26,40 @@ use Illuminate\Support\Str;class ConsumablesImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'category' => 'Category',- 'companyName' => 'Company',- 'itemName' => 'item Name',- 'location' => 'Location',- 'orderNumber' => 'Order Number',+ 'category' => 'Category',+ 'companyName' => 'Company',+ 'itemName' => 'item Name',+ 'location' => 'Location',+ 'orderNumber' => 'Order Number','purchaseCost' => 'Purchase Cost','purchaseDate' => 'Purchase Date',- 'quantity' => 'Quantity',- 'supplier' => 'Supplier',+ 'quantity' => 'Quantity',+ 'supplier' => 'Supplier',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'category' => Str::random(),- 'companyName' => Str::random() . " {$faker->companySuffix}",- 'itemName' => Str::random(),- 'location' => "{$faker->city}, {$faker->country}",- 'orderNumber' => "ON:CON:{$faker->uuid}",+ 'category' => Str::random(),+ 'companyName' => Str::random()." {$faker->companySuffix}",+ 'itemName' => Str::random(),+ 'location' => "{$faker->city}, {$faker->country}",+ 'orderNumber' => "ON:CON:{$faker->uuid}",'purchaseCost' => rand(1, 100_000),'purchaseDate' => $faker->date,- 'quantity' => rand(1, 100_000),- 'supplier' => Str::random() . " {$faker->companySuffix}",+ 'quantity' => rand(1, 100_000),+ 'supplier' => Str::random()." {$faker->companySuffix}",];}}diff --git a/tests/Support/Importing/FileBuilder.php b/tests/Support/Importing/FileBuilder.phpindex bf08dc96d1..37b7093497 100644--- a/tests/Support/Importing/FileBuilder.php+++ b/tests/Support/Importing/FileBuilder.php@@ -4,8 +4,8 @@ declare(strict_types=1);namespace Tests\Support\Importing;-use Illuminate\Support\Str;use Illuminate\Support\Collection;+use Illuminate\Support\Str;use League\Csv\Reader;use OutOfBoundsException;@@ -29,7 +29,7 @@ abstract class FileBuilderabstract public function definition();/**- * @param array<Row> $rows+ * @param array<Row> $rows*/public function __construct(array $rows = []){@@ -39,8 +39,7 @@ abstract class FileBuilder/*** Get a new file builder instance.*- * @param Row $attributes- *+ * @param Row $attributes* @return static*/public static function new(array $attributes = [])@@ -66,7 +65,7 @@ abstract class FileBuilderforeach ($reader->getRecords() as $key => $record) {$row = [];- //Skip header.+ // Skip header.if ($key === 0) {continue;}@@ -74,8 +73,8 @@ abstract class FileBuilderforeach ($record as $index => $value) {$columnNameInImportFile = $importFileHeaders[$index];- //Try to map the value to a dictionary or use the file's- //column if the key is not defined in the dictionary.+ // Try to map the value to a dictionary or use the file's+ // column if the key is not defined in the dictionary.$row[$dictionary[$columnNameInImportFile] ?? $columnNameInImportFile] = $value;}@@ -114,13 +113,12 @@ abstract class FileBuilder/*** Add a new row.*- * @param Row $row- *+ * @param Row $row* @return $this*/public function push(array $row){- if (!empty($row)) {+ if (! empty($row)) {$this->rows->push($row);}@@ -138,15 +136,14 @@ abstract class FileBuilder/*** Replace the keys in each row with the values of the given replacement if they exist.*- * @param array<Row> $replacement- *+ * @param array<Row> $replacement* @return $this*/public function replace(array $replacement){$this->rows = $this->rows->map(function (array $row) use ($replacement) {foreach ($replacement as $key => $value) {- if (!array_key_exists($key, $row)) {+ if (! array_key_exists($key, $row)) {continue;}@@ -162,8 +159,7 @@ abstract class FileBuilder/*** Remove the the given keys from all rows.*- * @param string|array<string> $keys- *+ * @param string|array<string> $keys* @return $this*/public function forget(array|string $keys)@@ -208,10 +204,10 @@ abstract class FileBuilder*/public function saveToImportsDirectory(?string $filename = null, ?string $locale = null): string{- $filename ??= Str::random(40) . '.csv';+ $filename ??= Str::random(40).'.csv';try {- $stream = fopen(config('app.private_uploads') . "/imports/{$filename}", 'w');+ $stream = fopen(config('app.private_uploads')."/imports/{$filename}", 'w');foreach ($this->toCsv() as $row) {if ($locale) {@@ -223,6 +219,7 @@ abstract class FileBuilder}fputcsv($stream, $row);}+return $filename;} finally {if (is_resource($stream)) {@@ -234,9 +231,10 @@ abstract class FileBuilder/*** Get the first row of the import file.*- * @throws OutOfBoundsException** @return Row+ *+ * @throws OutOfBoundsException*/public function firstRow(): array{diff --git a/tests/Support/Importing/LicensesImportFileBuilder.php b/tests/Support/Importing/LicensesImportFileBuilder.phpindex 2b5e5c01ee..e7c6ca3ee0 100644--- a/tests/Support/Importing/LicensesImportFileBuilder.php+++ b/tests/Support/Importing/LicensesImportFileBuilder.php@@ -33,54 +33,54 @@ use Illuminate\Support\Str;class LicensesImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'category' => 'Category',- 'companyName' => 'Company',- 'expirationDate' => 'expiration date',- 'isMaintained' => 'maintained',- 'isReassignAble' => 'reassignable',- 'licensedToName' => 'Licensed To Name',- 'licensedToEmail' => 'Licensed to Email',- 'licenseName' => 'Item name',+ 'category' => 'Category',+ 'companyName' => 'Company',+ 'expirationDate' => 'expiration date',+ 'isMaintained' => 'maintained',+ 'isReassignAble' => 'reassignable',+ 'licensedToName' => 'Licensed To Name',+ 'licensedToEmail' => 'Licensed to Email',+ 'licenseName' => 'Item name','manufacturerName' => 'manufacturer',- 'notes' => 'notes',- 'orderNumber' => 'Order Number',- 'purchaseCost' => 'Purchase Cost',- 'purchaseDate' => 'Purchase Date',- 'seats' => 'seats',- 'serialNumber' => 'Serial number',- 'supplierName' => 'supplier',+ 'notes' => 'notes',+ 'orderNumber' => 'Order Number',+ 'purchaseCost' => 'Purchase Cost',+ 'purchaseDate' => 'Purchase Date',+ 'seats' => 'seats',+ 'serialNumber' => 'Serial number',+ 'supplierName' => 'supplier',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'category' => Str::random(),- 'companyName' => Str::random() . " {$faker->companySuffix}",- 'expirationDate' => $faker->date,- 'isMaintained' => $faker->randomElement(['TRUE', 'FALSE']),- 'isReassignAble' => $faker->randomElement(['TRUE', 'FALSE']),- 'licensedToName' => $faker->name,- 'licensedToEmail' => $faker->email,- 'licenseName' => $faker->company,+ 'category' => Str::random(),+ 'companyName' => Str::random()." {$faker->companySuffix}",+ 'expirationDate' => $faker->date,+ 'isMaintained' => $faker->randomElement(['TRUE', 'FALSE']),+ 'isReassignAble' => $faker->randomElement(['TRUE', 'FALSE']),+ 'licensedToName' => $faker->name,+ 'licensedToEmail' => $faker->email,+ 'licenseName' => $faker->company,'manufacturerName' => $faker->company,- 'notes' => $faker->sentence,- 'orderNumber' => "ON:LIC:{$faker->uuid}",- 'purchaseCost' => rand(1, 100_000),- 'purchaseDate' => $faker->date,- 'seats' => rand(1, 10),- 'serialNumber' => 'SN:LIC:' . Str::random(),- 'supplierName' => $faker->company,+ 'notes' => $faker->sentence,+ 'orderNumber' => "ON:LIC:{$faker->uuid}",+ 'purchaseCost' => rand(1, 100_000),+ 'purchaseDate' => $faker->date,+ 'seats' => rand(1, 10),+ 'serialNumber' => 'SN:LIC:'.Str::random(),+ 'supplierName' => $faker->company,];}}diff --git a/tests/Support/Importing/LocationsImportFileBuilder.php b/tests/Support/Importing/LocationsImportFileBuilder.phpindex 59b7dcc416..4cfc69d15f 100644--- a/tests/Support/Importing/LocationsImportFileBuilder.php+++ b/tests/Support/Importing/LocationsImportFileBuilder.php@@ -4,8 +4,6 @@ declare(strict_types=1);namespace Tests\Support\Importing;-use Illuminate\Support\Str;-/*** Build a users import file at runtime for testing.*@@ -26,33 +24,33 @@ use Illuminate\Support\Str;class LocationsImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'name' => 'name',- 'phone' => 'Phone',- 'address' => 'address',- 'address2' => 'address2',- 'city' => 'city',- 'state' => 'state',- 'country' => 'country',- 'zip' => 'zip',- 'notes' => 'notes',+ 'name' => 'name',+ 'phone' => 'Phone',+ 'address' => 'address',+ 'address2' => 'address2',+ 'city' => 'city',+ 'state' => 'state',+ 'country' => 'country',+ 'zip' => 'zip',+ 'notes' => 'notes',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'name' => $faker->company,- 'phone' => $faker->phoneNumber,+ 'name' => $faker->company,+ 'phone' => $faker->phoneNumber,];}}diff --git a/tests/Support/Importing/ManufacturersImportFileBuilder.php b/tests/Support/Importing/ManufacturersImportFileBuilder.phpindex 4b5f4546e4..bd2e151def 100644--- a/tests/Support/Importing/ManufacturersImportFileBuilder.php+++ b/tests/Support/Importing/ManufacturersImportFileBuilder.php@@ -26,33 +26,33 @@ use Illuminate\Support\Str;class ManufacturersImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'name' => 'name',- 'support_email' => 'support_email',- 'support_phone' => 'Support Phone',- 'notes' => 'notes',- 'support_fax' => 'support_fax',- 'support_url' => 'support_url',+ 'name' => 'name',+ 'support_email' => 'support_email',+ 'support_phone' => 'Support Phone',+ 'notes' => 'notes',+ 'support_fax' => 'support_fax',+ 'support_url' => 'support_url',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'name' => $faker->company,- 'support_email' => Str::random(32) . "@{$faker->freeEmailDomain}",- 'support_phone' => $faker->phoneNumber,- 'support_fax' => $faker->phoneNumber,- 'support_url' => $faker->url(),+ 'name' => $faker->company,+ 'support_email' => Str::random(32)."@{$faker->freeEmailDomain}",+ 'support_phone' => $faker->phoneNumber,+ 'support_fax' => $faker->phoneNumber,+ 'support_url' => $faker->url(),];}}diff --git a/tests/Support/Importing/SuppliersImportFileBuilder.php b/tests/Support/Importing/SuppliersImportFileBuilder.phpindex 7666174993..15fd15e92e 100644--- a/tests/Support/Importing/SuppliersImportFileBuilder.php+++ b/tests/Support/Importing/SuppliersImportFileBuilder.php@@ -26,41 +26,41 @@ use Illuminate\Support\Str;class SuppliersImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'name' => 'name',- 'email' => 'email',- 'contact' => 'contact',- 'phone' => 'Phone',- 'address' => 'address',- 'address2' => 'address2',- 'city' => 'city',- 'state' => 'state',- 'country' => 'country',- 'zip' => 'zip',- 'notes' => 'notes',- 'fax' => 'fax',- 'url' => 'url',+ 'name' => 'name',+ 'email' => 'email',+ 'contact' => 'contact',+ 'phone' => 'Phone',+ 'address' => 'address',+ 'address2' => 'address2',+ 'city' => 'city',+ 'state' => 'state',+ 'country' => 'country',+ 'zip' => 'zip',+ 'notes' => 'notes',+ 'fax' => 'fax',+ 'url' => 'url',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'name' => $faker->company,- 'email' => Str::random(32) . "@{$faker->freeEmailDomain}",- 'contact' => $faker->firstName,- 'phone' => $faker->phoneNumber,- 'fax' => $faker->phoneNumber,- 'url' => $faker->url(),+ 'name' => $faker->company,+ 'email' => Str::random(32)."@{$faker->freeEmailDomain}",+ 'contact' => $faker->firstName,+ 'phone' => $faker->phoneNumber,+ 'fax' => $faker->phoneNumber,+ 'url' => $faker->url(),];}}diff --git a/tests/Support/Importing/UsersImportFileBuilder.php b/tests/Support/Importing/UsersImportFileBuilder.phpindex 0490cf230a..619f36c262 100644--- a/tests/Support/Importing/UsersImportFileBuilder.php+++ b/tests/Support/Importing/UsersImportFileBuilder.php@@ -4,8 +4,6 @@ declare(strict_types=1);namespace Tests\Support\Importing;-use Illuminate\Support\Str;-/*** Build a users import file at runtime for testing.*@@ -26,42 +24,42 @@ use Illuminate\Support\Str;class UsersImportFileBuilder extends FileBuilder{/**- * @inheritdoc+ * {@inheritdoc}*/protected function getDictionary(): array{return [- 'companyName' => 'Company',- 'email' => 'email',- 'employeeNumber' => 'Employee Number',- 'firstName' => 'First Name',- 'lastName' => 'Last Name',- 'displayName' => 'Display Name',- 'location' => 'Location',- 'phoneNumber' => 'Phone Number',- 'position' => 'Job Title',- 'username' => 'Username',+ 'companyName' => 'Company',+ 'email' => 'email',+ 'employeeNumber' => 'Employee Number',+ 'firstName' => 'First Name',+ 'lastName' => 'Last Name',+ 'displayName' => 'Display Name',+ 'location' => 'Location',+ 'phoneNumber' => 'Phone Number',+ 'position' => 'Job Title',+ 'username' => 'Username',];}/**- * @inheritdoc+ * {@inheritdoc}*/public function definition(): array{$faker = fake();return [- 'companyName' => $faker->company,- 'email' => $faker->safeEmail(),- 'employeeNumber' => $faker->uuid,- 'firstName' => $faker->firstName,- 'lastName' => $faker->lastName,- 'displayName' => $faker->firstName,- 'location' => "{$faker->city}, {$faker->country}",- 'phoneNumber' => $faker->phoneNumber,- 'position' => $faker->jobTitle,- 'username' => $faker->userName(),+ 'companyName' => $faker->company,+ 'email' => $faker->safeEmail(),+ 'employeeNumber' => $faker->uuid,+ 'firstName' => $faker->firstName,+ 'lastName' => $faker->lastName,+ 'displayName' => $faker->firstName,+ 'location' => "{$faker->city}, {$faker->country}",+ 'phoneNumber' => $faker->phoneNumber,+ 'position' => $faker->jobTitle,+ 'username' => $faker->userName(),];}}diff --git a/tests/Support/InitializesSettings.php b/tests/Support/InitializesSettings.phpindex 7c08e6f897..ee55a86f9d 100644--- a/tests/Support/InitializesSettings.php+++ b/tests/Support/InitializesSettings.php@@ -12,6 +12,6 @@ trait InitializesSettings{$this->settings = Settings::initialize();- $this->beforeApplicationDestroyed(fn() => Setting::$_cache = null);+ $this->beforeApplicationDestroyed(fn () => Setting::$_cache = null);}}diff --git a/tests/Support/ProvidesDataForFullMultipleCompanySupportTesting.php b/tests/Support/ProvidesDataForFullMultipleCompanySupportTesting.phpindex d247b98161..75e8a5bc92 100644--- a/tests/Support/ProvidesDataForFullMultipleCompanySupportTesting.php+++ b/tests/Support/ProvidesDataForFullMultipleCompanySupportTesting.php@@ -29,10 +29,10 @@ trait ProvidesDataForFullMultipleCompanySupportTestingself::assertEquals($jedi->id, $model->company_id);},];- }+ },];- yield "User without a company should result in company_id being null" => [+ yield 'User without a company should result in company_id being null' => [function () {$userInNoCompany = User::factory()->createAccessories()@@ -49,10 +49,10 @@ trait ProvidesDataForFullMultipleCompanySupportTestingself::assertNull($model->company_id);},];- }+ },];- yield "Super-User assigning across companies should result in company_id being set to what was provided" => [+ yield 'Super-User assigning across companies should result in company_id being set to what was provided' => [function () {$superUser = User::factory()->superuser()->create(['company_id' => null]);$company = Company::factory()->create();@@ -64,7 +64,7 @@ trait ProvidesDataForFullMultipleCompanySupportTestingself::assertEquals($model->company_id, $company->id);},];- }+ },];}}diff --git a/tests/Support/Settings.php b/tests/Support/Settings.phpindex f675c5438a..3acbf46b9c 100644--- a/tests/Support/Settings.php+++ b/tests/Support/Settings.php@@ -16,7 +16,7 @@ class Settingspublic static function initialize(): Settings{- return new self();+ return new self;}public function enableAlertEmail(string $email = '[email protected]'): Settings@@ -26,18 +26,21 @@ class Settings'alerts_enabled' => 1,]);}+public function setAlertInterval(int $days): Settings{return $this->update(['alert_threshold' => $days,]);}+public function setAuditWarningDays(int $days): Settings{return $this->update(['audit_warning_days' => $days,]);}+public function disableAlertEmail(): Settings{return $this->update([@@ -93,6 +96,7 @@ class Settings'webhook_channel' => '#it',]);}+public function enableMicrosoftTeamsWebhook(): Settings{return $this->update([@@ -105,7 +109,7 @@ class Settings{return $this->update(['webhook_selected' => 'google',- 'webhook_botname' => 'SnipeBot5000',+ 'webhook_botname' => 'SnipeBot5000','webhook_endpoint' => 'https://chat.googleapis.com/v1/spaces/AAAATQckuT4/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=bZDaFDK4lO78HhHmC8BEWI6aAKkgqX2gFv2gHVAc8',]);}@@ -126,7 +130,7 @@ class Settings'auto_increment_assets' => 1,'auto_increment_prefix' => 'ABCD','next_auto_tag_base' => 123,- 'zerofill_count' => 5+ 'zerofill_count' => 5,]);}@@ -136,7 +140,7 @@ class Settings'auto_increment_assets' => 0,'auto_increment_prefix' => 0,'next_auto_tag_base' => 0,- 'zerofill_count' => 0+ 'zerofill_count' => 0,]);}@@ -156,8 +160,8 @@ class Settings'ldap_enabled' => 1,'ldap_server' => 'ldaps://ldap.example.com','ldap_uname' => 'fake_username',- 'ldap_pword' => Crypt::encrypt("fake_password"),- 'ldap_basedn' => 'CN=Users,DC=ad,DC=example,Dc=com'+ 'ldap_pword' => Crypt::encrypt('fake_password'),+ 'ldap_basedn' => 'CN=Users,DC=ad,DC=example,Dc=com',]);}@@ -166,9 +170,9 @@ class Settingsreturn $this->update(['ldap_enabled' => 1,'ldap_server' => 'ldaps://ldap.example.com',-// 'ldap_uname' => 'fake_username',- 'ldap_pword' => Crypt::encrypt("fake_password"),- 'ldap_basedn' => 'CN=Users,DC=ad,DC=example,Dc=com'+ // 'ldap_uname' => 'fake_username',+ 'ldap_pword' => Crypt::encrypt('fake_password'),+ 'ldap_basedn' => 'CN=Users,DC=ad,DC=example,Dc=com',]);}@@ -178,17 +182,18 @@ class Settings'ldap_enabled' => 1,'ldap_server' => 'ldaps://ldap.example.com','ldap_uname' => 'fake_username',- 'ldap_pword' => "badly_encrypted_password!",- 'ldap_basedn' => 'CN=Users,DC=ad,DC=example,Dc=com'+ 'ldap_pword' => 'badly_encrypted_password!',+ 'ldap_basedn' => 'CN=Users,DC=ad,DC=example,Dc=com',]);}+public function setEula($text = 'Default EULA text'){return $this->update(['default_eula_text' => $text]);}/**- * @param array $attributes Attributes to modify in the application's settings.+ * @param array $attributes Attributes to modify in the application's settings.*/public function set(array $attributes): Settings{@@ -197,7 +202,7 @@ class Settingsprivate function update(array $attributes): Settings{- Setting::unguarded(fn() => $this->setting->update($attributes));+ Setting::unguarded(fn () => $this->setting->update($attributes));Setting::$_cache = null;return $this;diff --git a/tests/TestCase.php b/tests/TestCase.phpindex d9f848650a..6ae0a6b638 100644--- a/tests/TestCase.php+++ b/tests/TestCase.php@@ -6,23 +6,23 @@ use App\Http\Middleware\SecurityHeaders;use Illuminate\Foundation\Testing\LazilyRefreshDatabase;use Illuminate\Foundation\Testing\TestCase as BaseTestCase;use RuntimeException;-use Tests\Support\AssertsAgainstSlackNotifications;use Tests\Support\AssertHasActionLogs;+use Tests\Support\AssertsAgainstSlackNotifications;use Tests\Support\CanSkipTests;use Tests\Support\CustomTestMacros;-use Tests\Support\InteractsWithAuthentication;use Tests\Support\InitializesSettings;+use Tests\Support\InteractsWithAuthentication;abstract class TestCase extends BaseTestCase{+ use AssertHasActionLogs;use AssertsAgainstSlackNotifications;use CanSkipTests;use CreatesApplication;use CustomTestMacros;- use InteractsWithAuthentication;use InitializesSettings;+ use InteractsWithAuthentication;use LazilyRefreshDatabase;- use AssertHasActionLogs;private array $globallyDisabledMiddleware = [SecurityHeaders::class,@@ -43,11 +43,10 @@ abstract class TestCase extends BaseTestCaseprivate function guardAgainstMissingEnv(): void{- if (!file_exists(realpath(__DIR__ . '/../') . '/.env.testing')) {+ if (! file_exists(realpath(__DIR__.'/../').'/.env.testing')) {throw new RuntimeException('.env.testing file does not exist. Aborting to avoid wiping your local database.');}}-}diff --git a/tests/Unit/AccessoryTest.php b/tests/Unit/AccessoryTest.phpindex ec931fad6e..b41d41133d 100644--- a/tests/Unit/AccessoryTest.php+++ b/tests/Unit/AccessoryTest.php@@ -1,56 +1,55 @@<?php+namespace Tests\Unit;use App\Models\Accessory;-use App\Models\Manufacturer;-use App\Models\Location;use App\Models\Category;use App\Models\Company;+use App\Models\Location;+use App\Models\Manufacturer;use Tests\TestCase;class AccessoryTest extends TestCase{- public function testAnAccessoryBelongsToACompany()+ public function test_an_accessory_belongs_to_a_company(){$accessory = Accessory::factory()- ->create(- [- 'company_id' =>- Company::factory()->create()->id]);+ ->create(+ [+ 'company_id' => Company::factory()->create()->id]);$this->assertInstanceOf(Company::class, $accessory->company);}- public function testAnAccessoryHasALocation()+ public function test_an_accessory_has_a_location(){$accessory = Accessory::factory()->create([- 'location_id' => Location::factory()->create()->id+ 'location_id' => Location::factory()->create()->id,]);$this->assertInstanceOf(Location::class, $accessory->location);}- public function testAnAccessoryBelongsToACategory()+ public function test_an_accessory_belongs_to_a_category(){$accessory = Accessory::factory()->appleBtKeyboard()->create([- 'category_id' =>- Category::factory()->create(- [- 'category_type' => 'accessory'- ]- )->id]);+ 'category_id' => Category::factory()->create(+ [+ 'category_type' => 'accessory',+ ]+ )->id]);$this->assertInstanceOf(Category::class, $accessory->category);$this->assertEquals('accessory', $accessory->category->category_type);}- public function testAnAccessoryHasAManufacturer()+ public function test_an_accessory_has_a_manufacturer(){$accessory = Accessory::factory()->appleBtKeyboard()->create(['category_id' => Category::factory()->create(),- 'manufacturer_id' => Manufacturer::factory()->apple()->create()+ 'manufacturer_id' => Manufacturer::factory()->apple()->create(),]);$this->assertInstanceOf(Manufacturer::class, $accessory->manufacturer);}diff --git a/tests/Unit/AssetModelTest.php b/tests/Unit/AssetModelTest.phpindex 4cc62e20a0..dd0fa5ec92 100644--- a/tests/Unit/AssetModelTest.php+++ b/tests/Unit/AssetModelTest.php@@ -1,25 +1,26 @@<?php+namespace Tests\Unit;use App\Models\Asset;-use App\Models\Category;use App\Models\AssetModel;+use App\Models\Category;use Tests\TestCase;class AssetModelTest extends TestCase{- public function testAnAssetModelContainsAssets()+ public function test_an_asset_model_contains_assets(){$category = Category::factory()->create([- 'category_type' => 'asset'- ]);+ 'category_type' => 'asset',+ ]);$model = AssetModel::factory()->create(['category_id' => $category->id,]);-+$asset = Asset::factory()->create([- 'model_id' => $model->id- ]);+ 'model_id' => $model->id,+ ]);$this->assertEquals(1, $model->assets()->count());}}diff --git a/tests/Unit/AssetTest.php b/tests/Unit/AssetTest.phpindex cda91c9c1e..11468c2f48 100644--- a/tests/Unit/AssetTest.php+++ b/tests/Unit/AssetTest.php@@ -1,43 +1,44 @@<?php+namespace Tests\Unit;use App\Http\Controllers\Assets\BulkAssetsController;use App\Models\Asset;use App\Models\AssetModel;use App\Models\Category;+use App\Models\Setting;use App\Models\Statuslabel;use App\Models\User;use Carbon\Carbon;use Tests\TestCase;-use App\Models\Setting;class AssetTest extends TestCase{- public function testAutoIncrement()+ public function test_auto_increment(){$this->settings->enableAutoIncrement();- $a = Asset::factory()->create(['asset_tag' => Asset::autoincrement_asset() ]);- $b = Asset::factory()->create(['asset_tag' => Asset::autoincrement_asset() ]);+ $a = Asset::factory()->create(['asset_tag' => Asset::autoincrement_asset()]);+ $b = Asset::factory()->create(['asset_tag' => Asset::autoincrement_asset()]);$this->assertModelExists($a);$this->assertModelExists($b);}- public function testAutoIncrementCollision()+ public function test_auto_increment_collision(){$this->settings->enableAutoIncrement();// we have to do this by hand to 'simulate' two web pages being open at the same time- $a = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset() ]);- $b = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset() ]);+ $a = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset()]);+ $b = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset()]);$this->assertTrue($a->save());$this->assertFalse($b->save());}- public function testAutoIncrementDouble()+ public function test_auto_increment_double(){// make one asset with the autoincrement *ONE* higher than the next auto-increment// make sure you can then still make another@@ -45,18 +46,18 @@ class AssetTest extends TestCase$gap_number = Asset::autoincrement_asset(1);$final_number = Asset::autoincrement_asset(2);- $a = Asset::factory()->make(['asset_tag' => $gap_number]); //make an asset with an ID that is one *over* the next increment- $b = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset()]); //but also make one with one that is *at* the next increment+ $a = Asset::factory()->make(['asset_tag' => $gap_number]); // make an asset with an ID that is one *over* the next increment+ $b = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset()]); // but also make one with one that is *at* the next increment$this->assertTrue($a->save());$this->assertTrue($b->save());- //and ensure a final asset ends up at *two* over what would've been the next increment at the start+ // and ensure a final asset ends up at *two* over what would've been the next increment at the start$c = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset()]);$this->assertTrue($c->save());$this->assertEquals($c->asset_tag, $final_number);}- public function testAutoIncrementGapAndBackfill()+ public function test_auto_increment_gap_and_backfill(){// make one asset 3 higher than the next auto-increment// manually make one that's 1 lower than that@@ -85,7 +86,7 @@ class AssetTest extends TestCase$this->assertEquals($final->asset_tag, $final_result);}- public function testPrefixlessAutoincrementBackfill()+ public function test_prefixless_autoincrement_backfill(){// TODO: COPYPASTA FROM above, is there a way to still run this test but not have it be so duplicative?$this->settings->enableAutoIncrement()->set(['auto_increment_prefix' => '']);@@ -112,10 +113,10 @@ class AssetTest extends TestCase$this->assertEquals($final->asset_tag, $final_result);}- public function testUnzerofilledPrefixlessAutoincrementBackfill()+ public function test_unzerofilled_prefixless_autoincrement_backfill(){// TODO: COPYPASTA FROM above (AGAIN), is there a way to still run this test but not have it be so duplicative?- $this->settings->enableAutoIncrement()->set(['auto_increment_prefix' => '','zerofill_count' => 0]);+ $this->settings->enableAutoIncrement()->set(['auto_increment_prefix' => '', 'zerofill_count' => 0]);$big_gap = Asset::autoincrement_asset(3);$final_result = Asset::autoincrement_asset(4);@@ -139,13 +140,13 @@ class AssetTest extends TestCase$this->assertEquals($final->asset_tag, $final_result);}- public function testAutoIncrementBIG()+ public function test_auto_increment_big(){$this->settings->enableAutoIncrement();// we have to do this by hand to 'simulate' two web pages being open at the same time$a = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset()]);- $b = Asset::factory()->make(['asset_tag' => 'ABCD' . (PHP_INT_MAX - 1)]);+ $b = Asset::factory()->make(['asset_tag' => 'ABCD'.(PHP_INT_MAX - 1)]);$this->assertTrue($a->save());$this->assertTrue($b->save());@@ -154,55 +155,53 @@ class AssetTest extends TestCase$this->assertEquals(Setting::getSettings()->next_auto_tag_base, $matches[0] + 1, "Next auto increment number should be the last normally-saved one plus one, but isn't");}- public function testAutoIncrementAlmostBIG()+ public function test_auto_increment_almost_big(){// TODO: this looks pretty close to the one above, could we maybe squish them together?$this->settings->enableAutoIncrement();// we have to do this by hand to 'simulate' two web pages being open at the same time$a = Asset::factory()->make(['asset_tag' => Asset::autoincrement_asset()]);- $b = Asset::factory()->make(['asset_tag' => 'ABCD' . (PHP_INT_MAX - 2)]);+ $b = Asset::factory()->make(['asset_tag' => 'ABCD'.(PHP_INT_MAX - 2)]);$this->assertTrue($a->save());$this->assertTrue($b->save());$matches = [];- preg_match('/\d+/', $b->asset_tag, $matches); //this is *b*, not *a* - slight difference from above test+ preg_match('/\d+/', $b->asset_tag, $matches); // this is *b*, not *a* - slight difference from above test$this->assertEquals(Setting::getSettings()->next_auto_tag_base, $matches[0] + 1, "Next auto increment number should be the last normally-saved one plus one, but isn't");}-- public function testWarrantyExpiresAttribute()+ public function test_warranty_expires_attribute(){$asset = Asset::factory()- ->create(- [- 'model_id' => AssetModel::factory()- ->create(- [- 'category_id' => Category::factory()->assetLaptopCategory()->create()->id- ]- )->id,- 'warranty_months' => 24,- 'purchase_date' => Carbon::createFromDate(2017, 1, 1)->hour(0)->minute(0)->second(0)- ]);+ ->create(+ [+ 'model_id' => AssetModel::factory()+ ->create(+ [+ 'category_id' => Category::factory()->assetLaptopCategory()->create()->id,+ ]+ )->id,+ 'warranty_months' => 24,+ 'purchase_date' => Carbon::createFromDate(2017, 1, 1)->hour(0)->minute(0)->second(0),+ ]);-$this->assertEquals(Carbon::createFromDate(2017, 1, 1)->format('Y-m-d'), $asset->purchase_date->format('Y-m-d'));$this->assertEquals(Carbon::createFromDate(2019, 1, 1)->format('Y-m-d'), $asset->warranty_expires->format('Y-m-d'));}- public function testAssignedTypeWithoutAssignTo()+ public function test_assigned_type_without_assign_to(){$user = User::factory()->create();$asset = Asset::factory()->create([- 'assigned_to' => $user->id+ 'assigned_to' => $user->id,]);$this->assertModelMissing($asset);}- public function testGetImageUrlMethod()+ public function test_get_image_url_method(){$urlBase = config('filesystems.disks.public.url');@@ -240,27 +239,29 @@ class AssetTest extends TestCase$this->assertFalse($asset->refresh()->getImageUrl());}- public function testUndeployableStatusReturnsFalseifAssetIsDeployable()++ public function test_undeployable_status_returns_falseif_asset_is_deployable(){$assets = Asset::factory()->count(3)->create();$asset_ids = $assets->pluck('id')->toArray();- $bulk_assets = new BulkAssetsController();+ $bulk_assets = new BulkAssetsController;$result = $bulk_assets->hasUndeployableStatus($asset_ids);$this->assertFalse($result);}- public function testUndeployableStatusReturnsTrueandTagsIfAssetIsUnDeployable()++ public function test_undeployable_status_returns_trueand_tags_if_asset_is_un_deployable(){$deployable = Asset::factory()->create();$undeployableStatus = Statuslabel::factory()->create(['deployable' => 0]);$undeployable = Asset::factory()->create([- 'status_id' => $undeployableStatus->id+ 'status_id' => $undeployableStatus->id,]);- $bulk_assets = new BulkAssetsController();+ $bulk_assets = new BulkAssetsController;$result = $bulk_assets->hasUndeployableStatus([$deployable->id, $undeployable->id]);@@ -270,16 +271,16 @@ class AssetTest extends TestCase$this->assertEquals($undeployable->asset_tag, $result['tags'][0]['asset_tag']);}- public function testUndeployableStatusCheckFiltersOutUndeployableIds()+ public function test_undeployable_status_check_filters_out_undeployable_ids(){$deployable = Asset::factory()->create();$undeployableStatus = Statuslabel::factory()->create(['deployable' => 0]);$undeployable = Asset::factory()->create([- 'status_id' => $undeployableStatus->id+ 'status_id' => $undeployableStatus->id,]);- $bulk_assets = new BulkAssetsController();+ $bulk_assets = new BulkAssetsController;$result = $bulk_assets->hasUndeployableStatus([$deployable->id, $undeployable->id]);diff --git a/tests/Unit/BladeComponents/IconComponentTest.php b/tests/Unit/BladeComponents/IconComponentTest.phpindex b418b38384..58b333d1d4 100644--- a/tests/Unit/BladeComponents/IconComponentTest.php+++ b/tests/Unit/BladeComponents/IconComponentTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class IconComponentTest extends TestCase{- public function testIconComponentDoesNotEndInNewline()+ public function test_icon_component_does_not_end_in_newline(){$renderedTemplateString = View::make('blade.icon', ['type' => 'checkout'])->render();diff --git a/tests/Unit/BladeComponents/UserFullNameTest.php b/tests/Unit/BladeComponents/UserFullNameTest.phpindex feb88ff71d..6d1f6acc44 100644--- a/tests/Unit/BladeComponents/UserFullNameTest.php+++ b/tests/Unit/BladeComponents/UserFullNameTest.php@@ -23,7 +23,7 @@ class UserFullNameTest extends TestCaseAssert::assertStringContainsString('Jim Bagg', $rendered);},];- }+ },];yield 'Renders struck-through link to user if they are deleted and the authenticated user can view them' => [@@ -36,7 +36,7 @@ class UserFullNameTest extends TestCaseAssert::assertStringContainsString('Jim Bagg', $rendered);},];- }+ },];yield 'Renders name without link if the authenticated user cannot view them' => [@@ -49,7 +49,7 @@ class UserFullNameTest extends TestCaseAssert::assertStringNotContainsString('<a ', $rendered);},];- }+ },];yield 'Renders struck-through name without link if the user is deleted and the authenticated user cannot view them' => [@@ -61,7 +61,7 @@ class UserFullNameTest extends TestCaseAssert::assertStringContainsString('<s><span>Jim Bagg', $rendered);},];- }+ },];yield 'Renders nothing if the provided user is null' => [@@ -73,16 +73,16 @@ class UserFullNameTest extends TestCaseAssert::assertEmpty($rendered);},];- }+ },];}#[DataProvider('provider')]- public function testComponent($provided)+ public function test_component($provided){['actor' => $actor, 'user' => $user, 'assertions' => $assertions] = $provided();- // $user->displayName();+ // $user->displayName();// \Log::error($user->toArray());diff --git a/tests/Unit/CategoryTest.php b/tests/Unit/CategoryTest.phpindex 8b1b16ee9f..bf44c65806 100644--- a/tests/Unit/CategoryTest.php+++ b/tests/Unit/CategoryTest.php@@ -1,55 +1,54 @@<?php+namespace Tests\Unit;-use App\Models\Category;-use App\Models\AssetModel;use App\Models\Asset;+use App\Models\AssetModel;+use App\Models\Category;use Tests\TestCase;class CategoryTest extends TestCase{- public function testFailsEmptyValidation()+ public function test_fails_empty_validation(){// An Asset requires a name, a qty, and a category_id.$a = Category::create();$this->assertFalse($a->isValid());$fields = [- 'name' => 'name',- 'category_type' => 'category type',- ];+ 'name' => 'name',+ 'category_type' => 'category type',+ ];$errors = $a->getErrors();foreach ($fields as $field => $fieldTitle) {$this->assertEquals($errors->get($field)[0], "The $fieldTitle field is required.");}}- public function testACategoryCanHaveAssets()+ public function test_a_category_can_have_assets(){- $category = Category::factory()->assetDesktopCategory()->create();+ $category = Category::factory()->assetDesktopCategory()->create();- // Generate 5 models via factory- $models = AssetModel::factory()+ // Generate 5 models via factory+ $models = AssetModel::factory()->count(5)->create([- 'category_id' => $category->id+ 'category_id' => $category->id,]- );--+ );// Loop through the models and create 2 assets in each model- $models->each(function ($model) {- //dd($model);+ $models->each(function ($model) {+ // dd($model);$asset = Asset::factory()- ->count(2)- ->create(- [- 'model_id' => $model->id,- ]- );- //dd($asset);+ ->count(2)+ ->create(+ [+ 'model_id' => $model->id,+ ]+ );+ // dd($asset);});$this->assertCount(5, $category->models);diff --git a/tests/Unit/CompanyScopingTest.php b/tests/Unit/CompanyScopingTest.phpindex f1a6daaf0c..894f15a97d 100644--- a/tests/Unit/CompanyScopingTest.php+++ b/tests/Unit/CompanyScopingTest.php@@ -2,17 +2,17 @@namespace Tests\Unit;-use PHPUnit\Framework\Attributes\DataProvider;use App\Models\Accessory;use App\Models\Asset;-use App\Models\Maintenance;use App\Models\Company;use App\Models\Component;use App\Models\Consumable;use App\Models\License;use App\Models\LicenseSeat;+use App\Models\Maintenance;use App\Models\User;use Illuminate\Database\Eloquent\Model;+use PHPUnit\Framework\Attributes\DataProvider;use Tests\TestCase;class CompanyScopingTest extends TestCase@@ -29,7 +29,7 @@ class CompanyScopingTest extends TestCase}#[DataProvider('models')]- public function testCompanyScoping($model)+ public function test_company_scoping($model){[$companyA, $companyB] = Company::factory()->count(2)->create();@@ -69,7 +69,7 @@ class CompanyScopingTest extends TestCase$this->assertCanSee($modelB);}- public function testMaintenanceCompanyScoping()+ public function test_maintenance_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();@@ -109,7 +109,7 @@ class CompanyScopingTest extends TestCase$this->assertCanSee($maintenanceForCompanyB);}- public function testLicenseSeatCompanyScoping()+ public function test_license_seat_company_scoping(){[$companyA, $companyB] = Company::factory()->count(2)->create();diff --git a/tests/Unit/ComponentTest.php b/tests/Unit/ComponentTest.phpindex 6abbffd82d..a6beb489a6 100644--- a/tests/Unit/ComponentTest.php+++ b/tests/Unit/ComponentTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit;use App\Models\Asset;@@ -11,35 +12,34 @@ use Tests\TestCase;class ComponentTest extends TestCase{- public function testAComponentBelongsToACompany()+ public function test_a_component_belongs_to_a_company(){$component = Component::factory()->create(- [- 'company_id' => Company::factory()->create()->id- ]- );+ [+ 'company_id' => Company::factory()->create()->id,+ ]+ );$this->assertInstanceOf(Company::class, $component->company);}- public function testAComponentHasALocation()+ public function test_a_component_has_a_location(){$component = Component::factory()->create(['location_id' => Location::factory()->create()->id]);$this->assertInstanceOf(Location::class, $component->location);}- public function testAComponentBelongsToACategory()+ public function test_a_component_belongs_to_a_category(){$component = Component::factory()->ramCrucial4()->create([- 'category_id' =>- Category::factory()->create(- [- 'category_type' => 'component'- ]- )->id]);+ 'category_id' => Category::factory()->create(+ [+ 'category_type' => 'component',+ ]+ )->id]);$this->assertInstanceOf(Category::class, $component->category);$this->assertEquals('component', $component->category->category_type);}diff --git a/tests/Unit/CustomFieldTest.php b/tests/Unit/CustomFieldTest.phpindex d5704d8aa3..47415573a0 100644--- a/tests/Unit/CustomFieldTest.php+++ b/tests/Unit/CustomFieldTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit;use App\Models\CustomField;@@ -10,34 +11,34 @@ use Tests\TestCase;*/class CustomFieldTest extends TestCase{- public function testFormat()+ public function test_format(){$customfield = CustomField::factory()->make(['format' => 'IP']);- $this->assertEquals($customfield->getAttributes()['format'], CustomField::PREDEFINED_FORMATS['IP']); //this seems undocumented...+ $this->assertEquals($customfield->getAttributes()['format'], CustomField::PREDEFINED_FORMATS['IP']); // this seems undocumented...$this->assertEquals($customfield->format, 'IP');}- public function testDbNameAscii()+ public function test_db_name_ascii(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = 'My hovercraft is full of eels';$customfield->id = 1337;$this->assertEquals($customfield->convertUnicodeDbSlug(), '_snipeit_my_hovercraft_is_full_of_eels_1337');}// Western Europe- public function testDbNameLatin()+ public function test_db_name_latin(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = 'My hovercraft is full of eels';$customfield->id = 1337;$this->assertEquals($customfield->convertUnicodeDbSlug(), '_snipeit_my_hovercraft_is_full_of_eels_1337');}// Asian- public function testDbNameChinese()+ public function test_db_name_chinese(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = '我的氣墊船裝滿了鱔魚';$customfield->id = 1337;if (function_exists('transliterator_transliterate')) {@@ -47,9 +48,9 @@ class CustomFieldTest extends TestCase}}- public function testDbNameJapanese()+ public function test_db_name_japanese(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = '私のホバークラフトは鰻でいっぱいです';$customfield->id = 1337;if (function_exists('transliterator_transliterate')) {@@ -59,9 +60,9 @@ class CustomFieldTest extends TestCase}}- public function testDbNameKorean()+ public function test_db_name_korean(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = '내 호버크라프트는 장어로 가득 차 있어요';$customfield->id = 1337;if (function_exists('transliterator_transliterate')) {@@ -72,9 +73,9 @@ class CustomFieldTest extends TestCase}// Nordic languages- public function testDbNameNonLatinEuro()+ public function test_db_name_non_latin_euro(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = 'Mój poduszkowiec jest pełen węgorzy';$customfield->id = 1337;if (function_exists('transliterator_transliterate')) {@@ -85,9 +86,9 @@ class CustomFieldTest extends TestCase}//- public function testDbNameTurkish()+ public function test_db_name_turkish(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = 'Hoverkraftım yılan balığı dolu';$customfield->id = 1337;if (function_exists('transliterator_transliterate')) {@@ -97,9 +98,9 @@ class CustomFieldTest extends TestCase}}- public function testDbNameArabic()+ public function test_db_name_arabic(){- $customfield = new CustomField();+ $customfield = new CustomField;$customfield->name = 'حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون';$customfield->id = 1337;if (function_exists('transliterator_transliterate')) {diff --git a/tests/Unit/DatabaseSslConfigurationTest.php b/tests/Unit/DatabaseSslConfigurationTest.phpindex bdc8b7dc60..4e408f23c1 100644--- a/tests/Unit/DatabaseSslConfigurationTest.php+++ b/tests/Unit/DatabaseSslConfigurationTest.php@@ -7,15 +7,15 @@ use Tests\TestCase;class DatabaseSslConfigurationTest extends TestCase{- public function testMysqlSslConfigurationWithPaasMode(): void+ public function test_mysql_ssl_configuration_with_paas_mode(): void{config([- 'database.connections.mysql.options' => null+ 'database.connections.mysql.options' => null,]);// Test PAAS mode SSL configurationconfig([- 'database.connections.mysql.options' => $this->getSslOptions(true, false, true) // isPaas=true, verifyServer=false, sslEnabled=true+ 'database.connections.mysql.options' => $this->getSslOptions(true, false, true), // isPaas=true, verifyServer=false, sslEnabled=true]);$options = config('database.connections.mysql.options');@@ -29,15 +29,15 @@ class DatabaseSslConfigurationTest extends TestCase$this->assertArrayNotHasKey(PDO::MYSQL_ATTR_SSL_CIPHER, $options);}- public function testMysqlSslConfigurationWithNonPaasMode(): void+ public function test_mysql_ssl_configuration_with_non_paas_mode(): void{config([- 'database.connections.mysql.options' => null+ 'database.connections.mysql.options' => null,]);// Test non-PAAS mode SSL configurationconfig([- 'database.connections.mysql.options' => $this->getSslOptions(false, false, true) // isPaas=false, verifyServer=false, sslEnabled=true+ 'database.connections.mysql.options' => $this->getSslOptions(false, false, true), // isPaas=false, verifyServer=false, sslEnabled=true]);$options = config('database.connections.mysql.options');@@ -50,15 +50,15 @@ class DatabaseSslConfigurationTest extends TestCase$this->assertArrayHasKey(PDO::MYSQL_ATTR_SSL_CIPHER, $options);}- public function testMysqlSslConfigurationWithoutSsl(): void+ public function test_mysql_ssl_configuration_without_ssl(): void{config([- 'database.connections.mysql.options' => null+ 'database.connections.mysql.options' => null,]);// Test SSL disabled configurationconfig([- 'database.connections.mysql.options' => $this->getSslOptions(true, false, false) // isPaas=true, verifyServer=false, sslEnabled=false+ 'database.connections.mysql.options' => $this->getSslOptions(true, false, false), // isPaas=true, verifyServer=false, sslEnabled=false]);$options = config('database.connections.mysql.options');@@ -67,7 +67,7 @@ class DatabaseSslConfigurationTest extends TestCase$this->assertEmpty($options);}- public function testSslVerifyServerDefaultsToFalse(): void+ public function test_ssl_verify_server_defaults_to_false(): void{// Test that SSL_VERIFY_SERVER defaults to false when not explicitly set$options = $this->getSslOptions(true, null, true); // isPaas=true, verifyServer=null, sslEnabled=true@@ -76,10 +76,10 @@ class DatabaseSslConfigurationTest extends TestCase$this->assertFalse($options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT]);}- private function getSslOptions(bool $isPaas, ?bool $verifyServer=false, bool $sslEnabled=true): array+ private function getSslOptions(bool $isPaas, ?bool $verifyServer = false, bool $sslEnabled = true): array{// simulates the SSL options logic from database.php- if (!$sslEnabled) {+ if (! $sslEnabled) {return [];}diff --git a/tests/Unit/DepreciationTest.php b/tests/Unit/DepreciationTest.phpindex c170ac0e1d..fb6e5e08c4 100644--- a/tests/Unit/DepreciationTest.php+++ b/tests/Unit/DepreciationTest.php@@ -1,37 +1,37 @@<?php+namespace Tests\Unit;use App\Models\Asset;-use App\Models\Depreciable;-use App\Models\Depreciation;+use App\Models\AssetModel;use App\Models\Category;+use App\Models\Depreciation;use App\Models\License;-use App\Models\AssetModel;-use Illuminate\Validation\ValidationException;use Tests\TestCase;class DepreciationTest extends TestCase{- public function testADepreciationHasModels()+ public function test_a_depreciation_has_models(){$depreciation = Depreciation::factory()->create();AssetModel::factory()- ->count(5)- ->create(- [- 'category_id' => Category::factory()->assetLaptopCategory()->create(),- 'depreciation_id' => $depreciation->id- ]);-+ ->count(5)+ ->create(+ [+ 'category_id' => Category::factory()->assetLaptopCategory()->create(),+ 'depreciation_id' => $depreciation->id,+ ]);+$this->assertEquals(5, $depreciation->models->count());}- public function testDepreciationAmount()++ public function test_depreciation_amount(){$depreciation = Depreciation::factory()->create(['depreciation_type' => 'amount','depreciation_min' => 1000,- 'months'=> 36,+ 'months' => 36,]);$asset = Asset::factory()@@ -50,12 +50,13 @@ class DepreciationTest extends TestCase$this->assertEquals($depreciation->depreciation_min, $asset->getLinearDepreciatedValue());}- public function testDepreciationPercentage()++ public function test_depreciation_percentage(){$depreciation = Depreciation::factory()->create(['depreciation_type' => 'percent','depreciation_min' => 50,- 'months'=> 36,+ 'months' => 36,]);$asset = Asset::factory()@@ -75,18 +76,18 @@ class DepreciationTest extends TestCase$this->assertEquals(2000, $asset->getLinearDepreciatedValue());}- public function testADepreciationHasLicenses()+ public function test_a_depreciation_has_licenses(){$depreciation = Depreciation::factory()->create();License::factory()- ->count(5)- ->photoshop()- ->create(- [- 'category_id' => Category::factory()->licenseGraphicsCategory()->create(),- 'depreciation_id' => $depreciation->id- ]);+ ->count(5)+ ->photoshop()+ ->create(+ [+ 'category_id' => Category::factory()->licenseGraphicsCategory()->create(),+ 'depreciation_id' => $depreciation->id,+ ]);$this->assertEquals(5, $depreciation->licenses()->count());}diff --git a/tests/Unit/Helpers/HelperTest.php b/tests/Unit/Helpers/HelperTest.phpindex c92ad3d1e9..c87fddabb5 100644--- a/tests/Unit/Helpers/HelperTest.php+++ b/tests/Unit/Helpers/HelperTest.php@@ -4,23 +4,22 @@ namespace Tests\Unit\Helpers;use App\Helpers\Helper;use Illuminate\Http\RedirectResponse;-use Illuminate\Support\Facades\Redirect;use Illuminate\Support\Facades\Session;use Tests\TestCase;class HelperTest extends TestCase{- public function testDefaultChartColorsMethodHandlesHighValues()+ public function test_default_chart_colors_method_handles_high_values(){$this->assertIsString(Helper::defaultChartColors(1000));}- public function testDefaultChartColorsMethodHandlesNegativeNumbers()+ public function test_default_chart_colors_method_handles_negative_numbers(){$this->assertIsString(Helper::defaultChartColors(-1));}- public function testParseCurrencyMethod()+ public function test_parse_currency_method(){$this->settings->set(['default_currency' => 'USD']);$this->assertSame(12.34, Helper::ParseCurrency('USD 12.34'));@@ -28,11 +27,12 @@ class HelperTest extends TestCase$this->settings->set(['digit_separator' => '1.234,56']);$this->assertSame(12.34, Helper::ParseCurrency('12,34'));}- public function testGetRedirectOptionMethod()++ public function test_get_redirect_option_method(){$test_data = ['Option target: redirect for user assigned to ' => [- 'request' =>(object) ['assigned_user' => 22],+ 'request' => (object) ['assigned_user' => 22],'id' => 1,'checkout_to_type' => 'user','redirect_option' => 'target',@@ -40,7 +40,7 @@ class HelperTest extends TestCase'route' => route('users.show', 22),],'Option target: redirect location assigned to ' => [- 'request' =>(object) ['assigned_location' => 10],+ 'request' => (object) ['assigned_location' => 10],'id' => 2,'checkout_to_type' => 'location','redirect_option' => 'target',@@ -48,7 +48,7 @@ class HelperTest extends TestCase'route' => route('locations.show', 10),],'Option target: redirect back to asset assigned to ' => [- 'request' =>(object) ['assigned_asset' => 101],+ 'request' => (object) ['assigned_asset' => 101],'id' => 3,'checkout_to_type' => 'asset','redirect_option' => 'target',@@ -56,7 +56,7 @@ class HelperTest extends TestCase'route' => route('hardware.show', 101),],'Option item: redirect back to asset ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => 999,'checkout_to_type' => null,'redirect_option' => 'item',@@ -64,7 +64,7 @@ class HelperTest extends TestCase'route' => route('hardware.show', 999),],'Option index: redirect back to asset index ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => null,'checkout_to_type' => null,'redirect_option' => 'index',@@ -73,7 +73,7 @@ class HelperTest extends TestCase],'Option item: redirect back to user ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => 999,'checkout_to_type' => null,'redirect_option' => 'item',@@ -82,7 +82,7 @@ class HelperTest extends TestCase],'Option index: redirect back to user index ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => null,'checkout_to_type' => null,'redirect_option' => 'index',@@ -91,7 +91,7 @@ class HelperTest extends TestCase],'Option item: redirect back to license ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => 999,'checkout_to_type' => null,'redirect_option' => 'item',@@ -100,7 +100,7 @@ class HelperTest extends TestCase],'Option index: redirect back to license index ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => null,'checkout_to_type' => null,'redirect_option' => 'index',@@ -109,7 +109,7 @@ class HelperTest extends TestCase],'Option item: redirect back to accessory list ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => 999,'checkout_to_type' => null,'redirect_option' => 'item',@@ -118,7 +118,7 @@ class HelperTest extends TestCase],'Option index: redirect back to accessory index ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => null,'checkout_to_type' => null,'redirect_option' => 'index',@@ -126,7 +126,7 @@ class HelperTest extends TestCase'route' => route('accessories.index'),],'Option item: redirect back to consumable ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => 999,'checkout_to_type' => null,'redirect_option' => 'item',@@ -135,7 +135,7 @@ class HelperTest extends TestCase],'Option index: redirect back to consumables index ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => null,'checkout_to_type' => null,'redirect_option' => 'index',@@ -144,7 +144,7 @@ class HelperTest extends TestCase],'Option item: redirect back to component ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => 999,'checkout_to_type' => null,'redirect_option' => 'item',@@ -153,7 +153,7 @@ class HelperTest extends TestCase],'Option index: redirect back to component index ' => [- 'request' =>(object) ['assigned_asset' => null],+ 'request' => (object) ['assigned_asset' => null],'id' => null,'checkout_to_type' => null,'redirect_option' => 'index',@@ -162,14 +162,13 @@ class HelperTest extends TestCase],];- foreach ($test_data as $scenario => $data ) {+ foreach ($test_data as $scenario => $data) {Session::put('redirect_option', $data['redirect_option']);Session::put('checkout_to_type', $data['checkout_to_type']);$redirect = Helper::getRedirectOption($data['request'], $data['id'], $data['table']);-$this->assertInstanceOf(RedirectResponse::class, $redirect);$this->assertEquals($data['route'], $redirect->getTargetUrl(), $scenario.'failed.');}diff --git a/tests/Unit/Importer/AssetImportTest.php b/tests/Unit/Importer/AssetImportTest.phpindex 09e594c1be..d7123659b9 100644--- a/tests/Unit/Importer/AssetImportTest.php+++ b/tests/Unit/Importer/AssetImportTest.php@@ -5,6 +5,7 @@ namespace Tests\Unit\Importer;use App\Importer\AssetImporter;use App\Models\Statuslabel;use Tests\TestCase;+use function Livewire\invade;class AssetImportTest extends TestCasediff --git a/tests/Unit/Labels/LabelTest.php b/tests/Unit/Labels/LabelTest.phpindex 29bbecd74d..0345a26ecd 100644--- a/tests/Unit/Labels/LabelTest.php+++ b/tests/Unit/Labels/LabelTest.php@@ -7,6 +7,7 @@ use App\Models\Location;use App\Models\Setting;use App\View\Label;use Tests\TestCase;+use function Livewire\invade;class LabelTest extends TestCasediff --git a/tests/Unit/LdapTest.php b/tests/Unit/LdapTest.phpindex e4e2d5c600..5072b9793d 100644--- a/tests/Unit/LdapTest.php+++ b/tests/Unit/LdapTest.php@@ -2,29 +2,29 @@namespace Tests\Unit;+use App\Models\Ldap;use App\Models\Setting;+use phpmock\phpunit\PHPMock;use PHPUnit\Framework\Attributes\Group;-use App\Models\Ldap;use Tests\TestCase;#[Group('ldap')]class LdapTest extends TestCase{- use \phpmock\phpunit\PHPMock;+ use PHPMock;- public function testConnect()+ public function test_connect(){$this->settings->enableLdap();- $ldap_connect = $this->getFunctionMock("App\\Models", "ldap_connect");+ $ldap_connect = $this->getFunctionMock('App\\Models', 'ldap_connect');$ldap_connect->expects($this->once())->willReturn('hello');- $ldap_set_option = $this->getFunctionMock("App\\Models", "ldap_set_option");+ $ldap_set_option = $this->getFunctionMock('App\\Models', 'ldap_set_option');$ldap_set_option->expects($this->exactly(4));-$blah = Ldap::connectToLdap();- $this->assertEquals('hello',$blah,"LDAP_connect should return 'hello'");+ $this->assertEquals('hello', $blah, "LDAP_connect should return 'hello'");}// other test cases - with/without client-side certs?@@ -32,208 +32,207 @@ class LdapTest extends TestCase// with/without ignore cert validation?// test (and mock) ldap_start_tls() ?- public function testBindAdmin()+ public function test_bind_admin(){$this->settings->enableLdap();- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true);- $this->assertNull(Ldap::bindAdminToLdap("dummy"));+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->once())->willReturn(true);+ $this->assertNull(Ldap::bindAdminToLdap('dummy'));}- public function testBindBad()+ public function test_bind_bad(){$this->settings->enableLdap();- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false);- $this->getFunctionMock("App\\Models","ldap_error")->expects($this->once())->willReturn("exception");- $this->expectExceptionMessage("Could not bind to LDAP:");+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->once())->willReturn(false);+ $this->getFunctionMock('App\\Models', 'ldap_error')->expects($this->once())->willReturn('exception');+ $this->expectExceptionMessage('Could not bind to LDAP:');- $this->assertNull(Ldap::bindAdminToLdap("dummy"));+ $this->assertNull(Ldap::bindAdminToLdap('dummy'));}// other test cases - test donked password?- public function testAnonymousBind()+ public function test_anonymous_bind(){- //todo - would be nice to introspect somehow to make sure the right parameters were passed?+ // todo - would be nice to introspect somehow to make sure the right parameters were passed?$this->settings->enableAnonymousLdap();- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true);- $this->assertNull(Ldap::bindAdminToLdap("dummy"));+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->once())->willReturn(true);+ $this->assertNull(Ldap::bindAdminToLdap('dummy'));}- public function testBadAnonymousBind()+ public function test_bad_anonymous_bind(){$this->settings->enableAnonymousLdap();- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false);- $this->getFunctionMock("App\\Models","ldap_error")->expects($this->once())->willReturn("exception");- $this->expectExceptionMessage("Could not bind to LDAP:");+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->once())->willReturn(false);+ $this->getFunctionMock('App\\Models', 'ldap_error')->expects($this->once())->willReturn('exception');+ $this->expectExceptionMessage('Could not bind to LDAP:');- $this->assertNull(Ldap::bindAdminToLdap("dummy"));+ $this->assertNull(Ldap::bindAdminToLdap('dummy'));}- public function testBadEncryptedPassword()+ public function test_bad_encrypted_password(){$this->settings->enableBadPasswordLdap();- $this->expectExceptionMessage("Your app key has changed");- $this->assertNull(Ldap::bindAdminToLdap("dummy"));+ $this->expectExceptionMessage('Your app key has changed');+ $this->assertNull(Ldap::bindAdminToLdap('dummy'));}- public function testFindAndBind()+ public function test_find_and_bind(){$this->settings->enableLdap();- $ldap_connect = $this->getFunctionMock("App\\Models", "ldap_connect");+ $ldap_connect = $this->getFunctionMock('App\\Models', 'ldap_connect');$ldap_connect->expects($this->exactly(3))->willReturn('hello');- $ldap_set_option = $this->getFunctionMock("App\\Models", "ldap_set_option");+ $ldap_set_option = $this->getFunctionMock('App\\Models', 'ldap_set_option');$ldap_set_option->expects($this->exactly(12));- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->exactly(2))->willReturn(true);+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->exactly(2))->willReturn(true);- $this->getFunctionMock("App\\Models", "ldap_search")->expects($this->exactly(1))->willReturn(true);+ $this->getFunctionMock('App\\Models', 'ldap_search')->expects($this->exactly(1))->willReturn(true);- $this->getFunctionMock("App\\Models", "ldap_first_entry")->expects($this->exactly(1))->willReturn(true);- $this->getFunctionMock("App\\Models", "ldap_unbind")->expects($this->exactly(2));- $this->getFunctionMock("App\\Models", "ldap_count_entries")->expects($this->once())->willReturn(1);- $this->getFunctionMock("App\\Models", "ldap_get_dn")->expects($this->once())->willReturn('dn=FirstName Surname,ou=Org,dc=example,dc=com');+ $this->getFunctionMock('App\\Models', 'ldap_first_entry')->expects($this->exactly(1))->willReturn(true);+ $this->getFunctionMock('App\\Models', 'ldap_unbind')->expects($this->exactly(2));+ $this->getFunctionMock('App\\Models', 'ldap_count_entries')->expects($this->once())->willReturn(1);+ $this->getFunctionMock('App\\Models', 'ldap_get_dn')->expects($this->once())->willReturn('dn=FirstName Surname,ou=Org,dc=example,dc=com');-- $this->getFunctionMock("App\\Models", "ldap_get_attributes")->expects($this->exactly(1))->willReturn(+ $this->getFunctionMock('App\\Models', 'ldap_get_attributes')->expects($this->exactly(1))->willReturn([- "count" => 1,+ 'count' => 1,0 => ['sn' => 'Surname',- 'firstname' => 'FirstName'- ]+ 'firstname' => 'FirstName',+ ],]);- $results = Ldap::findAndBindUserLdap("username","password");- $this->assertEqualsCanonicalizing(["count" =>1,0 =>['sn' => 'Surname','firstname' => 'FirstName']],$results);+ $results = Ldap::findAndBindUserLdap('username', 'password');+ $this->assertEqualsCanonicalizing(['count' => 1, 0 => ['sn' => 'Surname', 'firstname' => 'FirstName']], $results);}- public function testFindAndBindBadPassword()+ public function test_find_and_bind_bad_password(){$this->settings->enableLdap();- $ldap_connect = $this->getFunctionMock("App\\Models", "ldap_connect");+ $ldap_connect = $this->getFunctionMock('App\\Models', 'ldap_connect');$ldap_connect->expects($this->exactly(3))->willReturn('hello');- $ldap_set_option = $this->getFunctionMock("App\\Models", "ldap_set_option");+ $ldap_set_option = $this->getFunctionMock('App\\Models', 'ldap_set_option');$ldap_set_option->expects($this->exactly(12));//- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->exactly(3))->willReturn(+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->exactly(3))->willReturn(true, /* initial admin connection for 'fast path' */false, /* the actual login for the user */false, /* the direct login for the user binding-as-themselves in the legacy path */- true /* the admin login afterwards (which is weird and doesn't make sense) */+ true /* the admin login afterwards (which is weird and doesn't make sense) */);- $this->getFunctionMock("App\\Models", "ldap_unbind")->expects($this->exactly(2));- $this->getFunctionMock("App\\Models", "ldap_error")->expects($this->never())->willReturn("exception");- $this->getFunctionMock("App\\Models", "ldap_search")->expects($this->exactly(1))->willReturn(false); //uhm?- $this->getFunctionMock("App\\Models", "ldap_count_entries")->expects($this->exactly(1))->willReturn(1);- $this->getFunctionMock("App\\Models", "ldap_first_entry")->expects($this->exactly(1))->willReturn(true);- $this->getFunctionMock("App\\Models", "ldap_get_attributes")->expects($this->exactly(1))->willReturn(1);- $this->getFunctionMock("App\\Models", "ldap_get_dn")->expects($this->exactly(1))->willReturn('dn=FirstName Surname,ou=Org,dc=example,dc=com');--// $this->getFunctionMock("App\\Models","ldap_error")->expects($this->once())->willReturn("exception");---// $this->expectExceptionMessage("exception");- $results = Ldap::findAndBindUserLdap("username","password");+ $this->getFunctionMock('App\\Models', 'ldap_unbind')->expects($this->exactly(2));+ $this->getFunctionMock('App\\Models', 'ldap_error')->expects($this->never())->willReturn('exception');+ $this->getFunctionMock('App\\Models', 'ldap_search')->expects($this->exactly(1))->willReturn(false); // uhm?+ $this->getFunctionMock('App\\Models', 'ldap_count_entries')->expects($this->exactly(1))->willReturn(1);+ $this->getFunctionMock('App\\Models', 'ldap_first_entry')->expects($this->exactly(1))->willReturn(true);+ $this->getFunctionMock('App\\Models', 'ldap_get_attributes')->expects($this->exactly(1))->willReturn(1);+ $this->getFunctionMock('App\\Models', 'ldap_get_dn')->expects($this->exactly(1))->willReturn('dn=FirstName Surname,ou=Org,dc=example,dc=com');++ // $this->getFunctionMock("App\\Models","ldap_error")->expects($this->once())->willReturn("exception");++ // $this->expectExceptionMessage("exception");+ $results = Ldap::findAndBindUserLdap('username', 'password');$this->assertFalse($results);}- public function testFindAndBindCannotFindSelf()+ public function test_find_and_bind_cannot_find_self(){$this->settings->enableLdap();- $ldap_connect = $this->getFunctionMock("App\\Models", "ldap_connect");+ $ldap_connect = $this->getFunctionMock('App\\Models', 'ldap_connect');$ldap_connect->expects($this->exactly(2))->willReturn('hello');- $ldap_set_option = $this->getFunctionMock("App\\Models", "ldap_set_option");+ $ldap_set_option = $this->getFunctionMock('App\\Models', 'ldap_set_option');$ldap_set_option->expects($this->exactly(8));- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->exactly(2))->willReturn(true); //I think this is OK-- $this->getFunctionMock("App\\Models", "ldap_search")->expects($this->exactly(2))->willReturn(false); //uhm?- $this->getFunctionMock("App\\Models", "ldap_unbind")->expects($this->once());- $this->getFunctionMock("App\\Models", "ldap_count_entries")->expects($this->once())->willReturn(0);+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->exactly(2))->willReturn(true); // I think this is OK+ $this->getFunctionMock('App\\Models', 'ldap_search')->expects($this->exactly(2))->willReturn(false); // uhm?+ $this->getFunctionMock('App\\Models', 'ldap_unbind')->expects($this->once());+ $this->getFunctionMock('App\\Models', 'ldap_count_entries')->expects($this->once())->willReturn(0);- $this->expectExceptionMessage("Could not search LDAP:");- $results = Ldap::findAndBindUserLdap("username","password");+ $this->expectExceptionMessage('Could not search LDAP:');+ $results = Ldap::findAndBindUserLdap('username', 'password');$this->assertFalse($results);}- //maybe should do an AD test as well?+ // maybe should do an AD test as well?- public function testFindLdapUsers()+ public function test_find_ldap_users(){$this->settings->enableLdap();- $ldap_connect = $this->getFunctionMock("App\\Models", "ldap_connect");+ $ldap_connect = $this->getFunctionMock('App\\Models', 'ldap_connect');$ldap_connect->expects($this->once())->willReturn('hello');- $ldap_set_option = $this->getFunctionMock("App\\Models", "ldap_set_option");+ $ldap_set_option = $this->getFunctionMock('App\\Models', 'ldap_set_option');$ldap_set_option->expects($this->exactly(4));- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true);+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->once())->willReturn(true);- $this->getFunctionMock("App\\Models", "ldap_search")->expects($this->once())->willReturn(["stuff"]);+ $this->getFunctionMock('App\\Models', 'ldap_search')->expects($this->once())->willReturn(['stuff']);- $this->getFunctionMock("App\\Models", "ldap_parse_result")->expects($this->once())->willReturn(true);+ $this->getFunctionMock('App\\Models', 'ldap_parse_result')->expects($this->once())->willReturn(true);- $this->getFunctionMock("App\\Models", "ldap_get_entries")->expects($this->once())->willReturn(["count" => 1]);+ $this->getFunctionMock('App\\Models', 'ldap_get_entries')->expects($this->once())->willReturn(['count' => 1]);$results = Ldap::findLdapUsers();- $this->assertEqualsCanonicalizing(["count" => 1], $results);+ $this->assertEqualsCanonicalizing(['count' => 1], $results);}- public function testFindLdapUsersPaginated()+ public function test_find_ldap_users_paginated(){$this->settings->enableLdap();- $ldap_connect = $this->getFunctionMock("App\\Models", "ldap_connect");+ $ldap_connect = $this->getFunctionMock('App\\Models', 'ldap_connect');$ldap_connect->expects($this->once())->willReturn('hello');- $ldap_set_option = $this->getFunctionMock("App\\Models", "ldap_set_option");+ $ldap_set_option = $this->getFunctionMock('App\\Models', 'ldap_set_option');$ldap_set_option->expects($this->exactly(4));- $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true);+ $this->getFunctionMock('App\\Models', 'ldap_bind')->expects($this->once())->willReturn(true);- $this->getFunctionMock("App\\Models", "ldap_search")->expects($this->exactly(2))->willReturn(["stuff"]);+ $this->getFunctionMock('App\\Models', 'ldap_search')->expects($this->exactly(2))->willReturn(['stuff']);- $this->getFunctionMock("App\\Models", "ldap_parse_result")->expects($this->exactly(2))->willReturnCallback(- function ($ldapconn, $search_results, $errcode , $matcheddn , $errmsg , $referrals, &$controls) {+ $this->getFunctionMock('App\\Models', 'ldap_parse_result')->expects($this->exactly(2))->willReturnCallback(+ function ($ldapconn, $search_results, $errcode, $matcheddn, $errmsg, $referrals, &$controls) {static $count = 0;- if($count == 0) {+ if ($count == 0) {$count++;- $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] = "cookie";- return ["count" => 1];+ $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] = 'cookie';++ return ['count' => 1];} else {$controls = [];- return ["count" => 1];++ return ['count' => 1];}});- $this->getFunctionMock("App\\Models", "ldap_get_entries")->expects($this->exactly(2))->willReturn(["count" => 1]);+ $this->getFunctionMock('App\\Models', 'ldap_get_entries')->expects($this->exactly(2))->willReturn(['count' => 1]);$results = Ldap::findLdapUsers();- $this->assertEqualsCanonicalizing(["count" => 2], $results);+ $this->assertEqualsCanonicalizing(['count' => 2], $results);}- public function testNonexistentTLSFile()+ public function test_nonexistent_tls_file(){$this->settings->enableLdap()->set(['ldap_client_tls_cert' => 'SAMPLE CERT TEXT']);$certfile = Setting::get_client_side_cert_path();$this->assertStringEqualsFile($certfile, 'SAMPLE CERT TEXT');}- public function testStaleTLSFile()+ public function test_stale_tls_file(){file_put_contents(Setting::get_client_side_cert_path(), 'STALE CERT FILE');sleep(1); // FIXME - this is going to slow down tests@@ -242,15 +241,14 @@ class LdapTest extends TestCase$this->assertStringEqualsFile($certfile, 'SAMPLE CERT TEXT');}- public function testFreshTLSFile()+ public function test_fresh_tls_file(){$this->settings->enableLdap()->set(['ldap_client_tls_cert' => 'SAMPLE CERT TEXT']);$client_side_cert_path = Setting::get_client_side_cert_path();file_put_contents($client_side_cert_path, 'WEIRDLY UPDATED CERT FILE');clearstatcache();- //the system should respect our cache-file, since the settings haven't been updated- $possibly_recached_cert_file = Setting::get_client_side_cert_path(); //this should *NOT* re-cache from the Settings+ // the system should respect our cache-file, since the settings haven't been updated+ $possibly_recached_cert_file = Setting::get_client_side_cert_path(); // this should *NOT* re-cache from the Settings$this->assertStringEqualsFile($possibly_recached_cert_file, 'WEIRDLY UPDATED CERT FILE');}-}diff --git a/tests/Unit/Listeners/LogListenerTest.php b/tests/Unit/Listeners/LogListenerTest.phpindex 64dd2a3d67..195913929c 100644--- a/tests/Unit/Listeners/LogListenerTest.php+++ b/tests/Unit/Listeners/LogListenerTest.php@@ -10,7 +10,7 @@ use Tests\TestCase;class LogListenerTest extends TestCase{- public function testLogsEntryOnCheckoutableCheckedOut()+ public function test_logs_entry_on_checkoutable_checked_out(){$asset = Asset::factory()->create();$checkedOutTo = User::factory()->create();@@ -19,7 +19,7 @@ class LogListenerTest extends TestCase// Simply to ensure `created_by` is set in the action log$this->actingAs($checkedOutBy);- (new LogListener())->onCheckoutableCheckedOut(new CheckoutableCheckedOut(+ (new LogListener)->onCheckoutableCheckedOut(new CheckoutableCheckedOut($asset,$checkedOutTo,$checkedOutBy,@@ -36,5 +36,4 @@ class LogListenerTest extends TestCase'note' => 'A simple note...',]);}-}diff --git a/tests/Unit/LocationTest.php b/tests/Unit/LocationTest.phpindex 3fded9e568..4e8ec184a6 100644--- a/tests/Unit/LocationTest.php+++ b/tests/Unit/LocationTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit;use App\Models\Location;@@ -6,7 +7,7 @@ use Tests\TestCase;class LocationTest extends TestCase{- public function testPassesIfNotSelfParent()+ public function test_passes_if_not_self_parent(){$a = Location::factory()->make(['name' => 'Test Location',@@ -17,7 +18,7 @@ class LocationTest extends TestCase$this->assertTrue($a->isValid());}- public function testFailsIfSelfParent()+ public function test_fails_if_self_parent(){$a = Location::factory()->make(['name' => 'Test Location',diff --git a/tests/Unit/Mail/CheckoutAssetMailTest.php b/tests/Unit/Mail/CheckoutAssetMailTest.phpindex 6ee2d937a8..41708d5931 100644--- a/tests/Unit/Mail/CheckoutAssetMailTest.php+++ b/tests/Unit/Mail/CheckoutAssetMailTest.php@@ -16,27 +16,29 @@ class CheckoutAssetMailTest extends TestCaseyield 'Asset requiring acceptance' => [function () {$asset = Asset::factory()->requiresAcceptance()->create();+return ['asset' => $asset,'acceptance' => CheckoutAcceptance::factory()->for($asset, 'checkoutable')->create(),'first_time_sending' => true,'expected_subject' => trans('mail.Asset_Checkout_Notification', ['tag' => $asset->asset_tag]),- 'expected_opening' => 'A new item has been checked out under your name that requires acceptance, details are below.'+ 'expected_opening' => 'A new item has been checked out under your name that requires acceptance, details are below.',];- }+ },];yield 'Asset not requiring acceptance' => [function () {$asset = Asset::factory()->doesNotRequireAcceptance()->create();+return ['asset' => $asset,'acceptance' => null,'first_time_sending' => true,'expected_subject' => trans('mail.Asset_Checkout_Notification', ['tag' => $asset->asset_tag]),- 'expected_opening' => 'A new item has been checked out under your name, details are below.'+ 'expected_opening' => 'A new item has been checked out under your name, details are below.',];- }+ },];yield 'Reminder' => [@@ -46,14 +48,14 @@ class CheckoutAssetMailTest extends TestCase'acceptance' => CheckoutAcceptance::factory()->create(),'first_time_sending' => false,'expected_subject' => 'Reminder: You have Unaccepted Items',- 'expected_opening' => 'An item was recently checked out under your name that requires acceptance, details are below.'+ 'expected_opening' => 'An item was recently checked out under your name that requires acceptance, details are below.',];- }+ },];}#[DataProvider('data')]- public function testSubjectLineAndOpening($data)+ public function test_subject_line_and_opening($data){['asset' => $asset,diff --git a/tests/Unit/MaintenanceTest.php b/tests/Unit/MaintenanceTest.phpindex e0faf4a03f..1e24c65dd9 100644--- a/tests/Unit/MaintenanceTest.php+++ b/tests/Unit/MaintenanceTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit;use App\Models\Maintenance;@@ -6,7 +7,7 @@ use Tests\TestCase;class MaintenanceTest extends TestCase{- public function testZerosOutWarrantyIfBlank()+ public function test_zeros_out_warranty_if_blank(){$c = new Maintenance;$c->is_warranty = '';@@ -15,9 +16,9 @@ class MaintenanceTest extends TestCase$this->assertTrue($c->is_warranty == 4);}- public function testSetsCostsAppropriately()+ public function test_sets_costs_appropriately(){- $c = new Maintenance();+ $c = new Maintenance;$c->cost = '0.00';$this->assertTrue($c->cost === null);$c->cost = '9.54';@@ -26,7 +27,7 @@ class MaintenanceTest extends TestCase$this->assertTrue($c->cost === 9.5);}- public function testNullsOutNotesIfBlank()+ public function test_nulls_out_notes_if_blank(){$c = new Maintenance;$c->notes = '';@@ -35,7 +36,7 @@ class MaintenanceTest extends TestCase$this->assertTrue($c->notes === 'This is a long note');}- public function testNullsOutCompletionDateIfBlankOrInvalid()+ public function test_nulls_out_completion_date_if_blank_or_invalid(){$c = new Maintenance;$c->completion_date = '';diff --git a/tests/Unit/Models/Company/CompanyTest.php b/tests/Unit/Models/Company/CompanyTest.phpindex 6fd17e554b..8857f99de8 100644--- a/tests/Unit/Models/Company/CompanyTest.php+++ b/tests/Unit/Models/Company/CompanyTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit\Models\Company;use App\Models\Company;@@ -7,15 +8,15 @@ use Tests\TestCase;class CompanyTest extends TestCase{- public function testACompanyCanHaveUsers()+ public function test_a_company_can_have_users(){$company = Company::factory()->create();$user = User::factory()- ->create(- [- 'company_id'=> $company->id- ]- );+ ->create(+ [+ 'company_id' => $company->id,+ ]+ );$this->assertCount(1, $company->users);}diff --git a/tests/Unit/Models/Company/GetIdForCurrentUserTest.php b/tests/Unit/Models/Company/GetIdForCurrentUserTest.phpindex c21c4f36a3..36acd04287 100644--- a/tests/Unit/Models/Company/GetIdForCurrentUserTest.php+++ b/tests/Unit/Models/Company/GetIdForCurrentUserTest.php@@ -8,7 +8,7 @@ use Tests\TestCase;class GetIdForCurrentUserTest extends TestCase{- public function testReturnsProvidedValueWhenFullCompanySupportDisabled()+ public function test_returns_provided_value_when_full_company_support_disabled(){$this->settings->disableMultipleFullCompanySupport();@@ -16,7 +16,7 @@ class GetIdForCurrentUserTest extends TestCase$this->assertEquals(1000, Company::getIdForCurrentUser(1000));}- public function testReturnsProvidedValueForSuperUsersWhenFullCompanySupportEnabled()+ public function test_returns_provided_value_for_super_users_when_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();@@ -24,7 +24,7 @@ class GetIdForCurrentUserTest extends TestCase$this->assertEquals(2000, Company::getIdForCurrentUser(2000));}- public function testReturnsNonSuperUsersCompanyIdWhenFullCompanySupportEnabled()+ public function test_returns_non_super_users_company_id_when_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();@@ -32,7 +32,7 @@ class GetIdForCurrentUserTest extends TestCase$this->assertEquals(2000, Company::getIdForCurrentUser(1000));}- public function testReturnsNullForNonSuperUserWithoutCompanyIdWhenFullCompanySupportEnabled()+ public function test_returns_null_for_non_super_user_without_company_id_when_full_company_support_enabled(){$this->settings->enableMultipleFullCompanySupport();diff --git a/tests/Unit/Models/Labels/DefaultLabelTest.php b/tests/Unit/Models/Labels/DefaultLabelTest.phpindex db7abf5a35..264c97c8c3 100644--- a/tests/Unit/Models/Labels/DefaultLabelTest.php+++ b/tests/Unit/Models/Labels/DefaultLabelTest.php@@ -19,7 +19,7 @@ class DefaultLabelTest extends TestCase]);// simply ensuring constructor didn't throw exception...- $this->assertInstanceOf(DefaultLabel::class, new DefaultLabel());+ $this->assertInstanceOf(DefaultLabel::class, new DefaultLabel);}/**@@ -33,6 +33,6 @@ class DefaultLabelTest extends TestCase]);// simply ensuring constructor didn't throw exception...- $this->assertInstanceOf(DefaultLabel::class, new DefaultLabel());+ $this->assertInstanceOf(DefaultLabel::class, new DefaultLabel);}}diff --git a/tests/Unit/Models/Labels/FieldOptionTest.php b/tests/Unit/Models/Labels/FieldOptionTest.phpindex 6616ab2304..f3ae822a0d 100644--- a/tests/Unit/Models/Labels/FieldOptionTest.php+++ b/tests/Unit/Models/Labels/FieldOptionTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class FieldOptionTest extends TestCase{- public function testItDisplaysAssignedToProperly()+ public function test_it_displays_assigned_to_properly(){// "assignedTo" is a "special" value that can be used in the new label engine$fieldOption = FieldOption::fromString('Assigned To=assignedTo');diff --git a/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.php b/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.phpindex 1443cc4a63..b29b0b006b 100644--- a/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.php+++ b/tests/Unit/Models/ReportTemplates/ReportTemplateParsingValuesTest.php@@ -4,7 +4,6 @@ namespace Tests\Unit\Models\ReportTemplates;use App\Models\Department;use App\Models\Location;-use App\Models\User;use App\Models\ReportTemplate;use PHPUnit\Framework\Attributes\Group;use Tests\TestCase;@@ -12,7 +11,7 @@ use Tests\TestCase;#[Group('custom-reporting')]class ReportTemplateParsingValuesTest extends TestCase{- public function testParsingValuesOnNonExistentReportTemplate()+ public function test_parsing_values_on_non_existent_report_template(){$unsavedTemplate = new ReportTemplate;@@ -36,7 +35,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertEquals('', $unsavedTemplate->selectValue('value_on_unsaved_template'));}- public function testParsingCheckmarkValue()+ public function test_parsing_checkmark_value(){$template = ReportTemplate::factory()->create(['options' => [@@ -53,7 +52,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertEquals('0', (new ReportTemplate)->checkmarkValue('non_existent_key_that_is_overwritten_to_default_to_zero', '0'));}- public function testParsingTextValue()+ public function test_parsing_text_value(){$template = ReportTemplate::factory()->create(['options' => [@@ -68,7 +67,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertEquals('my fallback', (new ReportTemplate)->textValue('non_existent_key', 'my fallback'));}- public function testParsingRadioValue()+ public function test_parsing_radio_value(){$template = ReportTemplate::factory()->create(['options' => ['property_that_exists' => '1'],@@ -83,7 +82,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertTrue($template->radioValue('non_existent_property', 'doesnt_matter', true));}- public function testParsingSelectValue()+ public function test_parsing_select_value(){$template = ReportTemplate::factory()->create(['options' => [@@ -97,7 +96,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertNull($template->selectValue('contains_a_null_value'));}- public function testParsingSelectValues()+ public function test_parsing_select_values(){$template = ReportTemplate::factory()->create(['options' => [@@ -113,7 +112,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertEquals([], $template->selectValues('non_existent_key'));}- public function testSelectValueDoesNotIncludeDeletedOrNonExistentModels()+ public function test_select_value_does_not_include_deleted_or_non_existent_models(){[$locationA, $locationB] = Location::factory()->count(2)->create();$invalidId = 10000;@@ -141,7 +140,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertNull((new ReportTemplate)->selectValue('value_on_unsaved_template', Location::class));}- public function testSelectValuesDoNotIncludeDeletedOrNonExistentModels()+ public function test_select_values_do_not_include_deleted_or_non_existent_models(){[$locationA, $locationB] = Location::factory()->count(2)->create();$invalidId = 10000;@@ -165,7 +164,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertNotContains($invalidId, $parsedValues);}- public function testGracefullyHandlesSingleSelectBecomingMultiSelect()+ public function test_gracefully_handles_single_select_becoming_multi_select(){$department = Department::factory()->create();@@ -188,7 +187,7 @@ class ReportTemplateParsingValuesTest extends TestCase$this->assertEquals([], $templateWithNull->selectValues('by_dept_id'));}- public function testGracefullyHandlesMultiSelectBecomingSingleSelectBySelectingTheFirstValue()+ public function test_gracefully_handles_multi_select_becoming_single_select_by_selecting_the_first_value(){[$departmentA, $departmentB] = Department::factory()->count(2)->create();diff --git a/tests/Unit/NotificationTest.php b/tests/Unit/NotificationTest.phpindex 302c0b3a8b..8bcaeec095 100644--- a/tests/Unit/NotificationTest.php+++ b/tests/Unit/NotificationTest.php@@ -1,33 +1,34 @@<?php+namespace Tests\Unit;use App\Mail\CheckoutAssetMail;-use App\Models\User;use App\Models\Asset;use App\Models\AssetModel;use App\Models\Category;+use App\Models\User;use Carbon\Carbon;use Illuminate\Support\Facades\Mail;use Tests\TestCase;class NotificationTest extends TestCase{- public function testAUserIsEmailedIfTheyCheckoutAnAssetWithEULA()+ public function test_a_user_is_emailed_if_they_checkout_an_asset_with_eula(){$admin = User::factory()->superuser()->create();$user = User::factory()->create();$asset = Asset::factory()- ->create(- [- 'model_id' => AssetModel::factory()- ->create(- [- 'category_id' => Category::factory()->assetLaptopCategory()->create()->id- ]- )->id,- 'warranty_months' => 24,- 'purchase_date' => Carbon::createFromDate(2017, 1, 1)->hour(0)->minute(0)->second(0)->format('Y-m-d')- ]);+ ->create(+ [+ 'model_id' => AssetModel::factory()+ ->create(+ [+ 'category_id' => Category::factory()->assetLaptopCategory()->create()->id,+ ]+ )->id,+ 'warranty_months' => 24,+ 'purchase_date' => Carbon::createFromDate(2017, 1, 1)->hour(0)->minute(0)->second(0)->format('Y-m-d'),+ ]);Mail::fake();$asset->checkOut($user, $admin->id);@@ -35,7 +36,8 @@ class NotificationTest extends TestCasereturn $mail->hasTo($user->email) && $mail->hasSubject(trans('mail.Asset_Checkout_Notification', ['tag' => $asset->asset_tag]));});}- public function testDefaultEulaIsSentWhenSetInCategory()++ public function test_default_eula_is_sent_when_set_in_category(){Mail::fake();@@ -56,7 +58,7 @@ class NotificationTest extends TestCaseMail::assertSent(CheckoutAssetMail::class, function ($mail) use ($user) {return $mail->hasTo($user->email) &&str_contains($mail->render(), 'My Custom EULA Text') &&- !str_contains($mail->render(), 'EULA Text that should not be used');+ ! str_contains($mail->render(), 'EULA Text that should not be used');});}}diff --git a/tests/Unit/SnipeModelTest.php b/tests/Unit/SnipeModelTest.phpindex bfc81a5670..1874e96ea7 100644--- a/tests/Unit/SnipeModelTest.php+++ b/tests/Unit/SnipeModelTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit;use App\Models\SnipeModel;@@ -6,7 +7,7 @@ use Tests\TestCase;class SnipeModelTest extends TestCase{- public function testSetsPurchaseDatesAppropriately()+ public function test_sets_purchase_dates_appropriately(){$c = new SnipeModel;$c->purchase_date = '';@@ -18,7 +19,7 @@ class SnipeModelTest extends TestCase$this->assertEquals('2016-03-25', $c->purchase_date);}- public function testSetsPurchaseCostsAppropriately()+ public function test_sets_purchase_costs_appropriately(){$c = new SnipeModel;$c->purchase_cost = '';@@ -31,7 +32,7 @@ class SnipeModelTest extends TestCase$this->assertTrue($c->purchase_cost == 9.5);}- public function testNullsBlankLocationIdsButNotOthers()+ public function test_nulls_blank_location_ids_but_not_others(){$c = new SnipeModel;$c->location_id = '';@@ -40,7 +41,7 @@ class SnipeModelTest extends TestCase$this->assertTrue($c->location_id == 5);}- public function testNullsBlankCategoriesButNotOthers()+ public function test_nulls_blank_categories_but_not_others(){$c = new SnipeModel;$c->category_id = '';@@ -49,7 +50,7 @@ class SnipeModelTest extends TestCase$this->assertTrue($c->category_id == 1);}- public function testNullsBlankSuppliersButNotOthers()+ public function test_nulls_blank_suppliers_but_not_others(){$c = new SnipeModel;$c->supplier_id = '';@@ -58,7 +59,7 @@ class SnipeModelTest extends TestCase$this->assertTrue($c->supplier_id == 4);}- public function testNullsBlankDepreciationsButNotOthers()+ public function test_nulls_blank_depreciations_but_not_others(){$c = new SnipeModel;$c->depreciation_id = '';@@ -67,7 +68,7 @@ class SnipeModelTest extends TestCase$this->assertTrue($c->depreciation_id == 4);}- public function testNullsBlankManufacturersButNotOthers()+ public function test_nulls_blank_manufacturers_but_not_others(){$c = new SnipeModel;$c->manufacturer_id = '';diff --git a/tests/Unit/SnipeTranslatorTest.php b/tests/Unit/SnipeTranslatorTest.phpindex d374bf9134..439e08b29c 100644--- a/tests/Unit/SnipeTranslatorTest.php+++ b/tests/Unit/SnipeTranslatorTest.php@@ -11,79 +11,81 @@ class SnipeTranslatorTest extends TestCase// WARNING: If these translation strings are updated, these tests will start to fail. Update them as appropriate.- public function testBasic()+ public function test_basic(){- $this->assertEquals('This user has admin privileges',trans('general.admin_tooltip',[],'en-US'));+ $this->assertEquals('This user has admin privileges', trans('general.admin_tooltip', [], 'en-US'));}- public function testPortuguese()+ public function test_portuguese(){- $this->assertEquals('Acessório',trans('general.accessory',[],'pt-PT'));+ $this->assertEquals('Acessório', trans('general.accessory', [], 'pt-PT'));}- public function testFallback()+ public function test_fallback(){$this->assertEquals('This user has admin privileges',- trans('general.admin_tooltip',[],'xx-ZZ'),- "Nonexistent locale should fall-back to en-US"+ trans('general.admin_tooltip', [], 'xx-ZZ'),+ 'Nonexistent locale should fall-back to en-US');}- public function testBackupString()+ public function test_backup_string(){$this->assertEquals('Ingen sikkerhetskopier ble gjort ennå',- trans('backup::notifications.no_backups_info',[],'nb-NO'),+ trans('backup::notifications.no_backups_info', [], 'nb-NO'),"Norwegian 'no backups info' message should be here");}- public function testBackupFallback()+ public function test_backup_fallback(){$this->assertEquals('No backups were made yet',- trans('backup::notifications.no_backups_info',[],'xx-ZZ'),+ trans('backup::notifications.no_backups_info', [], 'xx-ZZ'),"'no backups info' string should fallback to 'en'");}- public function testTransChoiceSingular()+ public function test_trans_choice_singular(){$this->assertEquals('1 Consumível',- trans_choice('general.countable.consumables',1,[],'pt-PT')+ trans_choice('general.countable.consumables', 1, [], 'pt-PT'));}- public function testTransChoicePlural()+ public function test_trans_choice_plural(){$this->assertEquals('2 Consumíveis',- trans_choice('general.countable.consumables',2,[],'pt-PT')+ trans_choice('general.countable.consumables', 2, [], 'pt-PT'));}- public function testTotallyBogusKey()+ public function test_totally_bogus_key(){$this->assertEquals('bogus_key',- trans('bogus_key',[],'pt-PT'),- "Translating a completely bogus key should at least just return back that key"+ trans('bogus_key', [], 'pt-PT'),+ 'Translating a completely bogus key should at least just return back that key');}- public function testReplacements() {+ public function test_replacements()+ {$this->assertEquals('Artigos alocados a Some Name Here',- trans('admin/users/general.assets_user',['name' => 'Some Name Here'],'pt-PT'),- "Text should get replaced in translations when given"+ trans('admin/users/general.assets_user', ['name' => 'Some Name Here'], 'pt-PT'),+ 'Text should get replaced in translations when given');}- public function testNonlegacyBackupLocale() {- //Spatie backup *usually* uses two-character locales, but pt-BR is an exception+ public function test_nonlegacy_backup_locale()+ {+ // Spatie backup *usually* uses two-character locales, but pt-BR is an exception$this->assertEquals('Mensagem de exceção: MESSAGE',trans('backup::notifications.exception_message',['message' => 'MESSAGE'],'pt-BR')diff --git a/tests/Unit/StatuslabelTest.php b/tests/Unit/StatuslabelTest.phpindex fe5f3cacc0..55e5b135c8 100644--- a/tests/Unit/StatuslabelTest.php+++ b/tests/Unit/StatuslabelTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit;use App\Models\Statuslabel;@@ -6,37 +7,37 @@ use Tests\TestCase;class StatuslabelTest extends TestCase{- public function testRTDStatuslabelAdd()+ public function test_rtd_statuslabel_add(){$statuslabel = Statuslabel::factory()->rtd()->create();$this->assertModelExists($statuslabel);}- public function testPendingStatuslabelAdd()+ public function test_pending_statuslabel_add(){$statuslabel = Statuslabel::factory()->pending()->create();$this->assertModelExists($statuslabel);}- public function testArchivedStatuslabelAdd()+ public function test_archived_statuslabel_add(){$statuslabel = Statuslabel::factory()->archived()->create();$this->assertModelExists($statuslabel);}- public function testOutForRepairStatuslabelAdd()+ public function test_out_for_repair_statuslabel_add(){$statuslabel = Statuslabel::factory()->outForRepair()->create();$this->assertModelExists($statuslabel);}- public function testBrokenStatuslabelAdd()+ public function test_broken_statuslabel_add(){$statuslabel = Statuslabel::factory()->broken()->create();$this->assertModelExists($statuslabel);}- public function testLostStatuslabelAdd()+ public function test_lost_statuslabel_add(){$statuslabel = Statuslabel::factory()->lost()->create();$this->assertModelExists($statuslabel);diff --git a/tests/Unit/Transformers/DepreciationReportTransformerTest.php b/tests/Unit/Transformers/DepreciationReportTransformerTest.phpindex 7a0017196a..3c11ccbb11 100644--- a/tests/Unit/Transformers/DepreciationReportTransformerTest.php+++ b/tests/Unit/Transformers/DepreciationReportTransformerTest.php@@ -9,7 +9,7 @@ use Tests\TestCase;class DepreciationReportTransformerTest extends TestCase{- public function testHandlesModelDepreciationMonthsBeingZero()+ public function test_handles_model_depreciation_months_being_zero(){$asset = Asset::factory()->create();$depreciation = Depreciation::factory()->create(['months' => 0]);diff --git a/tests/Unit/UserTest.php b/tests/Unit/UserTest.phpindex f54969a5da..0988868c3c 100644--- a/tests/Unit/UserTest.php+++ b/tests/Unit/UserTest.php@@ -1,4 +1,5 @@<?php+namespace Tests\Unit;use App\Models\User;@@ -6,7 +7,7 @@ use Tests\TestCase;class UserTest extends TestCase{- public function testFirstNameSplit()+ public function test_first_name_split(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_firstname = 'Natalia';@@ -16,7 +17,7 @@ class UserTest extends TestCase$this->assertEquals($expected_lastname, $user['last_name']);}- public function testFirstName()+ public function test_first_name(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'natalia';@@ -24,15 +25,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testFirstNameEmail()+ public function test_first_name_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'firstname');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testLastName()+ public function test_last_name(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'allanovna-romanova-oshostakova';@@ -40,15 +41,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testLastNameEmail()+ public function test_last_name_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'lastname');- $this->assertEquals($expected_username, $user['username'] . '@example.com');+ $this->assertEquals($expected_username, $user['username'].'@example.com');}- public function testFirstNameDotLastName()+ public function test_first_name_dot_last_name(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'natalia.allanovna-romanova-oshostakova';@@ -56,15 +57,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testFirstNameDotLastNameEmail()+ public function test_first_name_dot_last_name_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'firstname.lastname');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testLastNameFirstInitial()+ public function test_last_name_first_initial(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'allanovna-romanova-oshostakovan';@@ -72,15 +73,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testLastNameFirstInitialEmail()+ public function test_last_name_first_initial_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'lastnamefirstinitial');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testFirstInitialLastName()+ public function test_first_initial_last_name(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'nallanovna-romanova-oshostakova';@@ -88,15 +89,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testFirstInitialLastNameEmail()+ public function test_first_initial_last_name_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'filastname');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testFirstInitialUnderscoreLastName()+ public function test_first_initial_underscore_last_name(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'nallanovna-romanova-oshostakova';@@ -104,31 +105,31 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testFirstInitialUnderscoreLastNameEmail()+ public function test_first_initial_underscore_last_name_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'firstinitial_lastname');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testSingleName()+ public function test_single_name(){$fullname = 'Natalia';$expected_username = 'natalia';- $user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname',);+ $user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname');$this->assertEquals($expected_username, $user['username']);}- public function testSingleNameEmail()+ public function test_single_name_email(){$fullname = 'Natalia';$expected_email = '[email protected]';- $user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname',);- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testFirstInitialDotLastname()+ public function test_first_initial_dot_lastname(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'nallanovna-romanova-oshostakova';@@ -136,15 +137,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testFirstInitialDotLastnameEmail()+ public function test_first_initial_dot_lastname_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'firstinitial.lastname');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testLastNameDotFirstInitial()+ public function test_last_name_dot_first_initial(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'allanovna-romanova-oshostakova.n';@@ -152,15 +153,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testLastNameDotFirstInitialEmail()+ public function test_last_name_dot_first_initial_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'lastname.firstinitial');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testLastNameUnderscoreFirstInitial()+ public function test_last_name_underscore_first_initial(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'allanovna-romanova-oshostakova_n';@@ -168,15 +169,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testLastNameUnderscoreFirstInitialEmail()+ public function test_last_name_underscore_first_initial_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'lastname_firstinitial');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testFirstNameLastName()+ public function test_first_name_last_name(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'nataliaallanovna-romanova-oshostakova';@@ -184,15 +185,15 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testFirstNameLastNameEmail()+ public function test_first_name_last_name_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'firstnamelastname');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}- public function testFirstNameLastInitial()+ public function test_first_name_last_initial(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_username = 'nataliaa';@@ -200,11 +201,11 @@ class UserTest extends TestCase$this->assertEquals($expected_username, $user['username']);}- public function testFirstNameLastInitialEmail()+ public function test_first_name_last_initial_email(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";$expected_email = '[email protected]';$user = User::generateFormattedNameFromFullName($fullname, 'firstnamelastinitial');- $this->assertEquals($expected_email, $user['username'] . '@example.com');+ $this->assertEquals($expected_email, $user['username'].'@example.com');}}