From 83fb6826eedf7e7adc066b394a616b472b178414 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 6 Aug 2024 20:25:22 +0000 Subject: [PATCH] Add return types to test methods --- .../AssetModels/Api/CreateAssetModelsTest.php | 6 +-- .../AssetModels/Api/IndexAssetModelsTest.php | 8 ++-- .../AssetModels/Api/UpdateAssetModelsTest.php | 12 ++--- .../AssetModels/Ui/CreateAssetModelsTest.php | 6 +-- .../AssetModels/Ui/IndexAssetModelsTest.php | 4 +- .../AssetModels/Ui/UpdateAssetModelsTest.php | 6 +-- tests/Feature/Assets/Api/AssetFilesTest.php | 8 ++-- tests/Feature/Assets/Api/AssetIndexTest.php | 16 +++---- .../Assets/Api/AssetsForSelectListTest.php | 4 +- .../Assets/Api/RequestableAssetTest.php | 6 +-- tests/Feature/Assets/Api/StoreAssetTest.php | 48 +++++++++---------- tests/Feature/Assets/Api/UpdateAssetTest.php | 48 +++++++++---------- .../Assets/Ui/BulkDeleteAssetsTest.php | 16 +++---- .../Feature/Assets/Ui/BulkEditAssetsTest.php | 12 ++--- tests/Feature/Assets/Ui/CloneAssetTest.php | 4 +- tests/Feature/Assets/Ui/EditAssetTest.php | 6 +-- .../Categories/Api/CreateCategoriesTest.php | 8 ++-- .../Categories/Api/IndexCategoriesTest.php | 6 +-- .../Categories/Api/UpdateCategoriesTest.php | 4 +- .../Categories/Ui/CreateCategoriesTest.php | 6 +-- .../Categories/Ui/IndexCategoriesTest.php | 4 +- .../Categories/Ui/UpdateCategoriesTest.php | 10 ++-- .../Feature/Checkins/Api/AssetCheckinTest.php | 20 ++++---- .../Checkins/Ui/AccessoryCheckinTest.php | 8 ++-- .../Feature/Checkins/Ui/AssetCheckinTest.php | 28 +++++------ .../Checkins/Ui/ComponentCheckinTest.php | 6 +-- .../Checkins/Ui/LicenseCheckinTest.php | 2 +- .../Ui/AccessoryAcceptanceTest.php | 6 +-- .../Checkouts/Api/AccessoryCheckoutTest.php | 16 +++---- .../Checkouts/Api/AssetCheckoutTest.php | 18 +++---- .../Checkouts/Api/ConsumableCheckoutTest.php | 12 ++--- .../Checkouts/Ui/AccessoryCheckoutTest.php | 24 +++++----- .../Checkouts/Ui/AssetCheckoutTest.php | 30 ++++++------ .../Checkouts/Ui/ComponentsCheckoutTest.php | 8 ++-- .../Checkouts/Ui/ConsumableCheckoutTest.php | 18 +++---- .../Checkouts/Ui/LicenseCheckoutTest.php | 12 ++--- .../Components/Api/ComponentIndexTest.php | 2 +- .../Components/Ui/ComponentIndexTest.php | 4 +- tests/Feature/Console/MergeUsersTest.php | 2 +- tests/Feature/Console/OptimizeTest.php | 2 +- .../Consumables/Api/ConsumableIndexTest.php | 4 +- .../Consumables/Api/ConsumableUpdateTest.php | 4 +- .../Consumables/Api/ConsumableViewTest.php | 2 +- .../Consumables/Ui/ConsumableIndexTest.php | 4 +- .../Consumables/Ui/ConsumableViewTest.php | 4 +- tests/Feature/DashboardTest.php | 2 +- .../Departments/Api/CreateDepartmentsTest.php | 2 +- .../Departments/Api/DepartmentsIndexTest.php | 8 ++-- .../Departments/Api/UpdateDepartmentsTest.php | 4 +- .../Departments/Ui/CreateDepartmentsTest.php | 4 +- .../Departments/Ui/IndexDepartmentsTest.php | 4 +- .../Departments/Ui/UpdateDepartmentsTest.php | 4 +- tests/Feature/Groups/Api/StoreGroupTest.php | 8 ++-- tests/Feature/Groups/Ui/IndexGroupTest.php | 4 +- .../Feature/Licenses/Api/LicenseIndexTest.php | 2 +- .../Feature/Licenses/Ui/CreateLicenseTest.php | 4 +- .../Feature/Licenses/Ui/LicenseIndexTest.php | 4 +- tests/Feature/Licenses/Ui/LicenseViewTest.php | 4 +- .../Feature/Livewire/CategoryEditFormTest.php | 18 +++---- .../Locations/Api/CreateLocationsTest.php | 6 +-- .../Locations/Api/DeleteLocationsTest.php | 12 ++--- .../Locations/Api/IndexLocationsTest.php | 6 +-- .../Api/LocationsForSelectListTest.php | 6 +-- .../Locations/Api/LocationsViewTest.php | 6 +-- .../Locations/Api/UpdateLocationsTest.php | 4 +- .../Locations/Ui/CreateLocationsTest.php | 4 +- .../Locations/Ui/IndexLocationsTest.php | 4 +- .../Locations/Ui/UpdateLocationsTest.php | 6 +-- .../EmailNotificationsUponCheckinTest.php | 4 +- .../SlackNotificationsUponCheckinTest.php | 14 +++--- .../SlackNotificationsUponCheckoutTest.php | 18 +++---- tests/Feature/Reporting/CustomReportTest.php | 6 +-- .../Reporting/UnacceptedAssetReportTest.php | 4 +- .../Feature/Settings/BrandingSettingsTest.php | 26 +++++----- tests/Feature/Settings/ShowSetUpPageTest.php | 2 +- tests/Feature/Users/Api/DeleteUserTest.php | 18 +++---- tests/Feature/Users/Api/RestoreUserTest.php | 10 ++-- tests/Feature/Users/Api/UpdateUserTest.php | 24 +++++----- tests/Feature/Users/Api/UserSearchTest.php | 12 ++--- .../Users/Api/UsersForSelectListTest.php | 8 ++-- tests/Feature/Users/Api/ViewUserTest.php | 2 +- tests/Feature/Users/Ui/DeleteUserTest.php | 24 +++++----- tests/Feature/Users/Ui/MergeUsersTest.php | 14 +++--- tests/Feature/Users/Ui/UpdateUserTest.php | 10 ++-- tests/Feature/Users/Ui/ViewUserTest.php | 6 +-- tests/Unit/AccessoryTest.php | 8 ++-- tests/Unit/AssetMaintenanceTest.php | 8 ++-- tests/Unit/AssetModelTest.php | 2 +- tests/Unit/AssetTest.php | 18 +++---- tests/Unit/CategoryTest.php | 4 +- tests/Unit/CompanyScopingTest.php | 6 +-- tests/Unit/ComponentTest.php | 6 +-- tests/Unit/CustomFieldTest.php | 18 +++---- tests/Unit/DepreciationTest.php | 4 +- tests/Unit/Helpers/HelperTest.php | 8 ++-- tests/Unit/LdapTest.php | 22 ++++----- tests/Unit/Listeners/LogListenerTest.php | 2 +- tests/Unit/LocationTest.php | 4 +- tests/Unit/Models/Company/CompanyTest.php | 2 +- .../Company/GetIdForCurrentUserTest.php | 8 ++-- tests/Unit/Models/Labels/FieldOptionTest.php | 2 +- tests/Unit/NotificationTest.php | 2 +- tests/Unit/SnipeModelTest.php | 14 +++--- tests/Unit/SnipeTranslatorTest.php | 20 ++++---- tests/Unit/StatuslabelTest.php | 12 ++--- tests/Unit/UserTest.php | 14 +++--- 106 files changed, 498 insertions(+), 498 deletions(-) diff --git a/tests/Feature/AssetModels/Api/CreateAssetModelsTest.php b/tests/Feature/AssetModels/Api/CreateAssetModelsTest.php index a0b1c27b73..9dd0400f64 100644 --- a/tests/Feature/AssetModels/Api/CreateAssetModelsTest.php +++ b/tests/Feature/AssetModels/Api/CreateAssetModelsTest.php @@ -12,14 +12,14 @@ class CreateAssetModelsTest extends TestCase { - public function testRequiresPermissionToCreateAssetModel() + public function testRequiresPermissionToCreateAssetModel(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.models.store')) ->assertForbidden(); } - public function testCanCreateAssetModelWithAssetModelType() + public function testCanCreateAssetModelWithAssetModelType(): void { $response = $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.models.store'), [ @@ -37,7 +37,7 @@ class CreateAssetModelsTest extends TestCase $this->assertEquals('Test AssetModel', $model->name); } - public function testCannotCreateAssetModelWithoutCategory() + public function testCannotCreateAssetModelWithoutCategory(): void { $response = $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.models.store'), [ diff --git a/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php b/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php index 26e4dd75b1..4a672965d6 100644 --- a/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php +++ b/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php @@ -10,19 +10,19 @@ use Tests\TestCase; class IndexAssetModelsTest extends TestCase { - public function testViewingAssetModelIndexRequiresAuthentication() + public function testViewingAssetModelIndexRequiresAuthentication(): void { $this->getJson(route('api.models.index'))->assertRedirect(); } - public function testViewingAssetModelIndexRequiresPermission() + public function testViewingAssetModelIndexRequiresPermission(): void { $this->actingAsForApi(User::factory()->create()) ->getJson(route('api.models.index')) ->assertForbidden(); } - public function testAssetModelIndexReturnsExpectedAssetModels() + public function testAssetModelIndexReturnsExpectedAssetModels(): void { AssetModel::factory()->count(3)->create(); @@ -42,7 +42,7 @@ class IndexAssetModelsTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); } - public function testAssetModelIndexSearchReturnsExpectedAssetModels() + public function testAssetModelIndexSearchReturnsExpectedAssetModels(): void { AssetModel::factory()->count(3)->create(); AssetModel::factory()->count(1)->create(['name' => 'Test Model']); diff --git a/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.php b/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.php index c5ec212650..ab42dbdd64 100644 --- a/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.php +++ b/tests/Feature/AssetModels/Api/UpdateAssetModelsTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class UpdateAssetModelsTest extends TestCase { - public function testRequiresPermissionToEditAssetModel() + public function testRequiresPermissionToEditAssetModel(): void { $model = AssetModel::factory()->create(); $this->actingAsForApi(User::factory()->create()) @@ -18,7 +18,7 @@ class UpdateAssetModelsTest extends TestCase ->assertForbidden(); } - public function testCanUpdateAssetModelViaPatch() + public function testCanUpdateAssetModelViaPatch(): void { $model = AssetModel::factory()->create(); @@ -37,7 +37,7 @@ class UpdateAssetModelsTest extends TestCase } - public function testCannotUpdateAssetModelViaPatchWithAccessoryCategory() + public function testCannotUpdateAssetModelViaPatchWithAccessoryCategory(): void { $category = Category::factory()->forAccessories()->create(); $model = AssetModel::factory()->create(); @@ -57,7 +57,7 @@ class UpdateAssetModelsTest extends TestCase $this->assertNotEquals('category_id', $category->id, 'Category ID was not updated'); } - public function testCannotUpdateAssetModelViaPatchWithLicenseCategory() + public function testCannotUpdateAssetModelViaPatchWithLicenseCategory(): void { $category = Category::factory()->forLicenses()->create(); $model = AssetModel::factory()->create(); @@ -77,7 +77,7 @@ class UpdateAssetModelsTest extends TestCase $this->assertNotEquals('category_id', $category->id, 'Category ID was not updated'); } - public function testCannotUpdateAssetModelViaPatchWithConsumableCategory() + public function testCannotUpdateAssetModelViaPatchWithConsumableCategory(): void { $category = Category::factory()->forConsumables()->create(); $model = AssetModel::factory()->create(); @@ -97,7 +97,7 @@ class UpdateAssetModelsTest extends TestCase $this->assertNotEquals('category_id', $category->id, 'Category ID was not updated'); } - public function testCannotUpdateAssetModelViaPatchWithComponentCategory() + public function testCannotUpdateAssetModelViaPatchWithComponentCategory(): void { $category = Category::factory()->forComponents()->create(); $model = AssetModel::factory()->create(); diff --git a/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.php b/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.php index ef35aa5f6c..a959b66c9f 100644 --- a/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.php +++ b/tests/Feature/AssetModels/Ui/CreateAssetModelsTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class CreateAssetModelsTest extends TestCase { - public function testPermissionRequiredToCreateAssetModel() + public function testPermissionRequiredToCreateAssetModel(): void { $this->actingAs(User::factory()->create()) ->post(route('models.store'), [ @@ -19,7 +19,7 @@ class CreateAssetModelsTest extends TestCase ->assertForbidden(); } - public function testUserCanCreateAssetModels() + public function testUserCanCreateAssetModels(): void { $this->assertFalse(AssetModel::where('name', 'Test Model')->exists()); @@ -33,7 +33,7 @@ class CreateAssetModelsTest extends TestCase $this->assertTrue(AssetModel::where('name', 'Test Model')->exists()); } - public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType() + public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType(): void { $response = $this->actingAs(User::factory()->superuser()->create()) diff --git a/tests/Feature/AssetModels/Ui/IndexAssetModelsTest.php b/tests/Feature/AssetModels/Ui/IndexAssetModelsTest.php index 495de30f0a..4e4d6e66cc 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 testPermissionRequiredToViewAssetModelList(): void { $this->actingAs(User::factory()->create()) ->get(route('models.index')) ->assertForbidden(); } - public function testUserCanListAssetModels() + public function testUserCanListAssetModels(): void { $this->actingAs(User::factory()->superuser()->create()) ->get(route('models.index')) diff --git a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php index 423eaad574..f3eef58efe 100644 --- a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php +++ b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class UpdateAssetModelsTest extends TestCase { - public function testPermissionRequiredToStoreAssetModel() + public function testPermissionRequiredToStoreAssetModel(): void { $this->actingAs(User::factory()->create()) ->post(route('models.store'), [ @@ -20,7 +20,7 @@ class UpdateAssetModelsTest extends TestCase ->assertForbidden(); } - public function testUserCanEditAssetModels() + public function testUserCanEditAssetModels(): void { $category = Category::factory()->forAssets()->create(); $model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]); @@ -40,7 +40,7 @@ class UpdateAssetModelsTest extends TestCase } - public function testUserCannotChangeAssetModelCategoryType() + public function testUserCannotChangeAssetModelCategoryType(): void { $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.php index bc5b6043e4..6f51739135 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 testAssetApiAcceptsFileUpload(): void { // Upload a file to an asset @@ -28,7 +28,7 @@ class AssetFilesTest extends TestCase ->assertOk(); } - public function testAssetApiListsFiles() + public function testAssetApiListsFiles(): void { // List all files on an asset @@ -50,7 +50,7 @@ class AssetFilesTest extends TestCase ]); } - public function testAssetApiDownloadsFile() + public function testAssetApiDownloadsFile(): void { // Download a file from an asset @@ -84,7 +84,7 @@ class AssetFilesTest extends TestCase ->assertOk(); } - public function testAssetApiDeletesFile() + public function testAssetApiDeletesFile(): void { // Delete a file from an asset diff --git a/tests/Feature/Assets/Api/AssetIndexTest.php b/tests/Feature/Assets/Api/AssetIndexTest.php index c4a362d28b..4d40ba954a 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 testAssetApiIndexReturnsExpectedAssets(): void { Asset::factory()->count(3)->create(); @@ -31,7 +31,7 @@ class AssetIndexTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); } - public function testAssetApiIndexReturnsDisplayUpcomingAuditsDue() + public function testAssetApiIndexReturnsDisplayUpcomingAuditsDue(): void { Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->format('Y-m-d')]); @@ -47,7 +47,7 @@ class AssetIndexTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); } - public function testAssetApiIndexReturnsOverdueForAudit() + public function testAssetApiIndexReturnsOverdueForAudit(): void { Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->subDays(1)->format('Y-m-d')]); @@ -63,7 +63,7 @@ class AssetIndexTest extends TestCase } - public function testAssetApiIndexReturnsDueOrOverdueForAudit() + public function testAssetApiIndexReturnsDueOrOverdueForAudit(): void { 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')]); @@ -81,7 +81,7 @@ class AssetIndexTest extends TestCase - public function testAssetApiIndexReturnsDueForExpectedCheckin() + public function testAssetApiIndexReturnsDueForExpectedCheckin(): void { Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->format('Y-m-d')]); @@ -97,7 +97,7 @@ class AssetIndexTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); } - public function testAssetApiIndexReturnsOverdueForExpectedCheckin() + public function testAssetApiIndexReturnsOverdueForExpectedCheckin(): void { Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->subDays(1)->format('Y-m-d')]); @@ -111,7 +111,7 @@ class AssetIndexTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); } - public function testAssetApiIndexReturnsDueOrOverdueForExpectedCheckin() + public function testAssetApiIndexReturnsDueOrOverdueForExpectedCheckin(): void { Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->subDays(1)->format('Y-m-d')]); Asset::factory()->count(2)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->format('Y-m-d')]); @@ -126,7 +126,7 @@ class AssetIndexTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('rows', 5)->etc()); } - public function testAssetApiIndexAdheresToCompanyScoping() + public function testAssetApiIndexAdheresToCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Feature/Assets/Api/AssetsForSelectListTest.php b/tests/Feature/Assets/Api/AssetsForSelectListTest.php index de797651e4..603fab6178 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 testAssetsCanBeSearchedForByAssetTag(): void { Asset::factory()->create(['asset_tag' => '0001']); Asset::factory()->create(['asset_tag' => '0002']); @@ -25,7 +25,7 @@ class AssetsForSelectListTest extends TestCase $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, '0002'))); } - public function testAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled() + public function testAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Feature/Assets/Api/RequestableAssetTest.php b/tests/Feature/Assets/Api/RequestableAssetTest.php index d24913ad66..28b916380a 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 testViewingRequestableAssetsRequiresCorrectPermission(): void { $this->actingAsForApi(User::factory()->create()) ->getJson(route('api.assets.requestable')) ->assertForbidden(); } - public function testReturnsRequestableAssets() + public function testReturnsRequestableAssets(): void { $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 testRequestableAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Feature/Assets/Api/StoreAssetTest.php b/tests/Feature/Assets/Api/StoreAssetTest.php index a3f5981635..5eba2d94b4 100644 --- a/tests/Feature/Assets/Api/StoreAssetTest.php +++ b/tests/Feature/Assets/Api/StoreAssetTest.php @@ -16,14 +16,14 @@ use Tests\TestCase; class StoreAssetTest extends TestCase { - public function testRequiresPermissionToCreateAsset() + public function testRequiresPermissionToCreateAsset(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.assets.store')) ->assertForbidden(); } - public function testAllAssetAttributesAreStored() + public function testAllAssetAttributesAreStored(): void { $company = Company::factory()->create(); $location = Location::factory()->create(); @@ -83,7 +83,7 @@ class StoreAssetTest extends TestCase $this->assertEquals(10, $asset->warranty_months); } - public function testSetsLastAuditDateToMidnightOfProvidedDate() + public function testSetsLastAuditDateToMidnightOfProvidedDate(): void { $response = $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.assets.store'), [ @@ -99,7 +99,7 @@ class StoreAssetTest extends TestCase $this->assertEquals('2023-09-03 00:00:00', $asset->last_audit_date); } - public function testLastAuditDateCanBeNull() + public function testLastAuditDateCanBeNull(): void { $response = $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.assets.store'), [ @@ -115,7 +115,7 @@ class StoreAssetTest extends TestCase $this->assertNull($asset->last_audit_date); } - public function testNonDateUsedForLastAuditDateReturnsValidationError() + public function testNonDateUsedForLastAuditDateReturnsValidationError(): void { $response = $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.assets.store'), [ @@ -129,7 +129,7 @@ class StoreAssetTest extends TestCase $this->assertNotNull($response->json('messages.last_audit_date')); } - public function testArchivedDepreciateAndPhysicalCanBeNull() + public function testArchivedDepreciateAndPhysicalCanBeNull(): void { $model = AssetModel::factory()->ipadModel()->create(); $status = Statuslabel::factory()->create(); @@ -154,7 +154,7 @@ class StoreAssetTest extends TestCase $this->assertEquals(0, $asset->depreciate); } - public function testArchivedDepreciateAndPhysicalCanBeEmpty() + public function testArchivedDepreciateAndPhysicalCanBeEmpty(): void { $model = AssetModel::factory()->ipadModel()->create(); $status = Statuslabel::factory()->create(); @@ -179,7 +179,7 @@ class StoreAssetTest extends TestCase $this->assertEquals(0, $asset->depreciate); } - public function testAssetEolDateIsCalculatedIfPurchaseDateSet() + public function testAssetEolDateIsCalculatedIfPurchaseDateSet(): void { $model = AssetModel::factory()->mbp13Model()->create(); $status = Statuslabel::factory()->create(); @@ -200,7 +200,7 @@ class StoreAssetTest extends TestCase $this->assertEquals('2024-01-01', $asset->asset_eol_date); } - public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet() + public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet(): void { $model = AssetModel::factory()->mbp13Model()->create(); $status = Statuslabel::factory()->create(); @@ -220,7 +220,7 @@ class StoreAssetTest extends TestCase $this->assertNull($asset->asset_eol_date); } - public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet() + public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet(): void { $model = AssetModel::factory()->mbp13Model()->create(); $status = Statuslabel::factory()->create(); @@ -242,7 +242,7 @@ class StoreAssetTest extends TestCase $this->assertTrue($asset->eol_explicit); } - public function testAssetGetsAssetTagWithAutoIncrement() + public function testAssetGetsAssetTagWithAutoIncrement(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -262,7 +262,7 @@ class StoreAssetTest extends TestCase $this->assertNotNull($asset->asset_tag); } - public function testAssetCreationFailsWithNoAssetTagOrAutoIncrement() + public function testAssetCreationFailsWithNoAssetTagOrAutoIncrement(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -278,7 +278,7 @@ class StoreAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testStoresPeriodAsDecimalSeparatorForPurchaseCost() + public function testStoresPeriodAsDecimalSeparatorForPurchaseCost(): void { $this->settings->set([ 'default_currency' => 'USD', @@ -300,7 +300,7 @@ class StoreAssetTest extends TestCase $this->assertEquals(12.34, $asset->purchase_cost); } - public function testStoresPeriodAsCommaSeparatorForPurchaseCost() + public function testStoresPeriodAsCommaSeparatorForPurchaseCost(): void { $this->settings->set([ 'default_currency' => 'EUR', @@ -322,7 +322,7 @@ class StoreAssetTest extends TestCase $this->assertEquals(12.34, $asset->purchase_cost); } - public function testUniqueSerialNumbersIsEnforcedWhenEnabled() + public function testUniqueSerialNumbersIsEnforcedWhenEnabled(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -350,7 +350,7 @@ class StoreAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testUniqueSerialNumbersIsNotEnforcedWhenDisabled() + public function testUniqueSerialNumbersIsNotEnforcedWhenDisabled(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -378,7 +378,7 @@ class StoreAssetTest extends TestCase ->assertStatusMessageIs('success'); } - public function testAssetTagsMustBeUniqueWhenUndeleted() + public function testAssetTagsMustBeUniqueWhenUndeleted(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -405,7 +405,7 @@ class StoreAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testAssetTagsCanBeDuplicatedIfDeleted() + public function testAssetTagsCanBeDuplicatedIfDeleted(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -435,7 +435,7 @@ class StoreAssetTest extends TestCase ->assertStatusMessageIs('success'); } - public function testAnAssetCanBeCheckedOutToUserOnStore() + public function testAnAssetCanBeCheckedOutToUserOnStore(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -461,7 +461,7 @@ class StoreAssetTest extends TestCase $this->assertTrue($asset->assignedTo->is($userAssigned)); } - public function testAnAssetCanBeCheckedOutToLocationOnStore() + public function testAnAssetCanBeCheckedOutToLocationOnStore(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -487,7 +487,7 @@ class StoreAssetTest extends TestCase $this->assertTrue($asset->location->is($location)); } - public function testAnAssetCanBeCheckedOutToAssetOnStore() + public function testAnAssetCanBeCheckedOutToAssetOnStore(): void { $model = AssetModel::factory()->create(); $status = Statuslabel::factory()->create(); @@ -514,7 +514,7 @@ class StoreAssetTest extends TestCase $this->assertTrue($asset->assignedAssets()->find($response['payload']['id'])->is($apiAsset)); } - public function testCompanyIdNeedsToBeInteger() + public function testCompanyIdNeedsToBeInteger(): void { $this->actingAsForApi(User::factory()->createAssets()->create()) ->postJson(route('api.assets.store'), [ @@ -526,7 +526,7 @@ class StoreAssetTest extends TestCase }); } - public function testEncryptedCustomFieldCanBeStored() + public function testEncryptedCustomFieldCanBeStored(): void { $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); @@ -550,7 +550,7 @@ class StoreAssetTest extends TestCase $this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()})); } - public function testPermissionNeededToStoreEncryptedField() + public function testPermissionNeededToStoreEncryptedField(): void { // @todo: $this->markTestIncomplete(); diff --git a/tests/Feature/Assets/Api/UpdateAssetTest.php b/tests/Feature/Assets/Api/UpdateAssetTest.php index db5893b4dc..65b89ede26 100644 --- a/tests/Feature/Assets/Api/UpdateAssetTest.php +++ b/tests/Feature/Assets/Api/UpdateAssetTest.php @@ -15,14 +15,14 @@ use Tests\TestCase; class UpdateAssetTest extends TestCase { - public function testThatANonExistentAssetIdReturnsError() + public function testThatANonExistentAssetIdReturnsError(): void { $this->actingAsForApi(User::factory()->editAssets()->createAssets()->create()) ->patchJson(route('api.assets.update', 123456789)) ->assertStatusMessageIs('error'); } - public function testRequiresPermissionToUpdateAsset() + public function testRequiresPermissionToUpdateAsset(): void { $asset = Asset::factory()->create(); @@ -31,7 +31,7 @@ class UpdateAssetTest extends TestCase ->assertForbidden(); } - public function testGivenPermissionUpdateAssetIsAllowed() + public function testGivenPermissionUpdateAssetIsAllowed(): void { $asset = Asset::factory()->create(); @@ -43,7 +43,7 @@ class UpdateAssetTest extends TestCase ->assertOk(); } - public function testAllAssetAttributesAreStored() + public function testAllAssetAttributesAreStored(): void { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); @@ -103,7 +103,7 @@ class UpdateAssetTest extends TestCase $this->assertEquals('2023-09-03 00:00:00', $updatedAsset->last_audit_date); } - public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated() + public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated(): void { $asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create(); @@ -120,7 +120,7 @@ class UpdateAssetTest extends TestCase $this->assertEquals('2024-01-01', $asset->asset_eol_date); } - public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet() + public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet(): void { $asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create(); @@ -138,7 +138,7 @@ class UpdateAssetTest extends TestCase $this->assertEquals('2022-01-01', $asset->asset_eol_date); } - public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet() + public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet(): void { $asset = Asset::factory()->laptopMbp()->create(); @@ -156,7 +156,7 @@ class UpdateAssetTest extends TestCase $this->assertTrue($asset->eol_explicit); } - public function testAssetTagCannotUpdateToNullValue() + public function testAssetTagCannotUpdateToNullValue(): void { $asset = Asset::factory()->laptopMbp()->create(); @@ -168,7 +168,7 @@ class UpdateAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testAssetTagCannotUpdateToEmptyStringValue() + public function testAssetTagCannotUpdateToEmptyStringValue(): void { $asset = Asset::factory()->laptopMbp()->create(); @@ -180,7 +180,7 @@ class UpdateAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testModelIdCannotUpdateToNullValue() + public function testModelIdCannotUpdateToNullValue(): void { $asset = Asset::factory()->laptopMbp()->create(); @@ -192,7 +192,7 @@ class UpdateAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testModelIdCannotUpdateToEmptyStringValue() + public function testModelIdCannotUpdateToEmptyStringValue(): void { $asset = Asset::factory()->laptopMbp()->create(); @@ -204,7 +204,7 @@ class UpdateAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testStatusIdCannotUpdateToNullValue() + public function testStatusIdCannotUpdateToNullValue(): void { $asset = Asset::factory()->laptopMbp()->create(); @@ -216,7 +216,7 @@ class UpdateAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testStatusIdCannotUpdateToEmptyStringValue() + public function testStatusIdCannotUpdateToEmptyStringValue(): void { $asset = Asset::factory()->laptopMbp()->create(); @@ -228,7 +228,7 @@ class UpdateAssetTest extends TestCase ->assertStatusMessageIs('error'); } - public function testIfRtdLocationIdIsSetWithoutLocationIdAssetReturnsToDefault() + public function testIfRtdLocationIdIsSetWithoutLocationIdAssetReturnsToDefault(): void { $location = Location::factory()->create(); $asset = Asset::factory()->laptopMbp()->create([ @@ -247,7 +247,7 @@ class UpdateAssetTest extends TestCase $this->assertTrue($asset->location->is($rtdLocation)); } - public function testIfLocationAndRtdLocationAreSetLocationIdIsLocation() + public function testIfLocationAndRtdLocationAreSetLocationIdIsLocation(): void { $location = Location::factory()->create(); $asset = Asset::factory()->laptopMbp()->create(); @@ -265,7 +265,7 @@ class UpdateAssetTest extends TestCase $this->assertTrue($asset->location->is($location)); } - public function testEncryptedCustomFieldCanBeUpdated() + public function testEncryptedCustomFieldCanBeUpdated(): void { $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); @@ -284,7 +284,7 @@ class UpdateAssetTest extends TestCase $this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()})); } - public function testPermissionNeededToUpdateEncryptedField() + public function testPermissionNeededToUpdateEncryptedField(): void { $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); @@ -308,7 +308,7 @@ class UpdateAssetTest extends TestCase $this->assertEquals("encrypted value should not change", Crypt::decrypt($asset->{$field->db_column_name()})); } - public function testCheckoutToUserOnAssetUpdate() + public function testCheckoutToUserOnAssetUpdate(): void { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); @@ -327,7 +327,7 @@ class UpdateAssetTest extends TestCase $this->assertEquals($asset->assigned_type, 'App\Models\User'); } - public function testCheckoutToDeletedUserFailsOnAssetUpdate() + public function testCheckoutToDeletedUserFailsOnAssetUpdate(): void { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); @@ -346,7 +346,7 @@ class UpdateAssetTest extends TestCase $this->assertNull($asset->assigned_type); } - public function testCheckoutToLocationOnAssetUpdate() + public function testCheckoutToLocationOnAssetUpdate(): void { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); @@ -366,7 +366,7 @@ class UpdateAssetTest extends TestCase } - public function testCheckoutToDeletedLocationFailsOnAssetUpdate() + public function testCheckoutToDeletedLocationFailsOnAssetUpdate(): void { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); @@ -385,7 +385,7 @@ class UpdateAssetTest extends TestCase $this->assertNull($asset->assigned_type); } - public function testCheckoutAssetOnAssetUpdate() + public function testCheckoutAssetOnAssetUpdate(): void { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); @@ -406,7 +406,7 @@ class UpdateAssetTest extends TestCase } - public function testCheckoutToDeletedAssetFailsOnAssetUpdate() + public function testCheckoutToDeletedAssetFailsOnAssetUpdate(): void { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); @@ -425,7 +425,7 @@ class UpdateAssetTest extends TestCase $this->assertNull($asset->assigned_type); } - public function testAssetCannotBeUpdatedByUserInSeparateCompany() + public function testAssetCannotBeUpdatedByUserInSeparateCompany(): void { $this->settings->enableMultipleFullCompanySupport(); diff --git a/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.php b/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.php index d1375c5393..1470341fbd 100644 --- a/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.php +++ b/tests/Feature/Assets/Ui/BulkDeleteAssetsTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class BulkDeleteAssetsTest extends TestCase { - public function testUserWithPermissionsCanAccessPage() + public function testUserWithPermissionsCanAccessPage(): void { $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $assets = Asset::factory()->count(2)->create(); @@ -25,7 +25,7 @@ class BulkDeleteAssetsTest extends TestCase ])->assertStatus(200); } - public function testStandardUserCannotAccessPage() + public function testStandardUserCannotAccessPage(): void { $user = User::factory()->create(); $assets = Asset::factory()->count(2)->create(); @@ -38,7 +38,7 @@ class BulkDeleteAssetsTest extends TestCase ])->assertStatus(403); } - public function testPageRedirectFromInterstitialIfNoAssetsSelectedToDelete() + public function testPageRedirectFromInterstitialIfNoAssetsSelectedToDelete(): void { $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $response = $this->actingAs($user) @@ -52,7 +52,7 @@ class BulkDeleteAssetsTest extends TestCase $this->followRedirects($response)->assertSee('alert-danger'); } - public function testPageRedirectFromInterstitialIfNoAssetsSelectedToRestore() + public function testPageRedirectFromInterstitialIfNoAssetsSelectedToRestore(): void { $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $response = $this->actingAs($user) @@ -68,7 +68,7 @@ class BulkDeleteAssetsTest extends TestCase } - public function testBulkDeleteSelectedAssetsFromInterstitial() + public function testBulkDeleteSelectedAssetsFromInterstitial(): void { $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $assets = Asset::factory()->count(2)->create(); @@ -89,7 +89,7 @@ class BulkDeleteAssetsTest extends TestCase $this->followRedirects($response)->assertSee('alert-success'); } - public function testBulkRestoreSelectedAssetsFromInterstitial() + public function testBulkRestoreSelectedAssetsFromInterstitial(): void { $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $asset = Asset::factory()->deleted()->create(); @@ -116,7 +116,7 @@ class BulkDeleteAssetsTest extends TestCase } - public function testActionLogCreatedUponBulkDelete() + public function testActionLogCreatedUponBulkDelete(): void { $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $asset = Asset::factory()->create(); @@ -139,7 +139,7 @@ class BulkDeleteAssetsTest extends TestCase ); } - public function testActionLogCreatedUponBulkRestore() + public function testActionLogCreatedUponBulkRestore(): void { $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $asset = Asset::factory()->deleted()->create(); diff --git a/tests/Feature/Assets/Ui/BulkEditAssetsTest.php b/tests/Feature/Assets/Ui/BulkEditAssetsTest.php index 02d39a7b45..ffc23cf584 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 testUserWithPermissionsCanAccessPage(): void { $user = User::factory()->viewAssets()->editAssets()->create(); $assets = Asset::factory()->count(2)->create(); @@ -29,7 +29,7 @@ class BulkEditAssetsTest extends TestCase ])->assertStatus(200); } - public function testStandardUserCannotAccessPage() + public function testStandardUserCannotAccessPage(): void { $user = User::factory()->create(); $assets = Asset::factory()->count(2)->create(); @@ -44,7 +44,7 @@ class BulkEditAssetsTest extends TestCase ])->assertStatus(403); } - public function testBulkEditAssetsAcceptsAllPossibleAttributes() + public function testBulkEditAssetsAcceptsAllPossibleAttributes(): void { // sets up all needed models and attributes on the assets // this test does not deal with custom fields - will be dealt with in separate cases @@ -109,7 +109,7 @@ class BulkEditAssetsTest extends TestCase }); } - public function testBulkEditAssetsAcceptsAndUpdatesUnencryptedCustomFields() + public function testBulkEditAssetsAcceptsAndUpdatesUnencryptedCustomFields(): void { $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); @@ -141,7 +141,7 @@ class BulkEditAssetsTest extends TestCase }); } - public function testBulkEditAssetsAcceptsAndUpdatesEncryptedCustomFields() + public function testBulkEditAssetsAcceptsAndUpdatesEncryptedCustomFields(): void { $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); @@ -165,7 +165,7 @@ class BulkEditAssetsTest extends TestCase }); } - public function testBulkEditAssetsRequiresAdminUserToUpdateEncryptedCustomFields() + public function testBulkEditAssetsRequiresAdminUserToUpdateEncryptedCustomFields(): void { $this->markIncompleteIfMySQL('Custom Fields tests do not work on mysql'); $edit_user = User::factory()->editAssets()->create(); diff --git a/tests/Feature/Assets/Ui/CloneAssetTest.php b/tests/Feature/Assets/Ui/CloneAssetTest.php index 18e1ccc5e5..819f5cd161 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 testPermissionRequiredToCreateAssetModel() + public function testPermissionRequiredToCreateAssetModel(): void { $asset = Asset::factory()->create(); $this->actingAs(User::factory()->create()) @@ -24,7 +24,7 @@ class CloneAssetTest extends TestCase $response->assertStatus(200); } - public function testAssetCanBeCloned() + public function testAssetCanBeCloned(): void { $asset_to_clone = Asset::factory()->create(['name'=>'Asset to clone']); $this->actingAs(User::factory()->createAssets()->create()) diff --git a/tests/Feature/Assets/Ui/EditAssetTest.php b/tests/Feature/Assets/Ui/EditAssetTest.php index 2c19e768b4..2c75649d31 100644 --- a/tests/Feature/Assets/Ui/EditAssetTest.php +++ b/tests/Feature/Assets/Ui/EditAssetTest.php @@ -11,7 +11,7 @@ use Tests\TestCase; class EditAssetTest extends TestCase { - public function testPermissionRequiredToViewLicense() + public function testPermissionRequiredToViewLicense(): void { $asset = Asset::factory()->create(); $this->actingAs(User::factory()->create()) @@ -27,7 +27,7 @@ class EditAssetTest extends TestCase $response->assertStatus(200); } - public function testAssetEditPostIsRedirectedIfRedirectSelectionIsIndex() + public function testAssetEditPostIsRedirectedIfRedirectSelectionIsIndex(): void { $asset = Asset::factory()->assignedToUser()->create(); @@ -45,7 +45,7 @@ class EditAssetTest extends TestCase ->assertRedirect(route('hardware.index')); $this->assertDatabaseHas('assets', ['asset_tag' => 'New Asset Tag']); } - public function testAssetEditPostIsRedirectedIfRedirectSelectionIsItem() + public function testAssetEditPostIsRedirectedIfRedirectSelectionIsItem(): void { $asset = Asset::factory()->create(); diff --git a/tests/Feature/Categories/Api/CreateCategoriesTest.php b/tests/Feature/Categories/Api/CreateCategoriesTest.php index fc464242af..8d2d6d35bf 100644 --- a/tests/Feature/Categories/Api/CreateCategoriesTest.php +++ b/tests/Feature/Categories/Api/CreateCategoriesTest.php @@ -13,14 +13,14 @@ class CreateCategoriesTest extends TestCase { - public function testRequiresPermissionToCreateCategory() + public function testRequiresPermissionToCreateCategory(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.categories.store')) ->assertForbidden(); } - public function testCanCreateCategoryWithValidCategoryType() + public function testCanCreateCategoryWithValidCategoryType(): void { $response = $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.categories.store'), [ @@ -41,7 +41,7 @@ class CreateCategoriesTest extends TestCase $this->assertEquals('accessory', $category->category_type); } - public function testCannotCreateCategoryWithoutCategoryType() + public function testCannotCreateCategoryWithoutCategoryType(): void { $response = $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.categories.store'), [ @@ -59,7 +59,7 @@ class CreateCategoriesTest extends TestCase } - public function testCannotCreateCategoryWithInvalidCategoryType() + public function testCannotCreateCategoryWithInvalidCategoryType(): void { $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.categories.store'), [ diff --git a/tests/Feature/Categories/Api/IndexCategoriesTest.php b/tests/Feature/Categories/Api/IndexCategoriesTest.php index d27bfbb068..04cbb516bc 100644 --- a/tests/Feature/Categories/Api/IndexCategoriesTest.php +++ b/tests/Feature/Categories/Api/IndexCategoriesTest.php @@ -10,14 +10,14 @@ use Tests\TestCase; class IndexCategoriesTest extends TestCase { - public function testViewingCategoryIndexRequiresPermission() + public function testViewingCategoryIndexRequiresPermission(): void { $this->actingAsForApi(User::factory()->create()) ->getJson(route('api.departments.index')) ->assertForbidden(); } - public function testCategoryIndexReturnsExpectedSearchResults() + public function testCategoryIndexReturnsExpectedSearchResults(): void { Category::factory()->count(10)->create(); Category::factory()->count(1)->forAssets()->create(['name' => 'My Test Category']); @@ -43,7 +43,7 @@ class IndexCategoriesTest extends TestCase } - public function testCategoryIndexReturnsExpectedCategories() + public function testCategoryIndexReturnsExpectedCategories(): void { $this->markTestIncomplete('Not sure why the category factory is generating one more than expected here.'); Category::factory()->count(3)->create(); diff --git a/tests/Feature/Categories/Api/UpdateCategoriesTest.php b/tests/Feature/Categories/Api/UpdateCategoriesTest.php index 1a784c1179..ebfdb862d2 100644 --- a/tests/Feature/Categories/Api/UpdateCategoriesTest.php +++ b/tests/Feature/Categories/Api/UpdateCategoriesTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class UpdateCategoriesTest extends TestCase { - public function testCanUpdateCategoryViaPatchWithoutCategoryType() + public function testCanUpdateCategoryViaPatchWithoutCategoryType(): void { $category = Category::factory()->create(); @@ -30,7 +30,7 @@ class UpdateCategoriesTest extends TestCase } - public function testCannotUpdateCategoryViaPatchWithCategoryType() + public function testCannotUpdateCategoryViaPatchWithCategoryType(): void { $category = Category::factory()->create(); diff --git a/tests/Feature/Categories/Ui/CreateCategoriesTest.php b/tests/Feature/Categories/Ui/CreateCategoriesTest.php index 87312ad257..358d3564ce 100644 --- a/tests/Feature/Categories/Ui/CreateCategoriesTest.php +++ b/tests/Feature/Categories/Ui/CreateCategoriesTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class CreateCategoriesTest extends TestCase { - public function testPermissionRequiredToCreateCategories() + public function testPermissionRequiredToCreateCategories(): void { $this->actingAs(User::factory()->create()) ->post(route('categories.store'), [ @@ -19,7 +19,7 @@ class CreateCategoriesTest extends TestCase ->assertForbidden(); } - public function testUserCanCreateCategories() + public function testUserCanCreateCategories(): void { $this->assertFalse(Category::where('name', 'Test Category')->exists()); @@ -33,7 +33,7 @@ class CreateCategoriesTest extends TestCase $this->assertTrue(Category::where('name', 'Test Category')->exists()); } - public function testUserCannotCreateCategoriesWithInvalidType() + public function testUserCannotCreateCategoriesWithInvalidType(): void { $this->assertFalse(Category::where('name', 'Test Category')->exists()); diff --git a/tests/Feature/Categories/Ui/IndexCategoriesTest.php b/tests/Feature/Categories/Ui/IndexCategoriesTest.php index caacba99a9..231377f7cd 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 testPermissionRequiredToViewCategoryList(): void { $this->actingAs(User::factory()->create()) ->get(route('categories.index')) ->assertForbidden(); } - public function testUserCanListCategories() + public function testUserCanListCategories(): void { $this->actingAs(User::factory()->superuser()->create()) ->get(route('categories.index')) diff --git a/tests/Feature/Categories/Ui/UpdateCategoriesTest.php b/tests/Feature/Categories/Ui/UpdateCategoriesTest.php index 98b67c7d32..abe2f3092b 100644 --- a/tests/Feature/Categories/Ui/UpdateCategoriesTest.php +++ b/tests/Feature/Categories/Ui/UpdateCategoriesTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class UpdateCategoriesTest extends TestCase { - public function testPermissionRequiredToStoreCategory() + public function testPermissionRequiredToStoreCategory(): void { $this->actingAs(User::factory()->create()) ->post(route('categories.store'), [ @@ -20,7 +20,7 @@ class UpdateCategoriesTest extends TestCase ->assertForbidden(); } - public function testUserCanCreateCategories() + public function testUserCanCreateCategories(): void { $this->actingAs(User::factory()->superuser()->create()) ->post(route('categories.store'), [ @@ -34,7 +34,7 @@ class UpdateCategoriesTest extends TestCase $this->assertTrue(Category::where('name', 'Test Category')->exists()); } - public function testUserCanEditAssetCategory() + public function testUserCanEditAssetCategory(): void { $category = Category::factory()->forAssets()->create(['name' => 'Test Category']); $this->assertTrue(Category::where('name', 'Test Category')->exists()); @@ -52,7 +52,7 @@ class UpdateCategoriesTest extends TestCase } - public function testUserCanChangeCategoryTypeIfNoAssetsAssociated() + public function testUserCanChangeCategoryTypeIfNoAssetsAssociated(): void { $category = Category::factory()->forAssets()->create(['name' => 'Test Category']); $this->assertTrue(Category::where('name', 'Test Category')->exists()); @@ -72,7 +72,7 @@ class UpdateCategoriesTest extends TestCase } - public function testUserCannotChangeCategoryTypeIfAssetsAreAssociated() + public function testUserCannotChangeCategoryTypeIfAssetsAreAssociated(): void { Asset::factory()->count(5)->laptopMbp()->create(); $category = Category::where('name', 'Laptops')->first(); diff --git a/tests/Feature/Checkins/Api/AssetCheckinTest.php b/tests/Feature/Checkins/Api/AssetCheckinTest.php index 0e041fc73a..d3b068e5b5 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 testCheckingInAssetRequiresCorrectPermission(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create())) ->assertForbidden(); } - public function testCannotCheckInNonExistentAsset() + public function testCannotCheckInNonExistentAsset(): void { $this->actingAsForApi(User::factory()->checkinAssets()->create()) ->postJson(route('api.asset.checkin', ['id' => 'does-not-exist'])) ->assertStatusMessageIs('error'); } - public function testCannotCheckInAssetThatIsNotCheckedOut() + public function testCannotCheckInAssetThatIsNotCheckedOut(): void { $this->actingAsForApi(User::factory()->checkinAssets()->create()) ->postJson(route('api.asset.checkin', Asset::factory()->create()->id)) ->assertStatusMessageIs('error'); } - public function testAssetCanBeCheckedIn() + public function testAssetCanBeCheckedIn(): void { Event::fake([CheckoutableCheckedIn::class]); @@ -76,7 +76,7 @@ class AssetCheckinTest extends TestCase }, 1); } - public function testLocationIsSetToRTDLocationByDefaultUponCheckin() + public function testLocationIsSetToRTDLocationByDefaultUponCheckin(): void { $rtdLocation = Location::factory()->create(); $asset = Asset::factory()->assignedToUser()->create([ @@ -90,7 +90,7 @@ class AssetCheckinTest extends TestCase $this->assertTrue($asset->refresh()->location()->is($rtdLocation)); } - public function testDefaultLocationCanBeUpdatedUponCheckin() + public function testDefaultLocationCanBeUpdatedUponCheckin(): void { $location = Location::factory()->create(); $asset = Asset::factory()->assignedToUser()->create(); @@ -104,7 +104,7 @@ class AssetCheckinTest extends TestCase $this->assertTrue($asset->refresh()->defaultLoc()->is($location)); } - public function testAssetsLicenseSeatsAreClearedUponCheckin() + public function testAssetsLicenseSeatsAreClearedUponCheckin(): void { $asset = Asset::factory()->assignedToUser()->create(); LicenseSeat::factory()->assignedToUser()->for($asset)->create(); @@ -117,7 +117,7 @@ class AssetCheckinTest extends TestCase $this->assertNull($asset->refresh()->licenseseats->first()->assigned_to); } - public function testLegacyLocationValuesSetToZeroAreUpdated() + public function testLegacyLocationValuesSetToZeroAreUpdated(): void { $asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([ 'rtd_location_id' => 0, @@ -131,7 +131,7 @@ class AssetCheckinTest extends TestCase $this->assertEquals($asset->location_id, $asset->rtd_location_id); } - public function testPendingCheckoutAcceptancesAreClearedUponCheckin() + public function testPendingCheckoutAcceptancesAreClearedUponCheckin(): void { $asset = Asset::factory()->assignedToUser()->create(); @@ -143,7 +143,7 @@ class AssetCheckinTest extends TestCase $this->assertFalse($acceptance->exists(), 'Acceptance was not deleted'); } - public function testCheckinTimeAndActionLogNoteCanBeSet() + public function testCheckinTimeAndActionLogNoteCanBeSet(): void { Event::fake(); diff --git a/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php b/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php index 7a99b2ab56..4e078a1b49 100644 --- a/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php +++ b/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php @@ -12,7 +12,7 @@ use Tests\TestCase; class AccessoryCheckinTest extends TestCase { - public function testCheckingInAccessoryRequiresCorrectPermission() + public function testCheckingInAccessoryRequiresCorrectPermission(): void { $accessory = Accessory::factory()->checkedOutToUser()->create(); @@ -21,7 +21,7 @@ class AccessoryCheckinTest extends TestCase ->assertForbidden(); } - public function testAccessoryCanBeCheckedIn() + public function testAccessoryCanBeCheckedIn(): void { Event::fake([CheckoutableCheckedIn::class]); @@ -38,7 +38,7 @@ class AccessoryCheckinTest extends TestCase Event::assertDispatched(CheckoutableCheckedIn::class, 1); } - public function testEmailSentToUserIfSettingEnabled() + public function testEmailSentToUserIfSettingEnabled(): void { Notification::fake(); @@ -62,7 +62,7 @@ class AccessoryCheckinTest extends TestCase ); } - public function testEmailNotSentToUserIfSettingDisabled() + public function testEmailNotSentToUserIfSettingDisabled(): void { Notification::fake(); diff --git a/tests/Feature/Checkins/Ui/AssetCheckinTest.php b/tests/Feature/Checkins/Ui/AssetCheckinTest.php index f412d4439e..a03a4c931d 100644 --- a/tests/Feature/Checkins/Ui/AssetCheckinTest.php +++ b/tests/Feature/Checkins/Ui/AssetCheckinTest.php @@ -15,7 +15,7 @@ use Tests\TestCase; class AssetCheckinTest extends TestCase { - public function testCheckingInAssetRequiresCorrectPermission() + public function testCheckingInAssetRequiresCorrectPermission(): void { $this->actingAs(User::factory()->create()) ->post(route('hardware.checkin.store', [ @@ -24,7 +24,7 @@ class AssetCheckinTest extends TestCase ->assertForbidden(); } - public function testCannotCheckInAssetThatIsNotCheckedOut() + public function testCannotCheckInAssetThatIsNotCheckedOut(): void { $this->actingAs(User::factory()->checkinAssets()->create()) ->post(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id])) @@ -33,7 +33,7 @@ class AssetCheckinTest extends TestCase ->assertRedirect(route('hardware.index')); } - public function testCannotStoreAssetCheckinThatIsNotCheckedOut() + public function testCannotStoreAssetCheckinThatIsNotCheckedOut(): void { $this->actingAs(User::factory()->checkinAssets()->create()) ->get(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id])) @@ -42,7 +42,7 @@ class AssetCheckinTest extends TestCase ->assertRedirect(route('hardware.index')); } - public function testAssetCanBeCheckedIn() + public function testAssetCanBeCheckedIn(): void { Event::fake([CheckoutableCheckedIn::class]); @@ -85,7 +85,7 @@ class AssetCheckinTest extends TestCase }, 1); } - public function testLocationIsSetToRTDLocationByDefaultUponCheckin() + public function testLocationIsSetToRTDLocationByDefaultUponCheckin(): void { $rtdLocation = Location::factory()->create(); $asset = Asset::factory()->assignedToUser()->create([ @@ -99,7 +99,7 @@ class AssetCheckinTest extends TestCase $this->assertTrue($asset->refresh()->location()->is($rtdLocation)); } - public function testDefaultLocationCanBeUpdatedUponCheckin() + public function testDefaultLocationCanBeUpdatedUponCheckin(): void { $location = Location::factory()->create(); $asset = Asset::factory()->assignedToUser()->create(); @@ -113,7 +113,7 @@ class AssetCheckinTest extends TestCase $this->assertTrue($asset->refresh()->defaultLoc()->is($location)); } - public function testAssetsLicenseSeatsAreClearedUponCheckin() + public function testAssetsLicenseSeatsAreClearedUponCheckin(): void { $asset = Asset::factory()->assignedToUser()->create(); LicenseSeat::factory()->assignedToUser()->for($asset)->create(); @@ -126,7 +126,7 @@ class AssetCheckinTest extends TestCase $this->assertNull($asset->refresh()->licenseseats->first()->assigned_to); } - public function testLegacyLocationValuesSetToZeroAreUpdated() + public function testLegacyLocationValuesSetToZeroAreUpdated(): void { $asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([ 'rtd_location_id' => 0, @@ -140,7 +140,7 @@ class AssetCheckinTest extends TestCase $this->assertEquals($asset->location_id, $asset->rtd_location_id); } - public function testPendingCheckoutAcceptancesAreClearedUponCheckin() + public function testPendingCheckoutAcceptancesAreClearedUponCheckin(): void { $asset = Asset::factory()->assignedToUser()->create(); @@ -152,7 +152,7 @@ class AssetCheckinTest extends TestCase $this->assertFalse($acceptance->exists(), 'Acceptance was not deleted'); } - public function testCheckinTimeAndActionLogNoteCanBeSet() + public function testCheckinTimeAndActionLogNoteCanBeSet(): void { Event::fake([CheckoutableCheckedIn::class]); @@ -170,7 +170,7 @@ class AssetCheckinTest extends TestCase }, 1); } - public function testAssetCheckinPageIsRedirectedIfModelIsInvalid() + public function testAssetCheckinPageIsRedirectedIfModelIsInvalid(): void { $asset = Asset::factory()->assignedToUser()->create(); @@ -184,7 +184,7 @@ class AssetCheckinTest extends TestCase ->assertRedirect(route('hardware.show',['hardware' => $asset->id])); } - public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid() + public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid(): void { $asset = Asset::factory()->assignedToUser()->create(); $asset->model_id = 0; @@ -197,7 +197,7 @@ class AssetCheckinTest extends TestCase ->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); } - public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex() + public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex(): void { $asset = Asset::factory()->assignedToUser()->create(); @@ -210,7 +210,7 @@ class AssetCheckinTest extends TestCase ->assertRedirect(route('hardware.index')); } - public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsItem() + public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsItem(): void { $asset = Asset::factory()->assignedToUser()->create(); diff --git a/tests/Feature/Checkins/Ui/ComponentCheckinTest.php b/tests/Feature/Checkins/Ui/ComponentCheckinTest.php index 1213d65252..0da1282a47 100644 --- a/tests/Feature/Checkins/Ui/ComponentCheckinTest.php +++ b/tests/Feature/Checkins/Ui/ComponentCheckinTest.php @@ -8,7 +8,7 @@ use Tests\TestCase; class ComponentCheckinTest extends TestCase { - public function testCheckingInComponentRequiresCorrectPermission() + public function testCheckingInComponentRequiresCorrectPermission(): void { $this->actingAs(User::factory()->create()) ->post(route('components.checkin.store', [ @@ -18,7 +18,7 @@ class ComponentCheckinTest extends TestCase } - public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex() + public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex(): void { $component = Component::factory()->checkedOutToAsset()->create(); @@ -32,7 +32,7 @@ class ComponentCheckinTest extends TestCase ->assertRedirect(route('components.index')); } - public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsItem() + public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsItem(): void { $component = Component::factory()->checkedOutToAsset()->create(); diff --git a/tests/Feature/Checkins/Ui/LicenseCheckinTest.php b/tests/Feature/Checkins/Ui/LicenseCheckinTest.php index e087cb442d..550f26ad44 100644 --- a/tests/Feature/Checkins/Ui/LicenseCheckinTest.php +++ b/tests/Feature/Checkins/Ui/LicenseCheckinTest.php @@ -8,7 +8,7 @@ use Tests\TestCase; class LicenseCheckinTest extends TestCase { - public function testCheckingInLicenseRequiresCorrectPermission() + public function testCheckingInLicenseRequiresCorrectPermission(): void { $this->actingAs(User::factory()->create()) ->post(route('licenses.checkin.save', [ diff --git a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php index fef38623f8..13e3664548 100644 --- a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php +++ b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php @@ -16,7 +16,7 @@ class AccessoryAcceptanceTest extends TestCase /** * This can be absorbed into a bigger test */ - public function testUsersNameIsIncludedInAccessoryAcceptedNotification() + public function testUsersNameIsIncludedInAccessoryAcceptedNotification(): void { Notification::fake(); @@ -49,7 +49,7 @@ class AccessoryAcceptanceTest extends TestCase /** * This can be absorbed into a bigger test */ - public function testUsersNameIsIncludedInAccessoryDeclinedNotification() + public function testUsersNameIsIncludedInAccessoryDeclinedNotification(): void { Notification::fake(); @@ -79,7 +79,7 @@ class AccessoryAcceptanceTest extends TestCase ); } - public function testUserIsNotAbleToAcceptAnAssetAssignedToADifferentUser() + public function testUserIsNotAbleToAcceptAnAssetAssignedToADifferentUser(): void { Notification::fake(); diff --git a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php index 2b37797fb6..1b1b1c16bb 100644 --- a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php +++ b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php @@ -11,14 +11,14 @@ use Tests\TestCase; class AccessoryCheckoutTest extends TestCase { - public function testCheckingOutAccessoryRequiresCorrectPermission() + public function testCheckingOutAccessoryRequiresCorrectPermission(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.accessories.checkout', Accessory::factory()->create())) ->assertForbidden(); } - public function testValidationWhenCheckingOutAccessory() + public function testValidationWhenCheckingOutAccessory(): void { $this->actingAsForApi(User::factory()->checkoutAccessories()->create()) ->postJson(route('api.accessories.checkout', Accessory::factory()->create()), [ @@ -27,7 +27,7 @@ class AccessoryCheckoutTest extends TestCase ->assertStatusMessageIs('error'); } - public function testAccessoryMustBeAvailableWhenCheckingOut() + public function testAccessoryMustBeAvailableWhenCheckingOut(): void { $this->actingAsForApi(User::factory()->checkoutAccessories()->create()) ->postJson(route('api.accessories.checkout', Accessory::factory()->withoutItemsRemaining()->create()), [ @@ -58,7 +58,7 @@ class AccessoryCheckoutTest extends TestCase ->json(); } - public function testAccessoryCanBeCheckedOutWithoutQty() + public function testAccessoryCanBeCheckedOutWithoutQty(): void { $accessory = Accessory::factory()->create(); $user = User::factory()->create(); @@ -90,7 +90,7 @@ class AccessoryCheckoutTest extends TestCase ); } - public function testAccessoryCanBeCheckedOutWithQty() + public function testAccessoryCanBeCheckedOutWithQty(): void { $accessory = Accessory::factory()->create(['qty' => 20]); $user = User::factory()->create(); @@ -124,7 +124,7 @@ class AccessoryCheckoutTest extends TestCase ); } - public function testAccessoryCannotBeCheckedOutToInvalidUser() + public function testAccessoryCannotBeCheckedOutToInvalidUser(): void { $accessory = Accessory::factory()->create(); $user = User::factory()->create(); @@ -143,7 +143,7 @@ class AccessoryCheckoutTest extends TestCase $this->assertFalse($accessory->checkouts()->where('assigned_type', User::class)->where('assigned_to', $user->id)->count() > 0); } - public function testUserSentNotificationUponCheckout() + public function testUserSentNotificationUponCheckout(): void { Notification::fake(); @@ -159,7 +159,7 @@ class AccessoryCheckoutTest extends TestCase Notification::assertSentTo($user, CheckoutAccessoryNotification::class); } - public function testActionLogCreatedUponCheckout() + public function testActionLogCreatedUponCheckout(): void { $accessory = Accessory::factory()->create(); $actor = User::factory()->checkoutAccessories()->create(); diff --git a/tests/Feature/Checkouts/Api/AssetCheckoutTest.php b/tests/Feature/Checkouts/Api/AssetCheckoutTest.php index ded3889642..b66ee2d02b 100644 --- a/tests/Feature/Checkouts/Api/AssetCheckoutTest.php +++ b/tests/Feature/Checkouts/Api/AssetCheckoutTest.php @@ -21,7 +21,7 @@ class AssetCheckoutTest extends TestCase Event::fake([CheckoutableCheckedOut::class]); } - public function testCheckingOutAssetRequiresCorrectPermission() + public function testCheckingOutAssetRequiresCorrectPermission(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.asset.checkout', Asset::factory()->create()), [ @@ -31,7 +31,7 @@ class AssetCheckoutTest extends TestCase ->assertForbidden(); } - public function testNonExistentAssetCannotBeCheckedOut() + public function testNonExistentAssetCannotBeCheckedOut(): void { $this->actingAsForApi(User::factory()->checkoutAssets()->create()) ->postJson(route('api.asset.checkout', 1000), [ @@ -41,7 +41,7 @@ class AssetCheckoutTest extends TestCase ->assertStatusMessageIs('error'); } - public function testAssetNotAvailableForCheckoutCannotBeCheckedOut() + public function testAssetNotAvailableForCheckoutCannotBeCheckedOut(): void { $assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create(); @@ -53,7 +53,7 @@ class AssetCheckoutTest extends TestCase ->assertStatusMessageIs('error'); } - public function testAssetCannotBeCheckedOutToItself() + public function testAssetCannotBeCheckedOutToItself(): void { $asset = Asset::factory()->create(); @@ -65,7 +65,7 @@ class AssetCheckoutTest extends TestCase ->assertStatusMessageIs('error'); } - public function testValidationWhenCheckingOutAsset() + public function testValidationWhenCheckingOutAsset(): void { $this->actingAsForApi(User::factory()->checkoutAssets()->create()) ->postJson(route('api.asset.checkout', Asset::factory()->create()), []) @@ -74,7 +74,7 @@ class AssetCheckoutTest extends TestCase Event::assertNotDispatched(CheckoutableCheckedOut::class); } - public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled() + public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled(): void { $this->markTestIncomplete('This is not implemented'); } @@ -150,7 +150,7 @@ class AssetCheckoutTest extends TestCase } #[DataProvider('checkoutTargets')] - public function testAssetCanBeCheckedOut($data) + public function testAssetCanBeCheckedOut($data): void { ['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data(); @@ -192,12 +192,12 @@ class AssetCheckoutTest extends TestCase }); } - public function testLicenseSeatsAreAssignedToUserUponCheckout() + public function testLicenseSeatsAreAssignedToUserUponCheckout(): void { $this->markTestIncomplete('This is not implemented'); } - public function testLastCheckoutUsesCurrentDateIfNotProvided() + public function testLastCheckoutUsesCurrentDateIfNotProvided(): void { $asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]); diff --git a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php index 3bd0212fda..8a060572ec 100644 --- a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php +++ b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php @@ -11,14 +11,14 @@ use Tests\TestCase; class ConsumableCheckoutTest extends TestCase { - public function testCheckingOutConsumableRequiresCorrectPermission() + public function testCheckingOutConsumableRequiresCorrectPermission(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.consumables.checkout', Consumable::factory()->create())) ->assertForbidden(); } - public function testValidationWhenCheckingOutConsumable() + public function testValidationWhenCheckingOutConsumable(): void { $this->actingAsForApi(User::factory()->checkoutConsumables()->create()) ->postJson(route('api.consumables.checkout', Consumable::factory()->create()), [ @@ -27,7 +27,7 @@ class ConsumableCheckoutTest extends TestCase ->assertStatusMessageIs('error'); } - public function testConsumableMustBeAvailableWhenCheckingOut() + public function testConsumableMustBeAvailableWhenCheckingOut(): void { $this->actingAsForApi(User::factory()->checkoutConsumables()->create()) ->postJson(route('api.consumables.checkout', Consumable::factory()->withoutItemsRemaining()->create()), [ @@ -36,7 +36,7 @@ class ConsumableCheckoutTest extends TestCase ->assertStatusMessageIs('error'); } - public function testConsumableCanBeCheckedOut() + public function testConsumableCanBeCheckedOut(): void { $consumable = Consumable::factory()->create(); $user = User::factory()->create(); @@ -49,7 +49,7 @@ class ConsumableCheckoutTest extends TestCase $this->assertTrue($user->consumables->contains($consumable)); } - public function testUserSentNotificationUponCheckout() + public function testUserSentNotificationUponCheckout(): void { Notification::fake(); @@ -65,7 +65,7 @@ class ConsumableCheckoutTest extends TestCase Notification::assertSentTo($user, CheckoutConsumableNotification::class); } - public function testActionLogCreatedUponCheckout() + public function testActionLogCreatedUponCheckout(): void {$consumable = Consumable::factory()->create(); $actor = User::factory()->checkoutConsumables()->create(); $user = User::factory()->create(); diff --git a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php index d4818ffc4b..cefd843880 100644 --- a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php @@ -13,14 +13,14 @@ use Tests\TestCase; class AccessoryCheckoutTest extends TestCase { - public function testCheckingOutAccessoryRequiresCorrectPermission() + public function testCheckingOutAccessoryRequiresCorrectPermission(): void { $this->actingAs(User::factory()->create()) ->post(route('accessories.checkout.store', Accessory::factory()->create())) ->assertForbidden(); } - public function testValidationWhenCheckingOutAccessory() + public function testValidationWhenCheckingOutAccessory(): void { $accessory = Accessory::factory()->create(); $response = $this->actingAs(User::factory()->superuser()->create()) @@ -35,7 +35,7 @@ class AccessoryCheckoutTest extends TestCase $this->followRedirects($response)->assertSee(trans('general.error')); } - public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut() + public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut(): void { $accessory = Accessory::factory()->withoutItemsRemaining()->create(); @@ -52,7 +52,7 @@ class AccessoryCheckoutTest extends TestCase $this->followRedirects($response)->assertSee(trans('general.error')); } - public function testAccessoryCanBeCheckedOutWithoutQuantity() + public function testAccessoryCanBeCheckedOutWithoutQuantity(): void { $accessory = Accessory::factory()->create(); $user = User::factory()->create(); @@ -76,7 +76,7 @@ class AccessoryCheckoutTest extends TestCase ]); } - public function testAccessoryCanBeCheckedOutWithQuantity() + public function testAccessoryCanBeCheckedOutWithQuantity(): void { $accessory = Accessory::factory()->create(['qty'=>5]); $user = User::factory()->create(); @@ -102,7 +102,7 @@ class AccessoryCheckoutTest extends TestCase ]); } - public function testAccessoryCanBeCheckedOutToLocationWithQuantity() + public function testAccessoryCanBeCheckedOutToLocationWithQuantity(): void { $accessory = Accessory::factory()->create(['qty'=>5]); $location = Location::factory()->create(); @@ -128,7 +128,7 @@ class AccessoryCheckoutTest extends TestCase ]); } - public function testAccessoryCanBeCheckedOutToAssetWithQuantity() + public function testAccessoryCanBeCheckedOutToAssetWithQuantity(): void { $accessory = Accessory::factory()->create(['qty'=>5]); $asset = Asset::factory()->create(); @@ -154,7 +154,7 @@ class AccessoryCheckoutTest extends TestCase ]); } - public function testUserSentNotificationUponCheckout() + public function testUserSentNotificationUponCheckout(): void { Notification::fake(); @@ -171,7 +171,7 @@ class AccessoryCheckoutTest extends TestCase Notification::assertSentTo($user, CheckoutAccessoryNotification::class); } - public function testActionLogCreatedUponCheckout() + public function testActionLogCreatedUponCheckout(): void { $accessory = Accessory::factory()->create(); $actor = User::factory()->checkoutAccessories()->create(); @@ -200,7 +200,7 @@ class AccessoryCheckoutTest extends TestCase ); } - public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex() + public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void { $accessory = Accessory::factory()->create(); @@ -216,7 +216,7 @@ class AccessoryCheckoutTest extends TestCase ->assertRedirect(route('accessories.index')); } - public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem() + public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void { $accessory = Accessory::factory()->create(); @@ -233,7 +233,7 @@ class AccessoryCheckoutTest extends TestCase ->assertRedirect(route('accessories.show', ['accessory' => $accessory->id])); } - public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget() + public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void { $user = User::factory()->create(); $accessory = Accessory::factory()->create(); diff --git a/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php b/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php index f268a9385e..bb191d1ac7 100644 --- a/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php @@ -24,7 +24,7 @@ class AssetCheckoutTest extends TestCase Event::fake([CheckoutableCheckedOut::class]); } - public function testCheckingOutAssetRequiresCorrectPermission() + public function testCheckingOutAssetRequiresCorrectPermission(): void { $this->actingAs(User::factory()->create()) ->post(route('hardware.checkout.store', Asset::factory()->create()), [ @@ -34,7 +34,7 @@ class AssetCheckoutTest extends TestCase ->assertForbidden(); } - public function testNonExistentAssetCannotBeCheckedOut() + public function testNonExistentAssetCannotBeCheckedOut(): void { $this->actingAs(User::factory()->checkoutAssets()->create()) ->post(route('hardware.checkout.store', 1000), [ @@ -48,7 +48,7 @@ class AssetCheckoutTest extends TestCase Event::assertNotDispatched(CheckoutableCheckedOut::class); } - public function testAssetNotAvailableForCheckoutCannotBeCheckedOut() + public function testAssetNotAvailableForCheckoutCannotBeCheckedOut(): void { $assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create(); @@ -63,7 +63,7 @@ class AssetCheckoutTest extends TestCase Event::assertNotDispatched(CheckoutableCheckedOut::class); } - public function testAssetCannotBeCheckedOutToItself() + public function testAssetCannotBeCheckedOutToItself(): void { $asset = Asset::factory()->create(); @@ -77,7 +77,7 @@ class AssetCheckoutTest extends TestCase Event::assertNotDispatched(CheckoutableCheckedOut::class); } - public function testValidationWhenCheckingOutAsset() + public function testValidationWhenCheckingOutAsset(): void { $this->actingAs(User::factory()->create()) ->post(route('hardware.checkout.store', Asset::factory()->create()), [ @@ -98,7 +98,7 @@ class AssetCheckoutTest extends TestCase Event::assertNotDispatched(CheckoutableCheckedOut::class); } - public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled() + public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -169,7 +169,7 @@ class AssetCheckoutTest extends TestCase } #[DataProvider('checkoutTargets')] - public function testAssetCanBeCheckedOut($data) + public function testAssetCanBeCheckedOut($data): void { ['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data(); @@ -207,7 +207,7 @@ class AssetCheckoutTest extends TestCase }); } - public function testLicenseSeatsAreAssignedToUserUponCheckout() + public function testLicenseSeatsAreAssignedToUserUponCheckout(): void { $asset = Asset::factory()->create(); $seat = LicenseSeat::factory()->assignedToAsset($asset)->create(); @@ -224,7 +224,7 @@ class AssetCheckoutTest extends TestCase $this->assertTrue($user->fresh()->licenses->contains($seat->license)); } - public function testLastCheckoutUsesCurrentDateIfNotProvided() + public function testLastCheckoutUsesCurrentDateIfNotProvided(): void { $asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]); @@ -239,7 +239,7 @@ class AssetCheckoutTest extends TestCase $this->assertTrue(Carbon::parse($asset->last_checkout)->diffInSeconds(now()) < 2); } - public function testAssetCheckoutPageIsRedirectedIfModelIsInvalid() + public function testAssetCheckoutPageIsRedirectedIfModelIsInvalid(): void { $asset = Asset::factory()->create(); @@ -253,7 +253,7 @@ class AssetCheckoutTest extends TestCase ->assertRedirect(route('hardware.show',['hardware' => $asset->id])); } - public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex() + public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void { $asset = Asset::factory()->create(); @@ -268,7 +268,7 @@ class AssetCheckoutTest extends TestCase ->assertRedirect(route('hardware.index')); } - public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem() + public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void { $asset = Asset::factory()->create(); @@ -284,7 +284,7 @@ class AssetCheckoutTest extends TestCase ->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); } - public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget() + public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget(): void { $user = User::factory()->create(); $asset = Asset::factory()->create(); @@ -301,7 +301,7 @@ class AssetCheckoutTest extends TestCase ->assertRedirect(route('users.show', ['user' => $user])); } - public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget() + public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget(): void { $target = Asset::factory()->create(); $asset = Asset::factory()->create(); @@ -318,7 +318,7 @@ class AssetCheckoutTest extends TestCase ->assertRedirect(route('hardware.show', ['hardware' => $target])); } - public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget() + public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget(): void { $target = Location::factory()->create(); $asset = Asset::factory()->create(); diff --git a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php index da285bebbb..f0d82dbf01 100644 --- a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class ComponentsCheckoutTest extends TestCase { - public function testCheckingOutComponentRequiresCorrectPermission() + public function testCheckingOutComponentRequiresCorrectPermission(): void { $this->actingAs(User::factory()->create()) ->post(route('components.checkout.store', [ @@ -18,7 +18,7 @@ class ComponentsCheckoutTest extends TestCase ->assertForbidden(); } - public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex() + public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void { $component = Component::factory()->create(); @@ -33,7 +33,7 @@ class ComponentsCheckoutTest extends TestCase ->assertRedirect(route('components.index')); } - public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem() + public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void { $component = Component::factory()->create(); @@ -48,7 +48,7 @@ class ComponentsCheckoutTest extends TestCase ->assertRedirect(route('components.show', ['component' => $component->id])); } - public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget() + public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void { $asset = Asset::factory()->create(); $component = Component::factory()->create(); diff --git a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php index 90132fcedf..b27be6d482 100644 --- a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php @@ -13,14 +13,14 @@ use Tests\TestCase; class ConsumableCheckoutTest extends TestCase { - public function testCheckingOutConsumableRequiresCorrectPermission() + public function testCheckingOutConsumableRequiresCorrectPermission(): void { $this->actingAs(User::factory()->create()) ->post(route('consumables.checkout.store', Consumable::factory()->create())) ->assertForbidden(); } - public function testValidationWhenCheckingOutConsumable() + public function testValidationWhenCheckingOutConsumable(): void { $this->actingAs(User::factory()->checkoutConsumables()->create()) ->post(route('consumables.checkout.store', Consumable::factory()->create()), [ @@ -29,7 +29,7 @@ class ConsumableCheckoutTest extends TestCase ->assertSessionHas('error'); } - public function testConsumableMustBeAvailableWhenCheckingOut() + public function testConsumableMustBeAvailableWhenCheckingOut(): void { $this->actingAs(User::factory()->checkoutConsumables()->create()) ->post(route('consumables.checkout.store', Consumable::factory()->withoutItemsRemaining()->create()), [ @@ -38,7 +38,7 @@ class ConsumableCheckoutTest extends TestCase ->assertSessionHas('error'); } - public function testConsumableCanBeCheckedOut() + public function testConsumableCanBeCheckedOut(): void { $consumable = Consumable::factory()->create(); $user = User::factory()->create(); @@ -51,7 +51,7 @@ class ConsumableCheckoutTest extends TestCase $this->assertTrue($user->consumables->contains($consumable)); } - public function testUserSentNotificationUponCheckout() + public function testUserSentNotificationUponCheckout(): void { Notification::fake(); @@ -66,7 +66,7 @@ class ConsumableCheckoutTest extends TestCase Notification::assertSentTo($user, CheckoutConsumableNotification::class); } - public function testActionLogCreatedUponCheckout() + public function testActionLogCreatedUponCheckout(): void { $consumable = Consumable::factory()->create(); $actor = User::factory()->checkoutConsumables()->create(); @@ -93,7 +93,7 @@ class ConsumableCheckoutTest extends TestCase ); } - public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex() + public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void { $consumable = Consumable::factory()->create(); @@ -108,7 +108,7 @@ class ConsumableCheckoutTest extends TestCase ->assertRedirect(route('consumables.index')); } - public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem() + public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void { $consumable = Consumable::factory()->create(); @@ -123,7 +123,7 @@ class ConsumableCheckoutTest extends TestCase ->assertRedirect(route('consumables.show', ['consumable' => $consumable->id])); } - public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget() + public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void { $user = User::factory()->create(); $consumable = Consumable::factory()->create(); diff --git a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php index 9511c3ae33..49f0ddae89 100644 --- a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class LicenseCheckoutTest extends TestCase { - public function testNotesAreStoredInActionLogOnCheckoutToAsset() + public function testNotesAreStoredInActionLogOnCheckoutToAsset(): void { $admin = User::factory()->superuser()->create(); $asset = Asset::factory()->create(); @@ -34,7 +34,7 @@ class LicenseCheckoutTest extends TestCase ]); } - public function testNotesAreStoredInActionLogOnCheckoutToUser() + public function testNotesAreStoredInActionLogOnCheckoutToUser(): void { $admin = User::factory()->superuser()->create(); $licenseSeat = LicenseSeat::factory()->create(); @@ -57,7 +57,7 @@ class LicenseCheckoutTest extends TestCase ]); } - public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex() + public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void { $license = License::factory()->create(); @@ -72,7 +72,7 @@ class LicenseCheckoutTest extends TestCase ->assertRedirect(route('licenses.index')); } - public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem() + public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void { $license = License::factory()->create(); @@ -86,7 +86,7 @@ class LicenseCheckoutTest extends TestCase ->assertRedirect(route('licenses.show', ['license' => $license->id])); } - public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget() + public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget(): void { $user = User::factory()->create(); $license = License::factory()->create(); @@ -100,7 +100,7 @@ class LicenseCheckoutTest extends TestCase ->assertStatus(302) ->assertRedirect(route('users.show', ['user' => $user->id])); } - public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget() + public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget(): void { $asset = Asset::factory()->create(); $license = License::factory()->create(); diff --git a/tests/Feature/Components/Api/ComponentIndexTest.php b/tests/Feature/Components/Api/ComponentIndexTest.php index 4260372c0b..300f0ec8f7 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 testComponentIndexAdheresToCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Feature/Components/Ui/ComponentIndexTest.php b/tests/Feature/Components/Ui/ComponentIndexTest.php index 41b733e046..1d8e2416ce 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 testPermissionRequiredToViewComponentsList(): void { $this->actingAs(User::factory()->create()) ->get(route('components.index')) ->assertForbidden(); } - public function testUserCanListComponents() + public function testUserCanListComponents(): void { $this->actingAs(User::factory()->superuser()->create()) ->get(route('components.index')) diff --git a/tests/Feature/Console/MergeUsersTest.php b/tests/Feature/Console/MergeUsersTest.php index 4c43e6293d..cbcc7007cb 100644 --- a/tests/Feature/Console/MergeUsersTest.php +++ b/tests/Feature/Console/MergeUsersTest.php @@ -13,7 +13,7 @@ use Tests\TestCase; class MergeUsersTest extends TestCase { - public function testAssetsAreTransferredOnUserMerge() + public function testAssetsAreTransferredOnUserMerge(): void { $user1 = User::factory()->create(['username' => 'user1']); $user_to_merge_into = User::factory()->create(['username' => 'user1@example.com']); diff --git a/tests/Feature/Console/OptimizeTest.php b/tests/Feature/Console/OptimizeTest.php index 8dd6f270f9..6a3926e308 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 testOptimizeSucceeds(): void { $this->beforeApplicationDestroyed(function () { $this->artisan('config:clear'); diff --git a/tests/Feature/Consumables/Api/ConsumableIndexTest.php b/tests/Feature/Consumables/Api/ConsumableIndexTest.php index f1d3ad7f0b..93ea6f54b1 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 testConsumableIndexAdheresToCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); @@ -55,7 +55,7 @@ class ConsumableIndexTest extends TestCase ->assertResponseContainsInRows($consumableB); } - public function testConsumableIndexReturnsExpectedSearchResults() + public function testConsumableIndexReturnsExpectedSearchResults(): void { 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.php index 1c1e05d4d4..844c11d2c4 100644 --- a/tests/Feature/Consumables/Api/ConsumableUpdateTest.php +++ b/tests/Feature/Consumables/Api/ConsumableUpdateTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class ConsumableUpdateTest extends TestCase { - public function testCanUpdateConsumableViaPatchWithoutCategoryType() + public function testCanUpdateConsumableViaPatchWithoutCategoryType(): void { $consumable = Consumable::factory()->create(); @@ -28,7 +28,7 @@ class ConsumableUpdateTest extends TestCase } - public function testCannotUpdateConsumableViaPatchWithInvalidCategoryType() + public function testCannotUpdateConsumableViaPatchWithInvalidCategoryType(): void { $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.php index c6410216e1..d9218222a9 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 testConsumableViewAdheresToCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Feature/Consumables/Ui/ConsumableIndexTest.php b/tests/Feature/Consumables/Ui/ConsumableIndexTest.php index 3c438187ca..16797c4ec0 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 testPermissionRequiredToViewConsumablesList(): void { $this->actingAs(User::factory()->create()) ->get(route('consumables.index')) ->assertForbidden(); } - public function testUserCanListConsumables() + public function testUserCanListConsumables(): void { $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.php index 9633896c2d..394be170db 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 testPermissionRequiredToViewConsumable(): void { $consumable = Consumable::factory()->create(); $this->actingAs(User::factory()->create()) @@ -16,7 +16,7 @@ class ConsumableViewTest extends TestCase ->assertForbidden(); } - public function testUserCanListConsumables() + public function testUserCanListConsumables(): void { $consumable = Consumable::factory()->create(); $this->actingAs(User::factory()->superuser()->create()) diff --git a/tests/Feature/DashboardTest.php b/tests/Feature/DashboardTest.php index 4690a13901..6857ace7dd 100644 --- a/tests/Feature/DashboardTest.php +++ b/tests/Feature/DashboardTest.php @@ -7,7 +7,7 @@ use Tests\TestCase; class DashboardTest extends TestCase { - public function testUsersWithoutAdminAccessAreRedirected() + public function testUsersWithoutAdminAccessAreRedirected(): void { $this->actingAs(User::factory()->create()) ->get(route('home')) diff --git a/tests/Feature/Departments/Api/CreateDepartmentsTest.php b/tests/Feature/Departments/Api/CreateDepartmentsTest.php index a8725c5ff2..bda4711963 100644 --- a/tests/Feature/Departments/Api/CreateDepartmentsTest.php +++ b/tests/Feature/Departments/Api/CreateDepartmentsTest.php @@ -13,7 +13,7 @@ class CreateDepartmentsTest extends TestCase { - public function testRequiresPermissionToCreateDepartment() + public function testRequiresPermissionToCreateDepartment(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.departments.store')) diff --git a/tests/Feature/Departments/Api/DepartmentsIndexTest.php b/tests/Feature/Departments/Api/DepartmentsIndexTest.php index e3616e2491..7837199025 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 testViewingDepartmentIndexRequiresAuthentication(): void { $this->getJson(route('api.departments.index'))->assertRedirect(); } - public function testViewingDepartmentIndexRequiresPermission() + public function testViewingDepartmentIndexRequiresPermission(): void { $this->actingAsForApi(User::factory()->create()) ->getJson(route('api.departments.index')) ->assertForbidden(); } - public function testDepartmentIndexReturnsExpectedDepartments() + public function testDepartmentIndexReturnsExpectedDepartments(): void { Department::factory()->count(3)->create(); @@ -42,7 +42,7 @@ class DepartmentsIndexTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); } - public function testDepartmentIndexAdheresToCompanyScoping() + public function testDepartmentIndexAdheresToCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Feature/Departments/Api/UpdateDepartmentsTest.php b/tests/Feature/Departments/Api/UpdateDepartmentsTest.php index 2a6401e7f1..654408755c 100644 --- a/tests/Feature/Departments/Api/UpdateDepartmentsTest.php +++ b/tests/Feature/Departments/Api/UpdateDepartmentsTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class UpdateDepartmentsTest extends TestCase { - public function testRequiresPermissionToEditDepartment() + public function testRequiresPermissionToEditDepartment(): void { $department = Department::factory()->create(); $this->actingAsForApi(User::factory()->create()) @@ -18,7 +18,7 @@ class UpdateDepartmentsTest extends TestCase ->assertForbidden(); } - public function testCanUpdateDepartmentViaPatch() + public function testCanUpdateDepartmentViaPatch(): void { $department = Department::factory()->create(); diff --git a/tests/Feature/Departments/Ui/CreateDepartmentsTest.php b/tests/Feature/Departments/Ui/CreateDepartmentsTest.php index 17045cbc0b..ea4fdb674e 100644 --- a/tests/Feature/Departments/Ui/CreateDepartmentsTest.php +++ b/tests/Feature/Departments/Ui/CreateDepartmentsTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class CreateDepartmentsTest extends TestCase { - public function testPermissionRequiredToCreateDepartment() + public function testPermissionRequiredToCreateDepartment(): void { $this->actingAs(User::factory()->create()) ->post(route('departments.store'), [ @@ -19,7 +19,7 @@ class CreateDepartmentsTest extends TestCase ->assertForbidden(); } - public function testUserCanCreateDepartments() + public function testUserCanCreateDepartments(): void { $this->assertFalse(Department::where('name', 'Test Department')->exists()); diff --git a/tests/Feature/Departments/Ui/IndexDepartmentsTest.php b/tests/Feature/Departments/Ui/IndexDepartmentsTest.php index 461ec8fffb..e35511b1ff 100644 --- a/tests/Feature/Departments/Ui/IndexDepartmentsTest.php +++ b/tests/Feature/Departments/Ui/IndexDepartmentsTest.php @@ -7,14 +7,14 @@ use Tests\TestCase; class IndexDepartmentsTest extends TestCase { - public function testPermissionRequiredToViewDepartmentsList() + public function testPermissionRequiredToViewDepartmentsList(): void { $this->actingAs(User::factory()->create()) ->get(route('departments.index')) ->assertForbidden(); } - public function testUserCanListDepartments() + public function testUserCanListDepartments(): void { $this->actingAs(User::factory()->superuser()->create()) ->get(route('departments.index')) diff --git a/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php b/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php index e6e614d32c..919835e0a7 100644 --- a/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php +++ b/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class UpdateDepartmentsTest extends TestCase { - public function testPermissionRequiredToStoreDepartment() + public function testPermissionRequiredToStoreDepartment(): void { $this->actingAs(User::factory()->create()) ->post(route('departments.store'), [ @@ -20,7 +20,7 @@ class UpdateDepartmentsTest extends TestCase } - public function testUserCanEditDepartments() + public function testUserCanEditDepartments(): void { $department = Department::factory()->create(['name' => 'Test Department']); $this->assertTrue(Department::where('name', 'Test Department')->exists()); diff --git a/tests/Feature/Groups/Api/StoreGroupTest.php b/tests/Feature/Groups/Api/StoreGroupTest.php index ebcbff71c5..7619c5df69 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 testStoringGroupRequiresSuperAdminPermission(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.groups.store')) ->assertForbidden(); } - public function testCanStoreGroupWithPermissionsPassed() + public function testCanStoreGroupWithPermissionsPassed(): void { $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.groups.store'), [ @@ -37,7 +37,7 @@ class StoreGroupTest extends TestCase $this->assertEquals('0', $group->decodePermissions()['reports.view']); } - public function testStoringGroupWithoutPermissionPassed() + public function testStoringGroupWithoutPermissionPassed(): void { $superuser = User::factory()->superuser()->create(); $this->actingAsForApi($superuser) @@ -61,7 +61,7 @@ class StoreGroupTest extends TestCase ->assertOk(); } - public function testStoringGroupWithInvalidPermissionDropsBadPermission() + public function testStoringGroupWithInvalidPermissionDropsBadPermission(): void { $this->actingAsForApi(User::factory()->superuser()->create()) ->postJson(route('api.groups.store'), [ diff --git a/tests/Feature/Groups/Ui/IndexGroupTest.php b/tests/Feature/Groups/Ui/IndexGroupTest.php index a2d67f903c..29ba058d14 100644 --- a/tests/Feature/Groups/Ui/IndexGroupTest.php +++ b/tests/Feature/Groups/Ui/IndexGroupTest.php @@ -7,7 +7,7 @@ use Tests\TestCase; class IndexGroupTest extends TestCase { - public function testPermissionRequiredToViewGroupList() + public function testPermissionRequiredToViewGroupList(): void { $this->actingAs(User::factory()->create()) ->get(route('groups.index')) @@ -16,7 +16,7 @@ class IndexGroupTest extends TestCase //$this->followRedirects($response)->assertSee('sad-panda.png'); } - public function testUserCanListGroups() + public function testUserCanListGroups(): void { $this->actingAs(User::factory()->superuser()->create()) ->get(route('groups.index')) diff --git a/tests/Feature/Licenses/Api/LicenseIndexTest.php b/tests/Feature/Licenses/Api/LicenseIndexTest.php index 1df7864278..621489f8e7 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 testLicensesIndexAdheresToCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Feature/Licenses/Ui/CreateLicenseTest.php b/tests/Feature/Licenses/Ui/CreateLicenseTest.php index f24c3bd2ce..c07818f01b 100644 --- a/tests/Feature/Licenses/Ui/CreateLicenseTest.php +++ b/tests/Feature/Licenses/Ui/CreateLicenseTest.php @@ -11,7 +11,7 @@ use Tests\TestCase; class CreateLicenseTest extends TestCase { - public function testPermissionRequiredToViewLicense() + public function testPermissionRequiredToViewLicense(): void { $license = License::factory()->create(); $this->actingAs(User::factory()->create()) @@ -21,7 +21,7 @@ class CreateLicenseTest extends TestCase - public function testLicenseWithoutPurchaseDateFailsValidation() + public function testLicenseWithoutPurchaseDateFailsValidation(): void { $response = $this->actingAs(User::factory()->superuser()->create()) ->from(route('licenses.create')) diff --git a/tests/Feature/Licenses/Ui/LicenseIndexTest.php b/tests/Feature/Licenses/Ui/LicenseIndexTest.php index 3eb33e5ee4..a370b8e864 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 testPermissionRequiredToViewLicenseList(): void { $this->actingAs(User::factory()->create()) ->get(route('licenses.index')) ->assertForbidden(); } - public function testUserCanListLicenses() + public function testUserCanListLicenses(): void { $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.php index 3b1f7830d4..d0dd215ee4 100644 --- a/tests/Feature/Licenses/Ui/LicenseViewTest.php +++ b/tests/Feature/Licenses/Ui/LicenseViewTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class LicenseViewTest extends TestCase { - public function testPermissionRequiredToViewLicense() + public function testPermissionRequiredToViewLicense(): void { $license = License::factory()->create(); $this->actingAs(User::factory()->create()) @@ -17,7 +17,7 @@ class LicenseViewTest extends TestCase ->assertForbidden(); } - public function testLicenseWithPurchaseDateDepreciatesCorrectly() + public function testLicenseWithPurchaseDateDepreciatesCorrectly(): void { $depreciation = Depreciation::factory()->create(['months' => 12]); $license = License::factory()->create(['depreciation_id' => $depreciation->id, 'purchase_date' => '2020-01-01']); diff --git a/tests/Feature/Livewire/CategoryEditFormTest.php b/tests/Feature/Livewire/CategoryEditFormTest.php index a439f544ac..8f0948051c 100644 --- a/tests/Feature/Livewire/CategoryEditFormTest.php +++ b/tests/Feature/Livewire/CategoryEditFormTest.php @@ -8,12 +8,12 @@ use Tests\TestCase; class CategoryEditFormTest extends TestCase { - public function testTheComponentCanRender() + public function testTheComponentCanRender(): void { Livewire::test(CategoryEditForm::class)->assertStatus(200); } - public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting() + public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting(): void { Livewire::test(CategoryEditForm::class, [ 'sendCheckInEmail' => true, @@ -22,7 +22,7 @@ class CategoryEditFormTest extends TestCase ])->assertSet('sendCheckInEmail', true); } - public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet() + public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet(): void { Livewire::test(CategoryEditForm::class, [ 'sendCheckInEmail' => false, @@ -31,7 +31,7 @@ class CategoryEditFormTest extends TestCase ])->assertSet('sendCheckInEmail', true); } - public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula() + public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula(): void { Livewire::test(CategoryEditForm::class, [ 'sendCheckInEmail' => false, @@ -40,7 +40,7 @@ class CategoryEditFormTest extends TestCase ])->assertSet('sendCheckInEmail', true); } - public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula() + public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula(): void { Livewire::test(CategoryEditForm::class, [ 'sendCheckInEmail' => false, @@ -49,7 +49,7 @@ class CategoryEditFormTest extends TestCase ])->assertSet('sendCheckInEmail', false); } - public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered() + public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered(): void { Livewire::test(CategoryEditForm::class, [ 'sendCheckInEmail' => false, @@ -59,7 +59,7 @@ class CategoryEditFormTest extends TestCase ->assertSet('sendCheckInEmail', true); } - public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected() + public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected(): void { Livewire::test(CategoryEditForm::class, [ 'sendCheckInEmail' => false, @@ -71,7 +71,7 @@ class CategoryEditFormTest extends TestCase ->assertSet('sendCheckInEmailDisabled', true); } - public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula() + public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula(): void { Livewire::test(CategoryEditForm::class, [ 'eulaText' => 'Some Content', @@ -94,7 +94,7 @@ class CategoryEditFormTest extends TestCase ->assertSet('sendCheckInEmailDisabled', false); } - public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula() + public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula(): void { Livewire::test(CategoryEditForm::class, [ 'sendCheckInEmail' => false, diff --git a/tests/Feature/Locations/Api/CreateLocationsTest.php b/tests/Feature/Locations/Api/CreateLocationsTest.php index 171508b725..6903c8dada 100644 --- a/tests/Feature/Locations/Api/CreateLocationsTest.php +++ b/tests/Feature/Locations/Api/CreateLocationsTest.php @@ -9,14 +9,14 @@ use Tests\TestCase; class CreateLocationsTest extends TestCase { - public function testRequiresPermissionToCreateLocation() + public function testRequiresPermissionToCreateLocation(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.departments.store')) ->assertForbidden(); } - public function testCannotCreateNewLocationsWithTheSameName() + public function testCannotCreateNewLocationsWithTheSameName(): void { $location = Location::factory()->create(); $location2 = Location::factory()->create(); @@ -33,7 +33,7 @@ class CreateLocationsTest extends TestCase } - public function testUserCannotCreateLocationsThatAreTheirOwnParent() + public function testUserCannotCreateLocationsThatAreTheirOwnParent(): void { $location = Location::factory()->create(); diff --git a/tests/Feature/Locations/Api/DeleteLocationsTest.php b/tests/Feature/Locations/Api/DeleteLocationsTest.php index 270582c901..4041aa1216 100644 --- a/tests/Feature/Locations/Api/DeleteLocationsTest.php +++ b/tests/Feature/Locations/Api/DeleteLocationsTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class DeleteLocationsTest extends TestCase { - public function testErrorReturnedViaApiIfLocationDoesNotExist() + public function testErrorReturnedViaApiIfLocationDoesNotExist(): void { $this->actingAsForApi(User::factory()->superuser()->create()) ->deleteJson(route('api.users.destroy', 'invalid-id')) @@ -20,7 +20,7 @@ class DeleteLocationsTest extends TestCase ->json(); } - public function testErrorReturnedViaApiIfLocationIsAlreadyDeleted() + public function testErrorReturnedViaApiIfLocationIsAlreadyDeleted(): void { $location = Location::factory()->deletedLocation()->create(); $this->actingAsForApi(User::factory()->superuser()->create()) @@ -31,7 +31,7 @@ class DeleteLocationsTest extends TestCase ->json(); } - public function testDisallowLocationDeletionViaApiIfStillHasPeople() + public function testDisallowLocationDeletionViaApiIfStillHasPeople(): void { $location = Location::factory()->create(); User::factory()->count(5)->create(['location_id' => $location->id]); @@ -46,7 +46,7 @@ class DeleteLocationsTest extends TestCase ->json(); } - public function testDisallowUserDeletionViaApiIfStillHasChildLocations() + public function testDisallowUserDeletionViaApiIfStillHasChildLocations(): void { $parent = Location::factory()->create(); Location::factory()->count(5)->create(['parent_id' => $parent->id]); @@ -60,7 +60,7 @@ class DeleteLocationsTest extends TestCase ->json(); } - public function testDisallowUserDeletionViaApiIfStillHasAssetsAssigned() + public function testDisallowUserDeletionViaApiIfStillHasAssetsAssigned(): void { $location = Location::factory()->create(); Asset::factory()->count(5)->assignedToLocation($location)->create(); @@ -75,7 +75,7 @@ class DeleteLocationsTest extends TestCase ->json(); } - public function testDisallowUserDeletionViaApiIfStillHasAssetsAsLocation() + public function testDisallowUserDeletionViaApiIfStillHasAssetsAsLocation(): void { $location = Location::factory()->create(); Asset::factory()->count(5)->create(['location_id' => $location->id]); diff --git a/tests/Feature/Locations/Api/IndexLocationsTest.php b/tests/Feature/Locations/Api/IndexLocationsTest.php index 7b3b104638..d9dec89c83 100644 --- a/tests/Feature/Locations/Api/IndexLocationsTest.php +++ b/tests/Feature/Locations/Api/IndexLocationsTest.php @@ -10,19 +10,19 @@ use Tests\TestCase; class IndexLocationsTest extends TestCase { - public function testViewingLocationIndexRequiresAuthentication() + public function testViewingLocationIndexRequiresAuthentication(): void { $this->getJson(route('api.locations.index'))->assertRedirect(); } - public function testViewingLocationIndexRequiresPermission() + public function testViewingLocationIndexRequiresPermission(): void { $this->actingAsForApi(User::factory()->create()) ->getJson(route('api.locations.index')) ->assertForbidden(); } - public function testLocationIndexReturnsExpectedLocations() + public function testLocationIndexReturnsExpectedLocations(): void { Location::factory()->count(3)->create(); diff --git a/tests/Feature/Locations/Api/LocationsForSelectListTest.php b/tests/Feature/Locations/Api/LocationsForSelectListTest.php index f34b97892f..d9e0c7a880 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 testGettingLocationListRequiresProperPermission(): void { $this->actingAsForApi(User::factory()->create()) ->getJson(route('api.locations.selectlist')) ->assertForbidden(); } - public function testLocationsReturned() + public function testLocationsReturned(): void { Location::factory()->create(); @@ -35,7 +35,7 @@ class LocationsForSelectListTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('results', 1)->etc()); } - public function testLocationsAreReturnedWhenUserIsUpdatingTheirProfileAndHasPermissionToUpdateLocation() + public function testLocationsAreReturnedWhenUserIsUpdatingTheirProfileAndHasPermissionToUpdateLocation(): void { $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.php index 1d57e58263..15a320ed8d 100644 --- a/tests/Feature/Locations/Api/LocationsViewTest.php +++ b/tests/Feature/Locations/Api/LocationsViewTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class LocationsViewTest extends TestCase { - public function testViewingLocationRequiresPermission() + public function testViewingLocationRequiresPermission(): void { $location = Location::factory()->create(); $this->actingAsForApi(User::factory()->create()) @@ -17,7 +17,7 @@ class LocationsViewTest extends TestCase ->assertForbidden(); } - public function testViewingLocationAssetIndexRequiresPermission() + public function testViewingLocationAssetIndexRequiresPermission(): void { $location = Location::factory()->create(); $this->actingAsForApi(User::factory()->create()) @@ -25,7 +25,7 @@ class LocationsViewTest extends TestCase ->assertForbidden(); } - public function testViewingLocationAssetIndex() + public function testViewingLocationAssetIndex(): void { $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.php index a3dd8c228c..ce9bd570c1 100644 --- a/tests/Feature/Locations/Api/UpdateLocationsTest.php +++ b/tests/Feature/Locations/Api/UpdateLocationsTest.php @@ -9,14 +9,14 @@ use Tests\TestCase; class UpdateLocationsTest extends TestCase { - public function testRequiresPermissionToEditLocation() + public function testRequiresPermissionToEditLocation(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.locations.store', Location::factory()->create())) ->assertForbidden(); } - public function testCanUpdateLocationViaPatch() + public function testCanUpdateLocationViaPatch(): void { $location = Location::factory()->create(); diff --git a/tests/Feature/Locations/Ui/CreateLocationsTest.php b/tests/Feature/Locations/Ui/CreateLocationsTest.php index 5e229f1043..4eb3a0d759 100644 --- a/tests/Feature/Locations/Ui/CreateLocationsTest.php +++ b/tests/Feature/Locations/Ui/CreateLocationsTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class CreateLocationsTest extends TestCase { - public function testPermissionRequiredToCreateLocation() + public function testPermissionRequiredToCreateLocation(): void { $this->actingAs(User::factory()->create()) ->post(route('locations.store'), [ @@ -19,7 +19,7 @@ class CreateLocationsTest extends TestCase ->assertForbidden(); } - public function testUserCanCreateLocations() + public function testUserCanCreateLocations(): void { $this->assertFalse(Location::where('name', 'Test Location')->exists()); diff --git a/tests/Feature/Locations/Ui/IndexLocationsTest.php b/tests/Feature/Locations/Ui/IndexLocationsTest.php index 43f117cb64..28aaeec6f7 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 testPermissionRequiredToViewLocationsList(): void { $this->actingAs(User::factory()->create()) ->get(route('locations.index')) ->assertForbidden(); } - public function testUserCanListLocations() + public function testUserCanListLocations(): void { $this->actingAs(User::factory()->superuser()->create()) ->get(route('locations.index')) diff --git a/tests/Feature/Locations/Ui/UpdateLocationsTest.php b/tests/Feature/Locations/Ui/UpdateLocationsTest.php index 5359cd1b71..02fbb4813a 100644 --- a/tests/Feature/Locations/Ui/UpdateLocationsTest.php +++ b/tests/Feature/Locations/Ui/UpdateLocationsTest.php @@ -8,7 +8,7 @@ use Tests\TestCase; class UpdateLocationsTest extends TestCase { - public function testPermissionRequiredToStoreLocation() + public function testPermissionRequiredToStoreLocation(): void { $this->actingAs(User::factory()->create()) ->post(route('locations.store'), [ @@ -19,7 +19,7 @@ class UpdateLocationsTest extends TestCase } - public function testUserCanEditLocations() + public function testUserCanEditLocations(): void { $location = Location::factory()->create(['name' => 'Test Location']); $this->assertTrue(Location::where('name', 'Test Location')->exists()); @@ -36,7 +36,7 @@ class UpdateLocationsTest extends TestCase $this->assertTrue(Location::where('name', 'Test Location Edited')->exists()); } - public function testUserCannotEditLocationsToMakeThemTheirOwnParent() + public function testUserCannotEditLocationsToMakeThemTheirOwnParent(): void { $location = Location::factory()->create(); diff --git a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php index 449f65c7ab..219cb528f8 100644 --- a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php +++ b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php @@ -20,7 +20,7 @@ class EmailNotificationsUponCheckinTest extends TestCase Notification::fake(); } - public function testCheckInEmailSentToUserIfSettingEnabled() + public function testCheckInEmailSentToUserIfSettingEnabled(): void { $user = User::factory()->create(); $asset = Asset::factory()->assignedToUser($user)->create(); @@ -37,7 +37,7 @@ class EmailNotificationsUponCheckinTest extends TestCase ); } - public function testCheckInEmailNotSentToUserIfSettingDisabled() + public function testCheckInEmailNotSentToUserIfSettingDisabled(): void { $user = User::factory()->create(); $asset = Asset::factory()->assignedToUser($user)->create(); diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php index adaede07ec..b6f6964ab1 100644 --- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php +++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php @@ -45,7 +45,7 @@ class SlackNotificationsUponCheckinTest extends TestCase ]; } - public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled() + public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled(): void { $this->settings->enableSlackWebhook(); @@ -57,7 +57,7 @@ class SlackNotificationsUponCheckinTest extends TestCase $this->assertSlackNotificationSent(CheckinAccessoryNotification::class); } - public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled() + public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled(): void { $this->settings->disableSlackWebhook(); @@ -70,7 +70,7 @@ class SlackNotificationsUponCheckinTest extends TestCase } #[DataProvider('assetCheckInTargets')] - public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget) + public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void { $this->settings->enableSlackWebhook(); @@ -83,7 +83,7 @@ class SlackNotificationsUponCheckinTest extends TestCase } #[DataProvider('assetCheckInTargets')] - public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget) + public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void { $this->settings->disableSlackWebhook(); @@ -95,7 +95,7 @@ class SlackNotificationsUponCheckinTest extends TestCase $this->assertNoSlackNotificationSent(CheckinAssetNotification::class); } - public function testComponentCheckinDoesNotSendSlackNotification() + public function testComponentCheckinDoesNotSendSlackNotification(): void { $this->settings->enableSlackWebhook(); @@ -108,7 +108,7 @@ class SlackNotificationsUponCheckinTest extends TestCase } #[DataProvider('licenseCheckInTargets')] - public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget) + public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void { $this->settings->enableSlackWebhook(); @@ -121,7 +121,7 @@ class SlackNotificationsUponCheckinTest extends TestCase } #[DataProvider('licenseCheckInTargets')] - public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget) + public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void { $this->settings->disableSlackWebhook(); diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php index 4f34da2857..39af3f6c54 100644 --- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php +++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php @@ -47,7 +47,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase ]; } - public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled() + public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled(): void { $this->settings->enableSlackWebhook(); @@ -59,7 +59,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase $this->assertSlackNotificationSent(CheckoutAccessoryNotification::class); } - public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled() + public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled(): void { $this->settings->disableSlackWebhook(); @@ -72,7 +72,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase } #[DataProvider('assetCheckoutTargets')] - public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget) + public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void { $this->settings->enableSlackWebhook(); @@ -85,7 +85,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase } #[DataProvider('assetCheckoutTargets')] - public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget) + public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void { $this->settings->disableSlackWebhook(); @@ -97,7 +97,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase $this->assertNoSlackNotificationSent(CheckoutAssetNotification::class); } - public function testComponentCheckoutDoesNotSendSlackNotification() + public function testComponentCheckoutDoesNotSendSlackNotification(): void { $this->settings->enableSlackWebhook(); @@ -109,7 +109,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase Notification::assertNothingSent(); } - public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled() + public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled(): void { $this->settings->enableSlackWebhook(); @@ -121,7 +121,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase $this->assertSlackNotificationSent(CheckoutConsumableNotification::class); } - public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled() + public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled(): void { $this->settings->disableSlackWebhook(); @@ -134,7 +134,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase } #[DataProvider('licenseCheckoutTargets')] - public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget) + public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void { $this->settings->enableSlackWebhook(); @@ -147,7 +147,7 @@ class SlackNotificationsUponCheckoutTest extends TestCase } #[DataProvider('licenseCheckoutTargets')] - public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget) + public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void { $this->settings->disableSlackWebhook(); diff --git a/tests/Feature/Reporting/CustomReportTest.php b/tests/Feature/Reporting/CustomReportTest.php index 4d11cb23c8..015675016b 100644 --- a/tests/Feature/Reporting/CustomReportTest.php +++ b/tests/Feature/Reporting/CustomReportTest.php @@ -43,7 +43,7 @@ class CustomReportTest extends TestCase ); } - public function testCustomAssetReport() + public function testCustomAssetReport(): void { Asset::factory()->create(['name' => 'Asset A']); Asset::factory()->create(['name' => 'Asset B']); @@ -59,7 +59,7 @@ class CustomReportTest extends TestCase ->assertSeeTextInStreamedResponse('Asset B'); } - public function testCustomAssetReportAdheresToCompanyScoping() + public function testCustomAssetReportAdheresToCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); @@ -105,7 +105,7 @@ class CustomReportTest extends TestCase ->assertSeeTextInStreamedResponse('Asset B'); } - public function testCanLimitAssetsByLastCheckIn() + public function testCanLimitAssetsByLastCheckIn(): void { 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.php index b3ec0b2e0b..8325661e23 100644 --- a/tests/Feature/Reporting/UnacceptedAssetReportTest.php +++ b/tests/Feature/Reporting/UnacceptedAssetReportTest.php @@ -44,14 +44,14 @@ class UnacceptedAssetReportTest extends TestCase } - public function testPermissionRequiredToViewUnacceptedAssetReport() + public function testPermissionRequiredToViewUnacceptedAssetReport(): void { $this->actingAs(User::factory()->create()) ->get(route('reports/unaccepted_assets')) ->assertForbidden(); } - public function testUserCanListUnacceptedAssets() + public function testUserCanListUnacceptedAssets(): void { $this->actingAs(User::factory()->superuser()->create()) ->get(route('reports/unaccepted_assets')) diff --git a/tests/Feature/Settings/BrandingSettingsTest.php b/tests/Feature/Settings/BrandingSettingsTest.php index 03e2b013f6..cb8665f1cb 100644 --- a/tests/Feature/Settings/BrandingSettingsTest.php +++ b/tests/Feature/Settings/BrandingSettingsTest.php @@ -12,7 +12,7 @@ use App\Models\Setting; class BrandingSettingsTest extends TestCase { - public function testSiteNameIsRequired() + public function testSiteNameIsRequired(): void { $response = $this->actingAs(User::factory()->superuser()->create()) ->from(route('settings.branding.index')) @@ -25,7 +25,7 @@ class BrandingSettingsTest extends TestCase $this->followRedirects($response)->assertSee(trans('general.error')); } - public function testSiteNameCanBeSaved() + public function testSiteNameCanBeSaved(): void { $response = $this->actingAs(User::factory()->superuser()->create()) ->post(route('settings.branding.save', ['site_name' => 'My Awesome Site'])) @@ -38,7 +38,7 @@ class BrandingSettingsTest extends TestCase } - public function testLogoCanBeUploaded() + public function testLogoCanBeUploaded(): void { Storage::fake('public'); $setting = Setting::factory()->create(['logo' => null]); @@ -58,7 +58,7 @@ class BrandingSettingsTest extends TestCase Storage::disk('public')->assertExists($setting->logo); } - public function testLogoCanBeDeleted() + public function testLogoCanBeDeleted(): void { Storage::fake('public'); @@ -82,7 +82,7 @@ class BrandingSettingsTest extends TestCase //Storage::disk('public')->assertMissing($original_file); } - public function testEmailLogoCanBeUploaded() + public function testEmailLogoCanBeUploaded(): void { Storage::fake('public'); @@ -108,7 +108,7 @@ class BrandingSettingsTest extends TestCase // Storage::disk('public')->assertMissing($original_file); } - public function testEmailLogoCanBeDeleted() + public function testEmailLogoCanBeDeleted(): void { Storage::fake('public'); @@ -135,7 +135,7 @@ class BrandingSettingsTest extends TestCase } - public function testLabelLogoCanBeUploaded() + public function testLabelLogoCanBeUploaded(): void { Storage::fake('public'); @@ -164,7 +164,7 @@ class BrandingSettingsTest extends TestCase } - public function testLabelLogoCanBeDeleted() + public function testLabelLogoCanBeDeleted(): void { Storage::fake('public'); @@ -191,7 +191,7 @@ class BrandingSettingsTest extends TestCase } - public function testDefaultAvatarCanBeUploaded() + public function testDefaultAvatarCanBeUploaded(): void { Storage::fake('public'); @@ -213,7 +213,7 @@ class BrandingSettingsTest extends TestCase // Storage::disk('public')->assertMissing($original_file); } - public function testDefaultAvatarCanBeDeleted() + public function testDefaultAvatarCanBeDeleted(): void { Storage::fake('public'); @@ -238,7 +238,7 @@ class BrandingSettingsTest extends TestCase // Storage::disk('public')->assertMissing($original_file); } - public function testSnipeDefaultAvatarCanBeDeleted() + public function testSnipeDefaultAvatarCanBeDeleted(): void { $setting = Setting::getSettings()->first(); @@ -263,7 +263,7 @@ class BrandingSettingsTest extends TestCase } - public function testFaviconCanBeUploaded() + public function testFaviconCanBeUploaded(): void { $this->markTestIncomplete('This fails mimetype validation on the mock'); Storage::fake('public'); @@ -284,7 +284,7 @@ class BrandingSettingsTest extends TestCase Storage::disk('public')->assertExists('favicon.png'); } - public function testFaviconCanBeDeleted() + public function testFaviconCanBeDeleted(): void { $this->markTestIncomplete('This fails mimetype validation on the mock'); Storage::fake('public'); diff --git a/tests/Feature/Settings/ShowSetUpPageTest.php b/tests/Feature/Settings/ShowSetUpPageTest.php index 196902ac5f..9fea64dd64 100644 --- a/tests/Feature/Settings/ShowSetUpPageTest.php +++ b/tests/Feature/Settings/ShowSetUpPageTest.php @@ -302,7 +302,7 @@ class ShowSetUpPageTest extends TestCase $this->assertSeeDirectoryPermissionError(false); } - public function testInvalidTLSCertsOkWhenCheckingForEnvFile() + public function testInvalidTLSCertsOkWhenCheckingForEnvFile(): void { //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 ..."); diff --git a/tests/Feature/Users/Api/DeleteUserTest.php b/tests/Feature/Users/Api/DeleteUserTest.php index 49625daac3..2fab34d059 100644 --- a/tests/Feature/Users/Api/DeleteUserTest.php +++ b/tests/Feature/Users/Api/DeleteUserTest.php @@ -12,7 +12,7 @@ class DeleteUserTest extends TestCase { - public function testErrorReturnedViaApiIfUserDoesNotExist() + public function testErrorReturnedViaApiIfUserDoesNotExist(): void { $this->actingAsForApi(User::factory()->deleteUsers()->create()) ->deleteJson(route('api.users.destroy', 'invalid-id')) @@ -22,7 +22,7 @@ class DeleteUserTest extends TestCase ->json(); } - public function testErrorReturnedViaApiIfUserIsAlreadyDeleted() + public function testErrorReturnedViaApiIfUserIsAlreadyDeleted(): void { $user = User::factory()->deletedUser()->create(); $this->actingAsForApi(User::factory()->deleteUsers()->create()) @@ -34,7 +34,7 @@ class DeleteUserTest extends TestCase } - public function testDisallowUserDeletionViaApiIfStillManagingPeople() + public function testDisallowUserDeletionViaApiIfStillManagingPeople(): void { $manager = User::factory()->create(); User::factory()->count(5)->create(['manager_id' => $manager->id]); @@ -48,7 +48,7 @@ class DeleteUserTest extends TestCase ->json(); } - public function testDisallowUserDeletionViaApiIfStillManagingLocations() + public function testDisallowUserDeletionViaApiIfStillManagingLocations(): void { $manager = User::factory()->create(); Location::factory()->count(5)->create(['manager_id' => $manager->id]); @@ -63,7 +63,7 @@ class DeleteUserTest extends TestCase ->json(); } - public function testDisallowUserDeletionViaApiIfStillHasLicenses() + public function testDisallowUserDeletionViaApiIfStillHasLicenses(): void { $manager = User::factory()->create(); LicenseSeat::factory()->count(5)->create(['assigned_to' => $manager->id]); @@ -78,7 +78,7 @@ class DeleteUserTest extends TestCase ->json(); } - public function testDeniedPermissionsForDeletingUserViaApi() + public function testDeniedPermissionsForDeletingUserViaApi(): void { $this->actingAsForApi(User::factory()->create()) ->deleteJson(route('api.users.destroy', User::factory()->create())) @@ -86,7 +86,7 @@ class DeleteUserTest extends TestCase ->json(); } - public function testSuccessPermissionsForDeletingUserViaApi() + public function testSuccessPermissionsForDeletingUserViaApi(): void { $this->actingAsForApi(User::factory()->deleteUsers()->create()) ->deleteJson(route('api.users.destroy', User::factory()->create())) @@ -97,7 +97,7 @@ class DeleteUserTest extends TestCase } - public function testPermissionsForDeletingIfNotInSameCompanyAndNotSuperadmin() + public function testPermissionsForDeletingIfNotInSameCompanyAndNotSuperadmin(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -139,7 +139,7 @@ class DeleteUserTest extends TestCase } - public function testUsersCannotDeleteThemselves() + public function testUsersCannotDeleteThemselves(): void { $user = User::factory()->deleteUsers()->create(); $this->actingAsForApi($user) diff --git a/tests/Feature/Users/Api/RestoreUserTest.php b/tests/Feature/Users/Api/RestoreUserTest.php index 0ffac8f07e..9ec087a87a 100644 --- a/tests/Feature/Users/Api/RestoreUserTest.php +++ b/tests/Feature/Users/Api/RestoreUserTest.php @@ -12,7 +12,7 @@ class RestoreUserTest extends TestCase { - public function testErrorReturnedViaApiIfUserDoesNotExist() + public function testErrorReturnedViaApiIfUserDoesNotExist(): void { $this->actingAsForApi(User::factory()->deleteUsers()->create()) ->postJson(route('api.users.restore', 'invalid-id')) @@ -22,7 +22,7 @@ class RestoreUserTest extends TestCase ->json(); } - public function testErrorReturnedViaApiIfUserIsNotDeleted() + public function testErrorReturnedViaApiIfUserIsNotDeleted(): void { $user = User::factory()->create(); $this->actingAsForApi(User::factory()->deleteUsers()->create()) @@ -34,7 +34,7 @@ class RestoreUserTest extends TestCase } - public function testDeniedPermissionsForRestoringUserViaApi() + public function testDeniedPermissionsForRestoringUserViaApi(): void { $this->actingAsForApi(User::factory()->create()) ->postJson(route('api.users.restore', User::factory()->deletedUser()->create())) @@ -42,7 +42,7 @@ class RestoreUserTest extends TestCase ->json(); } - public function testSuccessPermissionsForRestoringUserViaApi() + public function testSuccessPermissionsForRestoringUserViaApi(): void { $deleted_user = User::factory()->deletedUser()->create(); @@ -57,7 +57,7 @@ class RestoreUserTest extends TestCase $this->assertNull($deleted_user->deleted_at); } - public function testPermissionsForRestoringIfNotInSameCompanyAndNotSuperadmin() + public function testPermissionsForRestoringIfNotInSameCompanyAndNotSuperadmin(): void { $this->settings->enableMultipleFullCompanySupport(); diff --git a/tests/Feature/Users/Api/UpdateUserTest.php b/tests/Feature/Users/Api/UpdateUserTest.php index 1c66bbdda9..4f64998a66 100644 --- a/tests/Feature/Users/Api/UpdateUserTest.php +++ b/tests/Feature/Users/Api/UpdateUserTest.php @@ -12,7 +12,7 @@ use Tests\TestCase; class UpdateUserTest extends TestCase { - public function testCanUpdateUserViaPatch() + public function testCanUpdateUserViaPatch(): void { $admin = User::factory()->superuser()->create(); $manager = User::factory()->create(); @@ -82,7 +82,7 @@ class UpdateUserTest extends TestCase $this->assertTrue($user->groups->contains($groupB), 'Not part of expected group'); } - public function testApiUsersCanBeActivatedWithNumber() + public function testApiUsersCanBeActivatedWithNumber(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => 0]); @@ -95,7 +95,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(1, $user->refresh()->activated); } - public function testApiUsersCanBeActivatedWithBooleanTrue() + public function testApiUsersCanBeActivatedWithBooleanTrue(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => false]); @@ -108,7 +108,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(1, $user->refresh()->activated); } - public function testApiUsersCanBeDeactivatedWithNumber() + public function testApiUsersCanBeDeactivatedWithNumber(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => true]); @@ -121,7 +121,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(0, $user->refresh()->activated); } - public function testApiUsersCanBeDeactivatedWithBooleanFalse() + public function testApiUsersCanBeDeactivatedWithBooleanFalse(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => true]); @@ -134,7 +134,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(0, $user->refresh()->activated); } - public function testUsersScopedToCompanyDuringUpdateWhenMultipleFullCompanySupportEnabled() + public function testUsersScopedToCompanyDuringUpdateWhenMultipleFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -223,7 +223,7 @@ class UpdateUserTest extends TestCase ->json(); } - public function testUserGroupsAreOnlyUpdatedIfAuthenticatedUserIsSuperUser() + public function testUserGroupsAreOnlyUpdatedIfAuthenticatedUserIsSuperUser(): void { $groupToJoin = Group::factory()->create(); @@ -250,7 +250,7 @@ class UpdateUserTest extends TestCase $this->assertTrue($userToUpdateByToUserBySuperuser->refresh()->groups->contains($groupToJoin)); } - public function testUserGroupsCanBeClearedBySuperUser() + public function testUserGroupsCanBeClearedBySuperUser(): void { $normalUser = User::factory()->editUsers()->create(); $superUser = User::factory()->superuser()->create(); @@ -276,7 +276,7 @@ class UpdateUserTest extends TestCase $this->assertFalse($anotherUserToUpdate->refresh()->groups->contains($joinedGroup)); } - public function testNonSuperuserCannotUpdateOwnGroups() + public function testNonSuperuserCannotUpdateOwnGroups(): void { $groupToJoin = Group::factory()->create(); $user = User::factory()->editUsers()->create(); @@ -292,7 +292,7 @@ class UpdateUserTest extends TestCase } - public function testNonSuperuserCannotUpdateGroups() + public function testNonSuperuserCannotUpdateGroups(): void { $user = User::factory()->editUsers()->create(); $group = Group::factory()->create(); @@ -313,7 +313,7 @@ class UpdateUserTest extends TestCase } - public function testUsersGroupsAreNotClearedIfNoGroupPassedBySuperUser() + public function testUsersGroupsAreNotClearedIfNoGroupPassedBySuperUser(): void { $user = User::factory()->create(); $superUser = User::factory()->superuser()->create(); @@ -327,7 +327,7 @@ class UpdateUserTest extends TestCase $this->assertTrue($user->refresh()->groups->contains($group)); } - public function testMultipleGroupsUpdateBySuperUser() + public function testMultipleGroupsUpdateBySuperUser(): void { $user = User::factory()->create(); $superUser = User::factory()->superuser()->create(); diff --git a/tests/Feature/Users/Api/UserSearchTest.php b/tests/Feature/Users/Api/UserSearchTest.php index dc0ffdc803..351fd12678 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 testCanSearchByUserFirstAndLastName(): void { User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']); User::factory()->create(['first_name' => 'Darth', 'last_name' => 'Vader']); @@ -24,7 +24,7 @@ class UserSearchTest extends TestCase $this->assertFalse($results->pluck('name')->contains(fn($text) => str_contains($text, 'Darth'))); } - public function testResultsWhenSearchingForActiveUsers() + public function testResultsWhenSearchingForActiveUsers(): void { 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 testResultsWhenSearchingForDeletedUsers(): void { 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 testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -110,7 +110,7 @@ class UserSearchTest extends TestCase ); } - public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled() + public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -145,7 +145,7 @@ class UserSearchTest extends TestCase ); } - public function testUsersIndexWhenInvalidSortFieldIsPassed() + public function testUsersIndexWhenInvalidSortFieldIsPassed(): void { $this->markIncompleteIfSqlite('This test is not compatible with SQLite'); diff --git a/tests/Feature/Users/Api/UsersForSelectListTest.php b/tests/Feature/Users/Api/UsersForSelectListTest.php index 1367f408d4..c79650f60a 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 testUsersAreReturned(): void { $users = User::factory()->superuser()->count(3)->create(); @@ -27,7 +27,7 @@ class UsersForSelectListTest extends TestCase ->assertJson(fn(AssertableJson $json) => $json->has('results', 3)->etc()); } - public function testUsersCanBeSearchedByFirstAndLastName() + public function testUsersCanBeSearchedByFirstAndLastName(): void { User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']); @@ -40,7 +40,7 @@ class UsersForSelectListTest extends TestCase $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, 'Luke'))); } - public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled() + public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -68,7 +68,7 @@ class UsersForSelectListTest extends TestCase ); } - public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled() + public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); diff --git a/tests/Feature/Users/Api/ViewUserTest.php b/tests/Feature/Users/Api/ViewUserTest.php index 07346dbbb8..e0ce78c11c 100644 --- a/tests/Feature/Users/Api/ViewUserTest.php +++ b/tests/Feature/Users/Api/ViewUserTest.php @@ -11,7 +11,7 @@ use Tests\TestCase; class ViewUserTest extends TestCase { - public function testCanReturnUser() + public function testCanReturnUser(): void { $user = User::factory()->create(); diff --git a/tests/Feature/Users/Ui/DeleteUserTest.php b/tests/Feature/Users/Ui/DeleteUserTest.php index da4c5a37ee..e0defe742b 100644 --- a/tests/Feature/Users/Ui/DeleteUserTest.php +++ b/tests/Feature/Users/Ui/DeleteUserTest.php @@ -14,7 +14,7 @@ use App\Models\Asset; class DeleteUserTest extends TestCase { - public function testUserCanDeleteAnotherUser() + public function testUserCanDeleteAnotherUser(): void { $user = User::factory()->deleteUsers()->viewUsers()->create(); $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($user->isDeletable()); @@ -28,7 +28,7 @@ class DeleteUserTest extends TestCase } - public function testErrorReturnedIfUserDoesNotExist() + public function testErrorReturnedIfUserDoesNotExist(): void { $response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create()) ->delete(route('users.destroy', ['user' => '40596803548609346'])) @@ -37,7 +37,7 @@ class DeleteUserTest extends TestCase $this->followRedirects($response)->assertSee(trans('alert-danger')); } - public function testErrorReturnedIfUserIsAlreadyDeleted() + public function testErrorReturnedIfUserIsAlreadyDeleted(): void { $user = User::factory()->deletedUser()->viewUsers()->create(); $response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create()) @@ -49,7 +49,7 @@ class DeleteUserTest extends TestCase } - public function testFmcsPermissionsToDeleteUser() + public function testFmcsPermissionsToDeleteUser(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -90,7 +90,7 @@ class DeleteUserTest extends TestCase } - public function testDisallowUserDeletionIfStillManagingPeople() + public function testDisallowUserDeletionIfStillManagingPeople(): void { $manager = User::factory()->create(); User::factory()->count(1)->create(['manager_id' => $manager->id]); @@ -105,7 +105,7 @@ class DeleteUserTest extends TestCase $this->followRedirects($response)->assertSee('Error'); } - public function testDisallowUserDeletionIfStillManagingLocations() + public function testDisallowUserDeletionIfStillManagingLocations(): void { $manager = User::factory()->create(); Location::factory()->count(2)->create(['manager_id' => $manager->id]); @@ -120,7 +120,7 @@ class DeleteUserTest extends TestCase $this->followRedirects($response)->assertSee('Error'); } - public function testDisallowUserDeletionIfStillHaveAccessories() + public function testDisallowUserDeletionIfStillHaveAccessories(): void { $user = User::factory()->create(); Accessory::factory()->count(3)->checkedOutToUser($user)->create(); @@ -135,7 +135,7 @@ class DeleteUserTest extends TestCase $this->followRedirects($response)->assertSee('Error'); } - public function testDisallowUserDeletionIfStillHaveLicenses() + public function testDisallowUserDeletionIfStillHaveLicenses(): void { $user = User::factory()->create(); LicenseSeat::factory()->count(4)->create(['assigned_to' => $user->id]); @@ -151,7 +151,7 @@ class DeleteUserTest extends TestCase } - public function testAllowUserDeletionIfNotManagingLocations() + public function testAllowUserDeletionIfNotManagingLocations(): void { $manager = User::factory()->create(); $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable()); @@ -165,14 +165,14 @@ class DeleteUserTest extends TestCase } - public function testDisallowUserDeletionIfNoDeletePermissions() + public function testDisallowUserDeletionIfNoDeletePermissions(): void { $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 testDisallowUserDeletionIfTheyStillHaveAssets(): void { $user = User::factory()->create(); $asset = Asset::factory()->create(); @@ -195,7 +195,7 @@ class DeleteUserTest extends TestCase } - public function testUsersCannotDeleteThemselves() + public function testUsersCannotDeleteThemselves(): void { $manager = User::factory()->deleteUsers()->viewUsers()->create(); $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable()); diff --git a/tests/Feature/Users/Ui/MergeUsersTest.php b/tests/Feature/Users/Ui/MergeUsersTest.php index a9ae11171b..c8bab343e5 100644 --- a/tests/Feature/Users/Ui/MergeUsersTest.php +++ b/tests/Feature/Users/Ui/MergeUsersTest.php @@ -13,7 +13,7 @@ use Tests\TestCase; class MergeUsersTest extends TestCase { - public function testAssetsAreTransferredOnUserMerge() + public function testAssetsAreTransferredOnUserMerge(): void { $user1 = User::factory()->create(); $user2 = User::factory()->create(); @@ -39,7 +39,7 @@ class MergeUsersTest extends TestCase } - public function testLicensesAreTransferredOnUserMerge() + public function testLicensesAreTransferredOnUserMerge(): void { $user1 = User::factory()->create(); $user2 = User::factory()->create(); @@ -67,7 +67,7 @@ class MergeUsersTest extends TestCase } - public function testAccessoriesTransferredOnUserMerge() + public function testAccessoriesTransferredOnUserMerge(): void { $user1 = User::factory()->create(); $user2 = User::factory()->create(); @@ -95,7 +95,7 @@ class MergeUsersTest extends TestCase } - public function testConsumablesTransferredOnUserMerge() + public function testConsumablesTransferredOnUserMerge(): void { $user1 = User::factory()->create(); $user2 = User::factory()->create(); @@ -123,7 +123,7 @@ class MergeUsersTest extends TestCase } - public function testFilesAreTransferredOnUserMerge() + public function testFilesAreTransferredOnUserMerge(): void { $user1 = User::factory()->create(); $user2 = User::factory()->create(); @@ -151,7 +151,7 @@ class MergeUsersTest extends TestCase } - public function testAcceptancesAreTransferredOnUserMerge() + public function testAcceptancesAreTransferredOnUserMerge(): void { $user1 = User::factory()->create(); $user2 = User::factory()->create(); @@ -179,7 +179,7 @@ class MergeUsersTest extends TestCase } - public function testUserUpdateHistoryIsTransferredOnUserMerge() + public function testUserUpdateHistoryIsTransferredOnUserMerge(): void { $user1 = User::factory()->create(); $user2 = User::factory()->create(); diff --git a/tests/Feature/Users/Ui/UpdateUserTest.php b/tests/Feature/Users/Ui/UpdateUserTest.php index bef1d59a06..16caa7e6a9 100644 --- a/tests/Feature/Users/Ui/UpdateUserTest.php +++ b/tests/Feature/Users/Ui/UpdateUserTest.php @@ -7,7 +7,7 @@ use Tests\TestCase; class UpdateUserTest extends TestCase { - public function testUsersCanBeActivatedWithNumber() + public function testUsersCanBeActivatedWithNumber(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => 0]); @@ -22,7 +22,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(1, $user->refresh()->activated); } - public function testUsersCanBeActivatedWithBooleanTrue() + public function testUsersCanBeActivatedWithBooleanTrue(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => false]); @@ -37,7 +37,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(1, $user->refresh()->activated); } - public function testUsersCanBeDeactivatedWithNumber() + public function testUsersCanBeDeactivatedWithNumber(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => true]); @@ -52,7 +52,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(0, $user->refresh()->activated); } - public function testUsersCanBeDeactivatedWithBooleanFalse() + public function testUsersCanBeDeactivatedWithBooleanFalse(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(['activated' => true]); @@ -67,7 +67,7 @@ class UpdateUserTest extends TestCase $this->assertEquals(0, $user->refresh()->activated); } - public function testUsersUpdatingThemselvesDoNotDeactivateTheirAccount() + public function testUsersUpdatingThemselvesDoNotDeactivateTheirAccount(): void { $admin = User::factory()->superuser()->create(['activated' => true]); diff --git a/tests/Feature/Users/Ui/ViewUserTest.php b/tests/Feature/Users/Ui/ViewUserTest.php index c412e9e789..5cd7051045 100644 --- a/tests/Feature/Users/Ui/ViewUserTest.php +++ b/tests/Feature/Users/Ui/ViewUserTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class ViewUserTest extends TestCase { - public function testPermissionsForUserDetailPage() + public function testPermissionsForUserDetailPage(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -29,7 +29,7 @@ class ViewUserTest extends TestCase ->assertStatus(200); } - public function testPermissionsForPrintAllInventoryPage() + public function testPermissionsForPrintAllInventoryPage(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -52,7 +52,7 @@ class ViewUserTest extends TestCase ->assertStatus(200); } - public function testUserWithoutCompanyPermissionsCannotSendInventory() + public function testUserWithoutCompanyPermissionsCannotSendInventory(): void { Notification::fake(); diff --git a/tests/Unit/AccessoryTest.php b/tests/Unit/AccessoryTest.php index ec931fad6e..af05be10fa 100644 --- a/tests/Unit/AccessoryTest.php +++ b/tests/Unit/AccessoryTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class AccessoryTest extends TestCase { - public function testAnAccessoryBelongsToACompany() + public function testAnAccessoryBelongsToACompany(): void { $accessory = Accessory::factory() ->create( @@ -20,7 +20,7 @@ class AccessoryTest extends TestCase $this->assertInstanceOf(Company::class, $accessory->company); } - public function testAnAccessoryHasALocation() + public function testAnAccessoryHasALocation(): void { $accessory = Accessory::factory() ->create( @@ -30,7 +30,7 @@ class AccessoryTest extends TestCase $this->assertInstanceOf(Location::class, $accessory->location); } - public function testAnAccessoryBelongsToACategory() + public function testAnAccessoryBelongsToACategory(): void { $accessory = Accessory::factory()->appleBtKeyboard() ->create( @@ -45,7 +45,7 @@ class AccessoryTest extends TestCase $this->assertEquals('accessory', $accessory->category->category_type); } - public function testAnAccessoryHasAManufacturer() + public function testAnAccessoryHasAManufacturer(): void { $accessory = Accessory::factory()->appleBtKeyboard()->create( [ diff --git a/tests/Unit/AssetMaintenanceTest.php b/tests/Unit/AssetMaintenanceTest.php index 46a0efdd7c..b317de9934 100644 --- a/tests/Unit/AssetMaintenanceTest.php +++ b/tests/Unit/AssetMaintenanceTest.php @@ -6,7 +6,7 @@ use Tests\TestCase; class AssetMaintenanceTest extends TestCase { - public function testZerosOutWarrantyIfBlank() + public function testZerosOutWarrantyIfBlank(): void { $c = new AssetMaintenance; $c->is_warranty = ''; @@ -15,7 +15,7 @@ class AssetMaintenanceTest extends TestCase $this->assertTrue($c->is_warranty == 4); } - public function testSetsCostsAppropriately() + public function testSetsCostsAppropriately(): void { $c = new AssetMaintenance(); $c->cost = '0.00'; @@ -26,7 +26,7 @@ class AssetMaintenanceTest extends TestCase $this->assertTrue($c->cost === 9.5); } - public function testNullsOutNotesIfBlank() + public function testNullsOutNotesIfBlank(): void { $c = new AssetMaintenance; $c->notes = ''; @@ -35,7 +35,7 @@ class AssetMaintenanceTest extends TestCase $this->assertTrue($c->notes === 'This is a long note'); } - public function testNullsOutCompletionDateIfBlankOrInvalid() + public function testNullsOutCompletionDateIfBlankOrInvalid(): void { $c = new AssetMaintenance; $c->completion_date = ''; diff --git a/tests/Unit/AssetModelTest.php b/tests/Unit/AssetModelTest.php index 4cc62e20a0..961560b5ab 100644 --- a/tests/Unit/AssetModelTest.php +++ b/tests/Unit/AssetModelTest.php @@ -8,7 +8,7 @@ use Tests\TestCase; class AssetModelTest extends TestCase { - public function testAnAssetModelContainsAssets() + public function testAnAssetModelContainsAssets(): void { $category = Category::factory()->create([ 'category_type' => 'asset' diff --git a/tests/Unit/AssetTest.php b/tests/Unit/AssetTest.php index ef0da1a1b8..619e34cc80 100644 --- a/tests/Unit/AssetTest.php +++ b/tests/Unit/AssetTest.php @@ -10,7 +10,7 @@ use App\Models\Setting; class AssetTest extends TestCase { - public function testAutoIncrement() + public function testAutoIncrement(): void { $this->settings->enableAutoIncrement(); @@ -22,7 +22,7 @@ class AssetTest extends TestCase } - public function testAutoIncrementCollision() + public function testAutoIncrementCollision(): void { $this->settings->enableAutoIncrement(); @@ -34,7 +34,7 @@ class AssetTest extends TestCase $this->assertFalse($b->save()); } - public function testAutoIncrementDouble() + public function testAutoIncrementDouble(): void { // make one asset with the autoincrement *ONE* higher than the next auto-increment // make sure you can then still make another @@ -53,7 +53,7 @@ class AssetTest extends TestCase $this->assertEquals($c->asset_tag, $final_number); } - public function testAutoIncrementGapAndBackfill() + public function testAutoIncrementGapAndBackfill(): void { // make one asset 3 higher than the next auto-increment // manually make one that's 1 lower than that @@ -82,7 +82,7 @@ class AssetTest extends TestCase $this->assertEquals($final->asset_tag, $final_result); } - public function testPrefixlessAutoincrementBackfill() + public function testPrefixlessAutoincrementBackfill(): void { // 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' => '']); @@ -109,7 +109,7 @@ class AssetTest extends TestCase $this->assertEquals($final->asset_tag, $final_result); } - public function testUnzerofilledPrefixlessAutoincrementBackfill() + public function testUnzerofilledPrefixlessAutoincrementBackfill(): void { // 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]); @@ -136,7 +136,7 @@ class AssetTest extends TestCase $this->assertEquals($final->asset_tag, $final_result); } - public function testAutoIncrementBIG() + public function testAutoIncrementBIG(): void { $this->settings->enableAutoIncrement(); @@ -153,7 +153,7 @@ 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 testAutoIncrementAlmostBIG(): void { // TODO: this looks pretty close to the one above, could we maybe squish them together? $this->settings->enableAutoIncrement(); @@ -170,7 +170,7 @@ class AssetTest extends TestCase } - public function testWarrantyExpiresAttribute() + public function testWarrantyExpiresAttribute(): void { $asset = Asset::factory() diff --git a/tests/Unit/CategoryTest.php b/tests/Unit/CategoryTest.php index 391e291552..1a7bfd1ba5 100644 --- a/tests/Unit/CategoryTest.php +++ b/tests/Unit/CategoryTest.php @@ -8,7 +8,7 @@ use Tests\TestCase; class CategoryTest extends TestCase { - public function testFailsEmptyValidation() + public function testFailsEmptyValidation(): void { // An Asset requires a name, a qty, and a category_id. $a = Category::create(); @@ -24,7 +24,7 @@ class CategoryTest extends TestCase } } - public function testACategoryCanHaveAssets() + public function testACategoryCanHaveAssets(): void { $category = Category::factory()->assetDesktopCategory()->create(); diff --git a/tests/Unit/CompanyScopingTest.php b/tests/Unit/CompanyScopingTest.php index ff55e83056..084c223e6a 100644 --- a/tests/Unit/CompanyScopingTest.php +++ b/tests/Unit/CompanyScopingTest.php @@ -29,7 +29,7 @@ class CompanyScopingTest extends TestCase } #[DataProvider('models')] - public function testCompanyScoping($model) + public function testCompanyScoping($model): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); @@ -69,7 +69,7 @@ class CompanyScopingTest extends TestCase $this->assertCanSee($modelB); } - public function testAssetMaintenanceCompanyScoping() + public function testAssetMaintenanceCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); @@ -109,7 +109,7 @@ class CompanyScopingTest extends TestCase $this->assertCanSee($assetMaintenanceForCompanyB); } - public function testLicenseSeatCompanyScoping() + public function testLicenseSeatCompanyScoping(): void { [$companyA, $companyB] = Company::factory()->count(2)->create(); diff --git a/tests/Unit/ComponentTest.php b/tests/Unit/ComponentTest.php index df8f64771f..f3f0f50ebd 100644 --- a/tests/Unit/ComponentTest.php +++ b/tests/Unit/ComponentTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class ComponentTest extends TestCase { - public function testAComponentBelongsToACompany() + public function testAComponentBelongsToACompany(): void { $component = Component::factory() ->create( @@ -20,14 +20,14 @@ class ComponentTest extends TestCase $this->assertInstanceOf(Company::class, $component->company); } - public function testAComponentHasALocation() + public function testAComponentHasALocation(): void { $component = Component::factory() ->create(['location_id' => Location::factory()->create()->id]); $this->assertInstanceOf(Location::class, $component->location); } - public function testAComponentBelongsToACategory() + public function testAComponentBelongsToACategory(): void { $component = Component::factory()->ramCrucial4() ->create( diff --git a/tests/Unit/CustomFieldTest.php b/tests/Unit/CustomFieldTest.php index d5704d8aa3..fe2c1e88ba 100644 --- a/tests/Unit/CustomFieldTest.php +++ b/tests/Unit/CustomFieldTest.php @@ -10,14 +10,14 @@ use Tests\TestCase; */ class CustomFieldTest extends TestCase { - public function testFormat() + public function testFormat(): void { $customfield = CustomField::factory()->make(['format' => 'IP']); $this->assertEquals($customfield->getAttributes()['format'], CustomField::PREDEFINED_FORMATS['IP']); //this seems undocumented... $this->assertEquals($customfield->format, 'IP'); } - public function testDbNameAscii() + public function testDbNameAscii(): void { $customfield = new CustomField(); $customfield->name = 'My hovercraft is full of eels'; @@ -26,7 +26,7 @@ class CustomFieldTest extends TestCase } // Western Europe - public function testDbNameLatin() + public function testDbNameLatin(): void { $customfield = new CustomField(); $customfield->name = 'My hovercraft is full of eels'; @@ -35,7 +35,7 @@ class CustomFieldTest extends TestCase } // Asian - public function testDbNameChinese() + public function testDbNameChinese(): void { $customfield = new CustomField(); $customfield->name = '我的氣墊船裝滿了鱔魚'; @@ -47,7 +47,7 @@ class CustomFieldTest extends TestCase } } - public function testDbNameJapanese() + public function testDbNameJapanese(): void { $customfield = new CustomField(); $customfield->name = '私のホバークラフトは鰻でいっぱいです'; @@ -59,7 +59,7 @@ class CustomFieldTest extends TestCase } } - public function testDbNameKorean() + public function testDbNameKorean(): void { $customfield = new CustomField(); $customfield->name = '내 호버크라프트는 장어로 가득 차 있어요'; @@ -72,7 +72,7 @@ class CustomFieldTest extends TestCase } // Nordic languages - public function testDbNameNonLatinEuro() + public function testDbNameNonLatinEuro(): void { $customfield = new CustomField(); $customfield->name = 'Mój poduszkowiec jest pełen węgorzy'; @@ -85,7 +85,7 @@ class CustomFieldTest extends TestCase } // - public function testDbNameTurkish() + public function testDbNameTurkish(): void { $customfield = new CustomField(); $customfield->name = 'Hoverkraftım yılan balığı dolu'; @@ -97,7 +97,7 @@ class CustomFieldTest extends TestCase } } - public function testDbNameArabic() + public function testDbNameArabic(): void { $customfield = new CustomField(); $customfield->name = 'حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون'; diff --git a/tests/Unit/DepreciationTest.php b/tests/Unit/DepreciationTest.php index 4dd8422276..8cd51b3e2f 100644 --- a/tests/Unit/DepreciationTest.php +++ b/tests/Unit/DepreciationTest.php @@ -9,7 +9,7 @@ use Tests\TestCase; class DepreciationTest extends TestCase { - public function testADepreciationHasModels() + public function testADepreciationHasModels(): void { $depreciation = Depreciation::factory()->create(); @@ -26,7 +26,7 @@ class DepreciationTest extends TestCase $this->assertEquals(5, $depreciation->models->count()); } - public function testADepreciationHasLicenses() + public function testADepreciationHasLicenses(): void { $depreciation = Depreciation::factory()->create(); diff --git a/tests/Unit/Helpers/HelperTest.php b/tests/Unit/Helpers/HelperTest.php index 2fb1c58e26..83dddbc6a7 100644 --- a/tests/Unit/Helpers/HelperTest.php +++ b/tests/Unit/Helpers/HelperTest.php @@ -10,17 +10,17 @@ use Tests\TestCase; class HelperTest extends TestCase { - public function testDefaultChartColorsMethodHandlesHighValues() + public function testDefaultChartColorsMethodHandlesHighValues(): void { $this->assertIsString(Helper::defaultChartColors(1000)); } - public function testDefaultChartColorsMethodHandlesNegativeNumbers() + public function testDefaultChartColorsMethodHandlesNegativeNumbers(): void { $this->assertIsString(Helper::defaultChartColors(-1)); } - public function testParseCurrencyMethod() + public function testParseCurrencyMethod(): void { $this->settings->set(['default_currency' => 'USD']); $this->assertSame(12.34, Helper::ParseCurrency('USD 12.34')); @@ -28,7 +28,7 @@ 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 testGetRedirectOptionMethod(): void { $test_data = [ 'Option target: redirect for user assigned to ' => [ diff --git a/tests/Unit/LdapTest.php b/tests/Unit/LdapTest.php index 65bdbe627c..596f4d5fe6 100644 --- a/tests/Unit/LdapTest.php +++ b/tests/Unit/LdapTest.php @@ -11,7 +11,7 @@ class LdapTest extends TestCase { use \phpmock\phpunit\PHPMock; - public function testConnect() + public function testConnect(): void { $this->settings->enableLdap(); @@ -31,14 +31,14 @@ class LdapTest extends TestCase // with/without ignore cert validation? // test (and mock) ldap_start_tls() ? - public function testBindAdmin() + public function testBindAdmin(): void { $this->settings->enableLdap(); $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true); $this->assertNull(Ldap::bindAdminToLdap("dummy")); } - public function testBindBad() + public function testBindBad(): void { $this->settings->enableLdap(); $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false); @@ -49,7 +49,7 @@ class LdapTest extends TestCase } // other test cases - test donked password? - public function testAnonymousBind() + public function testAnonymousBind(): void { //todo - would be nice to introspect somehow to make sure the right parameters were passed? $this->settings->enableAnonymousLdap(); @@ -57,7 +57,7 @@ class LdapTest extends TestCase $this->assertNull(Ldap::bindAdminToLdap("dummy")); } - public function testBadAnonymousBind() + public function testBadAnonymousBind(): void { $this->settings->enableAnonymousLdap(); $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false); @@ -67,7 +67,7 @@ class LdapTest extends TestCase $this->assertNull(Ldap::bindAdminToLdap("dummy")); } - public function testBadEncryptedPassword() + public function testBadEncryptedPassword(): void { $this->settings->enableBadPasswordLdap(); @@ -75,7 +75,7 @@ class LdapTest extends TestCase $this->assertNull(Ldap::bindAdminToLdap("dummy")); } - public function testFindAndBind() + public function testFindAndBind(): void { $this->settings->enableLdap(); @@ -105,7 +105,7 @@ class LdapTest extends TestCase $this->assertEqualsCanonicalizing(["count" =>1,0 =>['sn' => 'Surname','firstname' => 'FirstName']],$results); } - public function testFindAndBindBadPassword() + public function testFindAndBindBadPassword(): void { $this->settings->enableLdap(); @@ -126,7 +126,7 @@ class LdapTest extends TestCase $this->assertFalse($results); } - public function testFindAndBindCannotFindSelf() + public function testFindAndBindCannotFindSelf(): void { $this->settings->enableLdap(); @@ -147,7 +147,7 @@ class LdapTest extends TestCase //maybe should do an AD test as well? - public function testFindLdapUsers() + public function testFindLdapUsers(): void { $this->settings->enableLdap(); @@ -170,7 +170,7 @@ class LdapTest extends TestCase $this->assertEqualsCanonicalizing(["count" => 1], $results); } - public function testFindLdapUsersPaginated() + public function testFindLdapUsersPaginated(): void { $this->settings->enableLdap(); diff --git a/tests/Unit/Listeners/LogListenerTest.php b/tests/Unit/Listeners/LogListenerTest.php index 011a5c51a4..18f72cfa14 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 testLogsEntryOnCheckoutableCheckedOut(): void { $asset = Asset::factory()->create(); $checkedOutTo = User::factory()->create(); diff --git a/tests/Unit/LocationTest.php b/tests/Unit/LocationTest.php index 3fded9e568..c8780e3966 100644 --- a/tests/Unit/LocationTest.php +++ b/tests/Unit/LocationTest.php @@ -6,7 +6,7 @@ use Tests\TestCase; class LocationTest extends TestCase { - public function testPassesIfNotSelfParent() + public function testPassesIfNotSelfParent(): void { $a = Location::factory()->make([ 'name' => 'Test Location', @@ -17,7 +17,7 @@ class LocationTest extends TestCase $this->assertTrue($a->isValid()); } - public function testFailsIfSelfParent() + public function testFailsIfSelfParent(): void { $a = Location::factory()->make([ 'name' => 'Test Location', diff --git a/tests/Unit/Models/Company/CompanyTest.php b/tests/Unit/Models/Company/CompanyTest.php index 6fd17e554b..ad803fe6ef 100644 --- a/tests/Unit/Models/Company/CompanyTest.php +++ b/tests/Unit/Models/Company/CompanyTest.php @@ -7,7 +7,7 @@ use Tests\TestCase; class CompanyTest extends TestCase { - public function testACompanyCanHaveUsers() + public function testACompanyCanHaveUsers(): void { $company = Company::factory()->create(); $user = User::factory() diff --git a/tests/Unit/Models/Company/GetIdForCurrentUserTest.php b/tests/Unit/Models/Company/GetIdForCurrentUserTest.php index 6d77c88731..0c4aeeb5fd 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 testReturnsProvidedValueWhenFullCompanySupportDisabled(): void { $this->settings->disableMultipleFullCompanySupport(); @@ -16,7 +16,7 @@ class GetIdForCurrentUserTest extends TestCase $this->assertEquals(1000, Company::getIdForCurrentUser(1000)); } - public function testReturnsProvidedValueForSuperUsersWhenFullCompanySupportEnabled() + public function testReturnsProvidedValueForSuperUsersWhenFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -24,7 +24,7 @@ class GetIdForCurrentUserTest extends TestCase $this->assertEquals(2000, Company::getIdForCurrentUser(2000)); } - public function testReturnsNonSuperUsersCompanyIdWhenFullCompanySupportEnabled() + public function testReturnsNonSuperUsersCompanyIdWhenFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); @@ -32,7 +32,7 @@ class GetIdForCurrentUserTest extends TestCase $this->assertEquals(2000, Company::getIdForCurrentUser(1000)); } - public function testReturnsProvidedValueForNonSuperUserWithoutCompanyIdWhenFullCompanySupportEnabled() + public function testReturnsProvidedValueForNonSuperUserWithoutCompanyIdWhenFullCompanySupportEnabled(): void { $this->settings->enableMultipleFullCompanySupport(); diff --git a/tests/Unit/Models/Labels/FieldOptionTest.php b/tests/Unit/Models/Labels/FieldOptionTest.php index 6616ab2304..05788d2d84 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 testItDisplaysAssignedToProperly(): void { // "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/NotificationTest.php b/tests/Unit/NotificationTest.php index 8005759a1e..7a61fd709a 100644 --- a/tests/Unit/NotificationTest.php +++ b/tests/Unit/NotificationTest.php @@ -12,7 +12,7 @@ use Tests\TestCase; class NotificationTest extends TestCase { - public function testAUserIsEmailedIfTheyCheckoutAnAssetWithEULA() + public function testAUserIsEmailedIfTheyCheckoutAnAssetWithEULA(): void { $admin = User::factory()->superuser()->create(); $user = User::factory()->create(); diff --git a/tests/Unit/SnipeModelTest.php b/tests/Unit/SnipeModelTest.php index 2bc81da61b..fe2a336ca8 100644 --- a/tests/Unit/SnipeModelTest.php +++ b/tests/Unit/SnipeModelTest.php @@ -6,7 +6,7 @@ use Tests\TestCase; class SnipeModelTest extends TestCase { - public function testSetsPurchaseDatesAppropriately() + public function testSetsPurchaseDatesAppropriately(): void { $c = new SnipeModel; $c->purchase_date = ''; @@ -15,7 +15,7 @@ class SnipeModelTest extends TestCase $this->assertTrue($c->purchase_date === '2016-03-25 12:35:50'); } - public function testSetsPurchaseCostsAppropriately() + public function testSetsPurchaseCostsAppropriately(): void { $c = new SnipeModel; $c->purchase_cost = '0.00'; @@ -26,7 +26,7 @@ class SnipeModelTest extends TestCase $this->assertTrue($c->purchase_cost === 9.5); } - public function testNullsBlankLocationIdsButNotOthers() + public function testNullsBlankLocationIdsButNotOthers(): void { $c = new SnipeModel; $c->location_id = ''; @@ -35,7 +35,7 @@ class SnipeModelTest extends TestCase $this->assertTrue($c->location_id == 5); } - public function testNullsBlankCategoriesButNotOthers() + public function testNullsBlankCategoriesButNotOthers(): void { $c = new SnipeModel; $c->category_id = ''; @@ -44,7 +44,7 @@ class SnipeModelTest extends TestCase $this->assertTrue($c->category_id == 1); } - public function testNullsBlankSuppliersButNotOthers() + public function testNullsBlankSuppliersButNotOthers(): void { $c = new SnipeModel; $c->supplier_id = ''; @@ -53,7 +53,7 @@ class SnipeModelTest extends TestCase $this->assertTrue($c->supplier_id == 4); } - public function testNullsBlankDepreciationsButNotOthers() + public function testNullsBlankDepreciationsButNotOthers(): void { $c = new SnipeModel; $c->depreciation_id = ''; @@ -62,7 +62,7 @@ class SnipeModelTest extends TestCase $this->assertTrue($c->depreciation_id == 4); } - public function testNullsBlankManufacturersButNotOthers() + public function testNullsBlankManufacturersButNotOthers(): void { $c = new SnipeModel; $c->manufacturer_id = ''; diff --git a/tests/Unit/SnipeTranslatorTest.php b/tests/Unit/SnipeTranslatorTest.php index d374bf9134..55ecaaa3c5 100644 --- a/tests/Unit/SnipeTranslatorTest.php +++ b/tests/Unit/SnipeTranslatorTest.php @@ -11,17 +11,17 @@ 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 testBasic(): void { $this->assertEquals('This user has admin privileges',trans('general.admin_tooltip',[],'en-US')); } - public function testPortuguese() + public function testPortuguese(): void { $this->assertEquals('Acessório',trans('general.accessory',[],'pt-PT')); } - public function testFallback() + public function testFallback(): void { $this->assertEquals( 'This user has admin privileges', @@ -30,7 +30,7 @@ class SnipeTranslatorTest extends TestCase ); } - public function testBackupString() + public function testBackupString(): void { $this->assertEquals( 'Ingen sikkerhetskopier ble gjort ennå', @@ -39,7 +39,7 @@ class SnipeTranslatorTest extends TestCase ); } - public function testBackupFallback() + public function testBackupFallback(): void { $this->assertEquals( 'No backups were made yet', @@ -49,7 +49,7 @@ class SnipeTranslatorTest extends TestCase } - public function testTransChoiceSingular() + public function testTransChoiceSingular(): void { $this->assertEquals( '1 Consumível', @@ -57,7 +57,7 @@ class SnipeTranslatorTest extends TestCase ); } - public function testTransChoicePlural() + public function testTransChoicePlural(): void { $this->assertEquals( '2 Consumíveis', @@ -65,7 +65,7 @@ class SnipeTranslatorTest extends TestCase ); } - public function testTotallyBogusKey() + public function testTotallyBogusKey(): void { $this->assertEquals( 'bogus_key', @@ -74,7 +74,7 @@ class SnipeTranslatorTest extends TestCase ); } - public function testReplacements() { + public function testReplacements(): void { $this->assertEquals( 'Artigos alocados a Some Name Here', trans('admin/users/general.assets_user',['name' => 'Some Name Here'],'pt-PT'), @@ -82,7 +82,7 @@ class SnipeTranslatorTest extends TestCase ); } - public function testNonlegacyBackupLocale() { + public function testNonlegacyBackupLocale(): void { //Spatie backup *usually* uses two-character locales, but pt-BR is an exception $this->assertEquals( 'Mensagem de exceção: MESSAGE', diff --git a/tests/Unit/StatuslabelTest.php b/tests/Unit/StatuslabelTest.php index fe5f3cacc0..e5dbc38244 100644 --- a/tests/Unit/StatuslabelTest.php +++ b/tests/Unit/StatuslabelTest.php @@ -6,37 +6,37 @@ use Tests\TestCase; class StatuslabelTest extends TestCase { - public function testRTDStatuslabelAdd() + public function testRTDStatuslabelAdd(): void { $statuslabel = Statuslabel::factory()->rtd()->create(); $this->assertModelExists($statuslabel); } - public function testPendingStatuslabelAdd() + public function testPendingStatuslabelAdd(): void { $statuslabel = Statuslabel::factory()->pending()->create(); $this->assertModelExists($statuslabel); } - public function testArchivedStatuslabelAdd() + public function testArchivedStatuslabelAdd(): void { $statuslabel = Statuslabel::factory()->archived()->create(); $this->assertModelExists($statuslabel); } - public function testOutForRepairStatuslabelAdd() + public function testOutForRepairStatuslabelAdd(): void { $statuslabel = Statuslabel::factory()->outForRepair()->create(); $this->assertModelExists($statuslabel); } - public function testBrokenStatuslabelAdd() + public function testBrokenStatuslabelAdd(): void { $statuslabel = Statuslabel::factory()->broken()->create(); $this->assertModelExists($statuslabel); } - public function testLostStatuslabelAdd() + public function testLostStatuslabelAdd(): void { $statuslabel = Statuslabel::factory()->lost()->create(); $this->assertModelExists($statuslabel); diff --git a/tests/Unit/UserTest.php b/tests/Unit/UserTest.php index e089fc4023..99e7b322d6 100644 --- a/tests/Unit/UserTest.php +++ b/tests/Unit/UserTest.php @@ -6,7 +6,7 @@ use Tests\TestCase; class UserTest extends TestCase { - public function testFirstNameSplit() + public function testFirstNameSplit(): void { $fullname = "Natalia Allanovna Romanova-O'Shostakova"; $expected_firstname = 'Natalia'; @@ -16,7 +16,7 @@ class UserTest extends TestCase $this->assertEquals($expected_lastname, $user['last_name']); } - public function testFirstName() + public function testFirstName(): void { $fullname = "Natalia Allanovna Romanova-O'Shostakova"; $expected_username = 'natalia'; @@ -24,7 +24,7 @@ class UserTest extends TestCase $this->assertEquals($expected_username, $user['username']); } - public function testFirstNameDotLastName() + public function testFirstNameDotLastName(): void { $fullname = "Natalia Allanovna Romanova-O'Shostakova"; $expected_username = 'natalia.allanovna-romanova-oshostakova'; @@ -32,7 +32,7 @@ class UserTest extends TestCase $this->assertEquals($expected_username, $user['username']); } - public function testLastNameFirstInitial() + public function testLastNameFirstInitial(): void { $fullname = "Natalia Allanovna Romanova-O'Shostakova"; $expected_username = 'allanovna-romanova-oshostakovan'; @@ -40,7 +40,7 @@ class UserTest extends TestCase $this->assertEquals($expected_username, $user['username']); } - public function testFirstInitialLastName() + public function testFirstInitialLastName(): void { $fullname = "Natalia Allanovna Romanova-O'Shostakova"; $expected_username = 'nallanovna-romanova-oshostakova'; @@ -48,7 +48,7 @@ class UserTest extends TestCase $this->assertEquals($expected_username, $user['username']); } - public function testFirstInitialUnderscoreLastName() + public function testFirstInitialUnderscoreLastName(): void { $fullname = "Natalia Allanovna Romanova-O'Shostakova"; $expected_username = 'nallanovna-romanova-oshostakova'; @@ -56,7 +56,7 @@ class UserTest extends TestCase $this->assertEquals($expected_username, $user['username']); } - public function testSingleName() + public function testSingleName(): void { $fullname = 'Natalia'; $expected_username = 'natalia';