Revert "Add return types to test methods"

This reverts commit 83fb6826ee.
This commit is contained in:
Marcus Moore 2024-08-06 13:30:34 -07:00
parent 95516b0343
commit 82e795b642
No known key found for this signature in database
106 changed files with 498 additions and 498 deletions

View file

@ -12,14 +12,14 @@ final class CreateAssetModelsTest extends TestCase
{ {
public function testRequiresPermissionToCreateAssetModel(): void public function testRequiresPermissionToCreateAssetModel()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.models.store')) ->postJson(route('api.models.store'))
->assertForbidden(); ->assertForbidden();
} }
public function testCanCreateAssetModelWithAssetModelType(): void public function testCanCreateAssetModelWithAssetModelType()
{ {
$response = $this->actingAsForApi(User::factory()->superuser()->create()) $response = $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.models.store'), [ ->postJson(route('api.models.store'), [
@ -37,7 +37,7 @@ final class CreateAssetModelsTest extends TestCase
$this->assertEquals('Test AssetModel', $model->name); $this->assertEquals('Test AssetModel', $model->name);
} }
public function testCannotCreateAssetModelWithoutCategory(): void public function testCannotCreateAssetModelWithoutCategory()
{ {
$response = $this->actingAsForApi(User::factory()->superuser()->create()) $response = $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.models.store'), [ ->postJson(route('api.models.store'), [

View file

@ -10,19 +10,19 @@ use Tests\TestCase;
final class IndexAssetModelsTest extends TestCase final class IndexAssetModelsTest extends TestCase
{ {
public function testViewingAssetModelIndexRequiresAuthentication(): void public function testViewingAssetModelIndexRequiresAuthentication()
{ {
$this->getJson(route('api.models.index'))->assertRedirect(); $this->getJson(route('api.models.index'))->assertRedirect();
} }
public function testViewingAssetModelIndexRequiresPermission(): void public function testViewingAssetModelIndexRequiresPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->getJson(route('api.models.index')) ->getJson(route('api.models.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testAssetModelIndexReturnsExpectedAssetModels(): void public function testAssetModelIndexReturnsExpectedAssetModels()
{ {
AssetModel::factory()->count(3)->create(); AssetModel::factory()->count(3)->create();
@ -42,7 +42,7 @@ final class IndexAssetModelsTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
} }
public function testAssetModelIndexSearchReturnsExpectedAssetModels(): void public function testAssetModelIndexSearchReturnsExpectedAssetModels()
{ {
AssetModel::factory()->count(3)->create(); AssetModel::factory()->count(3)->create();
AssetModel::factory()->count(1)->create(['name' => 'Test Model']); AssetModel::factory()->count(1)->create(['name' => 'Test Model']);

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class UpdateAssetModelsTest extends TestCase final class UpdateAssetModelsTest extends TestCase
{ {
public function testRequiresPermissionToEditAssetModel(): void public function testRequiresPermissionToEditAssetModel()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
@ -18,7 +18,7 @@ final class UpdateAssetModelsTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testCanUpdateAssetModelViaPatch(): void public function testCanUpdateAssetModelViaPatch()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
@ -37,7 +37,7 @@ final class UpdateAssetModelsTest extends TestCase
} }
public function testCannotUpdateAssetModelViaPatchWithAccessoryCategory(): void public function testCannotUpdateAssetModelViaPatchWithAccessoryCategory()
{ {
$category = Category::factory()->forAccessories()->create(); $category = Category::factory()->forAccessories()->create();
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
@ -57,7 +57,7 @@ final class UpdateAssetModelsTest extends TestCase
$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated'); $this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');
} }
public function testCannotUpdateAssetModelViaPatchWithLicenseCategory(): void public function testCannotUpdateAssetModelViaPatchWithLicenseCategory()
{ {
$category = Category::factory()->forLicenses()->create(); $category = Category::factory()->forLicenses()->create();
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
@ -77,7 +77,7 @@ final class UpdateAssetModelsTest extends TestCase
$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated'); $this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');
} }
public function testCannotUpdateAssetModelViaPatchWithConsumableCategory(): void public function testCannotUpdateAssetModelViaPatchWithConsumableCategory()
{ {
$category = Category::factory()->forConsumables()->create(); $category = Category::factory()->forConsumables()->create();
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
@ -97,7 +97,7 @@ final class UpdateAssetModelsTest extends TestCase
$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated'); $this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');
} }
public function testCannotUpdateAssetModelViaPatchWithComponentCategory(): void public function testCannotUpdateAssetModelViaPatchWithComponentCategory()
{ {
$category = Category::factory()->forComponents()->create(); $category = Category::factory()->forComponents()->create();
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class CreateAssetModelsTest extends TestCase final class CreateAssetModelsTest extends TestCase
{ {
public function testPermissionRequiredToCreateAssetModel(): void public function testPermissionRequiredToCreateAssetModel()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('models.store'), [ ->post(route('models.store'), [
@ -19,7 +19,7 @@ final class CreateAssetModelsTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanCreateAssetModels(): void public function testUserCanCreateAssetModels()
{ {
$this->assertFalse(AssetModel::where('name', 'Test Model')->exists()); $this->assertFalse(AssetModel::where('name', 'Test Model')->exists());
@ -33,7 +33,7 @@ final class CreateAssetModelsTest extends TestCase
$this->assertTrue(AssetModel::where('name', 'Test Model')->exists()); $this->assertTrue(AssetModel::where('name', 'Test Model')->exists());
} }
public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType(): void public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType()
{ {
$response = $this->actingAs(User::factory()->superuser()->create()) $response = $this->actingAs(User::factory()->superuser()->create())

View file

@ -7,14 +7,14 @@ use Tests\TestCase;
final class IndexAssetModelsTest extends TestCase final class IndexAssetModelsTest extends TestCase
{ {
public function testPermissionRequiredToViewAssetModelList(): void public function testPermissionRequiredToViewAssetModelList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('models.index')) ->get(route('models.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListAssetModels(): void public function testUserCanListAssetModels()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('models.index')) ->get(route('models.index'))

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class UpdateAssetModelsTest extends TestCase final class UpdateAssetModelsTest extends TestCase
{ {
public function testPermissionRequiredToStoreAssetModel(): void public function testPermissionRequiredToStoreAssetModel()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('models.store'), [ ->post(route('models.store'), [
@ -20,7 +20,7 @@ final class UpdateAssetModelsTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanEditAssetModels(): void public function testUserCanEditAssetModels()
{ {
$category = Category::factory()->forAssets()->create(); $category = Category::factory()->forAssets()->create();
$model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]); $model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]);
@ -40,7 +40,7 @@ final class UpdateAssetModelsTest extends TestCase
} }
public function testUserCannotChangeAssetModelCategoryType(): void public function testUserCannotChangeAssetModelCategoryType()
{ {
$category = Category::factory()->forAssets()->create(); $category = Category::factory()->forAssets()->create();
$model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]); $model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]);

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class AssetFilesTest extends TestCase final class AssetFilesTest extends TestCase
{ {
public function testAssetApiAcceptsFileUpload(): void public function testAssetApiAcceptsFileUpload()
{ {
// Upload a file to an asset // Upload a file to an asset
@ -28,7 +28,7 @@ final class AssetFilesTest extends TestCase
->assertOk(); ->assertOk();
} }
public function testAssetApiListsFiles(): void public function testAssetApiListsFiles()
{ {
// List all files on an asset // List all files on an asset
@ -50,7 +50,7 @@ final class AssetFilesTest extends TestCase
]); ]);
} }
public function testAssetApiDownloadsFile(): void public function testAssetApiDownloadsFile()
{ {
// Download a file from an asset // Download a file from an asset
@ -84,7 +84,7 @@ final class AssetFilesTest extends TestCase
->assertOk(); ->assertOk();
} }
public function testAssetApiDeletesFile(): void public function testAssetApiDeletesFile()
{ {
// Delete a file from an asset // Delete a file from an asset

View file

@ -11,7 +11,7 @@ use Tests\TestCase;
final class AssetIndexTest extends TestCase final class AssetIndexTest extends TestCase
{ {
public function testAssetApiIndexReturnsExpectedAssets(): void public function testAssetApiIndexReturnsExpectedAssets()
{ {
Asset::factory()->count(3)->create(); Asset::factory()->count(3)->create();
@ -31,7 +31,7 @@ final class AssetIndexTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
} }
public function testAssetApiIndexReturnsDisplayUpcomingAuditsDue(): void public function testAssetApiIndexReturnsDisplayUpcomingAuditsDue()
{ {
Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->format('Y-m-d')]); Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->format('Y-m-d')]);
@ -47,7 +47,7 @@ final class AssetIndexTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
} }
public function testAssetApiIndexReturnsOverdueForAudit(): void public function testAssetApiIndexReturnsOverdueForAudit()
{ {
Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->subDays(1)->format('Y-m-d')]); Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->subDays(1)->format('Y-m-d')]);
@ -63,7 +63,7 @@ final class AssetIndexTest extends TestCase
} }
public function testAssetApiIndexReturnsDueOrOverdueForAudit(): void public function testAssetApiIndexReturnsDueOrOverdueForAudit()
{ {
Asset::factory()->count(3)->create(['next_audit_date' => Carbon::now()->format('Y-m-d')]); 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')]); Asset::factory()->count(2)->create(['next_audit_date' => Carbon::now()->subDays(1)->format('Y-m-d')]);
@ -81,7 +81,7 @@ final class AssetIndexTest extends TestCase
public function testAssetApiIndexReturnsDueForExpectedCheckin(): void public function testAssetApiIndexReturnsDueForExpectedCheckin()
{ {
Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->format('Y-m-d')]); Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->format('Y-m-d')]);
@ -97,7 +97,7 @@ final class AssetIndexTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
} }
public function testAssetApiIndexReturnsOverdueForExpectedCheckin(): void public function testAssetApiIndexReturnsOverdueForExpectedCheckin()
{ {
Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->subDays(1)->format('Y-m-d')]); Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->subDays(1)->format('Y-m-d')]);
@ -111,7 +111,7 @@ final class AssetIndexTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
} }
public function testAssetApiIndexReturnsDueOrOverdueForExpectedCheckin(): void public function testAssetApiIndexReturnsDueOrOverdueForExpectedCheckin()
{ {
Asset::factory()->count(3)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->subDays(1)->format('Y-m-d')]); 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')]); Asset::factory()->count(2)->create(['assigned_to' => '1', 'expected_checkin' => Carbon::now()->format('Y-m-d')]);
@ -126,7 +126,7 @@ final class AssetIndexTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('rows', 5)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('rows', 5)->etc());
} }
public function testAssetApiIndexAdheresToCompanyScoping(): void public function testAssetApiIndexAdheresToCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class AssetsForSelectListTest extends TestCase final class AssetsForSelectListTest extends TestCase
{ {
public function testAssetsCanBeSearchedForByAssetTag(): void public function testAssetsCanBeSearchedForByAssetTag()
{ {
Asset::factory()->create(['asset_tag' => '0001']); Asset::factory()->create(['asset_tag' => '0001']);
Asset::factory()->create(['asset_tag' => '0002']); Asset::factory()->create(['asset_tag' => '0002']);
@ -25,7 +25,7 @@ final class AssetsForSelectListTest extends TestCase
$this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, '0002'))); $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, '0002')));
} }
public function testAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled(): void public function testAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -9,14 +9,14 @@ use Tests\TestCase;
final class RequestableAssetTest extends TestCase final class RequestableAssetTest extends TestCase
{ {
public function testViewingRequestableAssetsRequiresCorrectPermission(): void public function testViewingRequestableAssetsRequiresCorrectPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->getJson(route('api.assets.requestable')) ->getJson(route('api.assets.requestable'))
->assertForbidden(); ->assertForbidden();
} }
public function testReturnsRequestableAssets(): void public function testReturnsRequestableAssets()
{ {
$requestableAsset = Asset::factory()->requestable()->create(['asset_tag' => 'requestable']); $requestableAsset = Asset::factory()->requestable()->create(['asset_tag' => 'requestable']);
$nonRequestableAsset = Asset::factory()->nonrequestable()->create(['asset_tag' => 'non-requestable']); $nonRequestableAsset = Asset::factory()->nonrequestable()->create(['asset_tag' => 'non-requestable']);
@ -28,7 +28,7 @@ final class RequestableAssetTest extends TestCase
->assertResponseDoesNotContainInRows($nonRequestableAsset, 'asset_tag'); ->assertResponseDoesNotContainInRows($nonRequestableAsset, 'asset_tag');
} }
public function testRequestableAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled(): void public function testRequestableAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -16,14 +16,14 @@ use Tests\TestCase;
final class StoreAssetTest extends TestCase final class StoreAssetTest extends TestCase
{ {
public function testRequiresPermissionToCreateAsset(): void public function testRequiresPermissionToCreateAsset()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.assets.store')) ->postJson(route('api.assets.store'))
->assertForbidden(); ->assertForbidden();
} }
public function testAllAssetAttributesAreStored(): void public function testAllAssetAttributesAreStored()
{ {
$company = Company::factory()->create(); $company = Company::factory()->create();
$location = Location::factory()->create(); $location = Location::factory()->create();
@ -83,7 +83,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals(10, $asset->warranty_months); $this->assertEquals(10, $asset->warranty_months);
} }
public function testSetsLastAuditDateToMidnightOfProvidedDate(): void public function testSetsLastAuditDateToMidnightOfProvidedDate()
{ {
$response = $this->actingAsForApi(User::factory()->superuser()->create()) $response = $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.assets.store'), [ ->postJson(route('api.assets.store'), [
@ -99,7 +99,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals('2023-09-03 00:00:00', $asset->last_audit_date); $this->assertEquals('2023-09-03 00:00:00', $asset->last_audit_date);
} }
public function testLastAuditDateCanBeNull(): void public function testLastAuditDateCanBeNull()
{ {
$response = $this->actingAsForApi(User::factory()->superuser()->create()) $response = $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.assets.store'), [ ->postJson(route('api.assets.store'), [
@ -115,7 +115,7 @@ final class StoreAssetTest extends TestCase
$this->assertNull($asset->last_audit_date); $this->assertNull($asset->last_audit_date);
} }
public function testNonDateUsedForLastAuditDateReturnsValidationError(): void public function testNonDateUsedForLastAuditDateReturnsValidationError()
{ {
$response = $this->actingAsForApi(User::factory()->superuser()->create()) $response = $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.assets.store'), [ ->postJson(route('api.assets.store'), [
@ -129,7 +129,7 @@ final class StoreAssetTest extends TestCase
$this->assertNotNull($response->json('messages.last_audit_date')); $this->assertNotNull($response->json('messages.last_audit_date'));
} }
public function testArchivedDepreciateAndPhysicalCanBeNull(): void public function testArchivedDepreciateAndPhysicalCanBeNull()
{ {
$model = AssetModel::factory()->ipadModel()->create(); $model = AssetModel::factory()->ipadModel()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -154,7 +154,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals(0, $asset->depreciate); $this->assertEquals(0, $asset->depreciate);
} }
public function testArchivedDepreciateAndPhysicalCanBeEmpty(): void public function testArchivedDepreciateAndPhysicalCanBeEmpty()
{ {
$model = AssetModel::factory()->ipadModel()->create(); $model = AssetModel::factory()->ipadModel()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -179,7 +179,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals(0, $asset->depreciate); $this->assertEquals(0, $asset->depreciate);
} }
public function testAssetEolDateIsCalculatedIfPurchaseDateSet(): void public function testAssetEolDateIsCalculatedIfPurchaseDateSet()
{ {
$model = AssetModel::factory()->mbp13Model()->create(); $model = AssetModel::factory()->mbp13Model()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -200,7 +200,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals('2024-01-01', $asset->asset_eol_date); $this->assertEquals('2024-01-01', $asset->asset_eol_date);
} }
public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet(): void public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet()
{ {
$model = AssetModel::factory()->mbp13Model()->create(); $model = AssetModel::factory()->mbp13Model()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -220,7 +220,7 @@ final class StoreAssetTest extends TestCase
$this->assertNull($asset->asset_eol_date); $this->assertNull($asset->asset_eol_date);
} }
public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet(): void public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet()
{ {
$model = AssetModel::factory()->mbp13Model()->create(); $model = AssetModel::factory()->mbp13Model()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -242,7 +242,7 @@ final class StoreAssetTest extends TestCase
$this->assertTrue($asset->eol_explicit); $this->assertTrue($asset->eol_explicit);
} }
public function testAssetGetsAssetTagWithAutoIncrement(): void public function testAssetGetsAssetTagWithAutoIncrement()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -262,7 +262,7 @@ final class StoreAssetTest extends TestCase
$this->assertNotNull($asset->asset_tag); $this->assertNotNull($asset->asset_tag);
} }
public function testAssetCreationFailsWithNoAssetTagOrAutoIncrement(): void public function testAssetCreationFailsWithNoAssetTagOrAutoIncrement()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -278,7 +278,7 @@ final class StoreAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testStoresPeriodAsDecimalSeparatorForPurchaseCost(): void public function testStoresPeriodAsDecimalSeparatorForPurchaseCost()
{ {
$this->settings->set([ $this->settings->set([
'default_currency' => 'USD', 'default_currency' => 'USD',
@ -300,7 +300,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals(12.34, $asset->purchase_cost); $this->assertEquals(12.34, $asset->purchase_cost);
} }
public function testStoresPeriodAsCommaSeparatorForPurchaseCost(): void public function testStoresPeriodAsCommaSeparatorForPurchaseCost()
{ {
$this->settings->set([ $this->settings->set([
'default_currency' => 'EUR', 'default_currency' => 'EUR',
@ -322,7 +322,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals(12.34, $asset->purchase_cost); $this->assertEquals(12.34, $asset->purchase_cost);
} }
public function testUniqueSerialNumbersIsEnforcedWhenEnabled(): void public function testUniqueSerialNumbersIsEnforcedWhenEnabled()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -350,7 +350,7 @@ final class StoreAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testUniqueSerialNumbersIsNotEnforcedWhenDisabled(): void public function testUniqueSerialNumbersIsNotEnforcedWhenDisabled()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -378,7 +378,7 @@ final class StoreAssetTest extends TestCase
->assertStatusMessageIs('success'); ->assertStatusMessageIs('success');
} }
public function testAssetTagsMustBeUniqueWhenUndeleted(): void public function testAssetTagsMustBeUniqueWhenUndeleted()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -405,7 +405,7 @@ final class StoreAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testAssetTagsCanBeDuplicatedIfDeleted(): void public function testAssetTagsCanBeDuplicatedIfDeleted()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -435,7 +435,7 @@ final class StoreAssetTest extends TestCase
->assertStatusMessageIs('success'); ->assertStatusMessageIs('success');
} }
public function testAnAssetCanBeCheckedOutToUserOnStore(): void public function testAnAssetCanBeCheckedOutToUserOnStore()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -461,7 +461,7 @@ final class StoreAssetTest extends TestCase
$this->assertTrue($asset->assignedTo->is($userAssigned)); $this->assertTrue($asset->assignedTo->is($userAssigned));
} }
public function testAnAssetCanBeCheckedOutToLocationOnStore(): void public function testAnAssetCanBeCheckedOutToLocationOnStore()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -487,7 +487,7 @@ final class StoreAssetTest extends TestCase
$this->assertTrue($asset->location->is($location)); $this->assertTrue($asset->location->is($location));
} }
public function testAnAssetCanBeCheckedOutToAssetOnStore(): void public function testAnAssetCanBeCheckedOutToAssetOnStore()
{ {
$model = AssetModel::factory()->create(); $model = AssetModel::factory()->create();
$status = Statuslabel::factory()->create(); $status = Statuslabel::factory()->create();
@ -514,7 +514,7 @@ final class StoreAssetTest extends TestCase
$this->assertTrue($asset->assignedAssets()->find($response['payload']['id'])->is($apiAsset)); $this->assertTrue($asset->assignedAssets()->find($response['payload']['id'])->is($apiAsset));
} }
public function testCompanyIdNeedsToBeInteger(): void public function testCompanyIdNeedsToBeInteger()
{ {
$this->actingAsForApi(User::factory()->createAssets()->create()) $this->actingAsForApi(User::factory()->createAssets()->create())
->postJson(route('api.assets.store'), [ ->postJson(route('api.assets.store'), [
@ -526,7 +526,7 @@ final class StoreAssetTest extends TestCase
}); });
} }
public function testEncryptedCustomFieldCanBeStored(): void public function testEncryptedCustomFieldCanBeStored()
{ {
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
@ -550,7 +550,7 @@ final class StoreAssetTest extends TestCase
$this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()})); $this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()}));
} }
public function testPermissionNeededToStoreEncryptedField(): void public function testPermissionNeededToStoreEncryptedField()
{ {
// @todo: // @todo:
$this->markTestIncomplete(); $this->markTestIncomplete();

View file

@ -15,14 +15,14 @@ use Tests\TestCase;
final class UpdateAssetTest extends TestCase final class UpdateAssetTest extends TestCase
{ {
public function testThatANonExistentAssetIdReturnsError(): void public function testThatANonExistentAssetIdReturnsError()
{ {
$this->actingAsForApi(User::factory()->editAssets()->createAssets()->create()) $this->actingAsForApi(User::factory()->editAssets()->createAssets()->create())
->patchJson(route('api.assets.update', 123456789)) ->patchJson(route('api.assets.update', 123456789))
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testRequiresPermissionToUpdateAsset(): void public function testRequiresPermissionToUpdateAsset()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -31,7 +31,7 @@ final class UpdateAssetTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testGivenPermissionUpdateAssetIsAllowed(): void public function testGivenPermissionUpdateAssetIsAllowed()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -43,7 +43,7 @@ final class UpdateAssetTest extends TestCase
->assertOk(); ->assertOk();
} }
public function testAllAssetAttributesAreStored(): void public function testAllAssetAttributesAreStored()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$user = User::factory()->editAssets()->create(); $user = User::factory()->editAssets()->create();
@ -103,7 +103,7 @@ final class UpdateAssetTest extends TestCase
$this->assertEquals('2023-09-03 00:00:00', $updatedAsset->last_audit_date); $this->assertEquals('2023-09-03 00:00:00', $updatedAsset->last_audit_date);
} }
public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated(): void public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated()
{ {
$asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create(); $asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create();
@ -120,7 +120,7 @@ final class UpdateAssetTest extends TestCase
$this->assertEquals('2024-01-01', $asset->asset_eol_date); $this->assertEquals('2024-01-01', $asset->asset_eol_date);
} }
public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet(): void public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet()
{ {
$asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create(); $asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create();
@ -138,7 +138,7 @@ final class UpdateAssetTest extends TestCase
$this->assertEquals('2022-01-01', $asset->asset_eol_date); $this->assertEquals('2022-01-01', $asset->asset_eol_date);
} }
public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet(): void public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet()
{ {
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -156,7 +156,7 @@ final class UpdateAssetTest extends TestCase
$this->assertTrue($asset->eol_explicit); $this->assertTrue($asset->eol_explicit);
} }
public function testAssetTagCannotUpdateToNullValue(): void public function testAssetTagCannotUpdateToNullValue()
{ {
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -168,7 +168,7 @@ final class UpdateAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testAssetTagCannotUpdateToEmptyStringValue(): void public function testAssetTagCannotUpdateToEmptyStringValue()
{ {
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -180,7 +180,7 @@ final class UpdateAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testModelIdCannotUpdateToNullValue(): void public function testModelIdCannotUpdateToNullValue()
{ {
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -192,7 +192,7 @@ final class UpdateAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testModelIdCannotUpdateToEmptyStringValue(): void public function testModelIdCannotUpdateToEmptyStringValue()
{ {
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -204,7 +204,7 @@ final class UpdateAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testStatusIdCannotUpdateToNullValue(): void public function testStatusIdCannotUpdateToNullValue()
{ {
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -216,7 +216,7 @@ final class UpdateAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testStatusIdCannotUpdateToEmptyStringValue(): void public function testStatusIdCannotUpdateToEmptyStringValue()
{ {
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -228,7 +228,7 @@ final class UpdateAssetTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testIfRtdLocationIdIsSetWithoutLocationIdAssetReturnsToDefault(): void public function testIfRtdLocationIdIsSetWithoutLocationIdAssetReturnsToDefault()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
$asset = Asset::factory()->laptopMbp()->create([ $asset = Asset::factory()->laptopMbp()->create([
@ -247,7 +247,7 @@ final class UpdateAssetTest extends TestCase
$this->assertTrue($asset->location->is($rtdLocation)); $this->assertTrue($asset->location->is($rtdLocation));
} }
public function testIfLocationAndRtdLocationAreSetLocationIdIsLocation(): void public function testIfLocationAndRtdLocationAreSetLocationIdIsLocation()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
$asset = Asset::factory()->laptopMbp()->create(); $asset = Asset::factory()->laptopMbp()->create();
@ -265,7 +265,7 @@ final class UpdateAssetTest extends TestCase
$this->assertTrue($asset->location->is($location)); $this->assertTrue($asset->location->is($location));
} }
public function testEncryptedCustomFieldCanBeUpdated(): void public function testEncryptedCustomFieldCanBeUpdated()
{ {
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
@ -284,7 +284,7 @@ final class UpdateAssetTest extends TestCase
$this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()})); $this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()}));
} }
public function testPermissionNeededToUpdateEncryptedField(): void public function testPermissionNeededToUpdateEncryptedField()
{ {
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
@ -308,7 +308,7 @@ final class UpdateAssetTest extends TestCase
$this->assertEquals("encrypted value should not change", Crypt::decrypt($asset->{$field->db_column_name()})); $this->assertEquals("encrypted value should not change", Crypt::decrypt($asset->{$field->db_column_name()}));
} }
public function testCheckoutToUserOnAssetUpdate(): void public function testCheckoutToUserOnAssetUpdate()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$user = User::factory()->editAssets()->create(); $user = User::factory()->editAssets()->create();
@ -327,7 +327,7 @@ final class UpdateAssetTest extends TestCase
$this->assertEquals($asset->assigned_type, 'App\Models\User'); $this->assertEquals($asset->assigned_type, 'App\Models\User');
} }
public function testCheckoutToDeletedUserFailsOnAssetUpdate(): void public function testCheckoutToDeletedUserFailsOnAssetUpdate()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$user = User::factory()->editAssets()->create(); $user = User::factory()->editAssets()->create();
@ -346,7 +346,7 @@ final class UpdateAssetTest extends TestCase
$this->assertNull($asset->assigned_type); $this->assertNull($asset->assigned_type);
} }
public function testCheckoutToLocationOnAssetUpdate(): void public function testCheckoutToLocationOnAssetUpdate()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$user = User::factory()->editAssets()->create(); $user = User::factory()->editAssets()->create();
@ -366,7 +366,7 @@ final class UpdateAssetTest extends TestCase
} }
public function testCheckoutToDeletedLocationFailsOnAssetUpdate(): void public function testCheckoutToDeletedLocationFailsOnAssetUpdate()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$user = User::factory()->editAssets()->create(); $user = User::factory()->editAssets()->create();
@ -385,7 +385,7 @@ final class UpdateAssetTest extends TestCase
$this->assertNull($asset->assigned_type); $this->assertNull($asset->assigned_type);
} }
public function testCheckoutAssetOnAssetUpdate(): void public function testCheckoutAssetOnAssetUpdate()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$user = User::factory()->editAssets()->create(); $user = User::factory()->editAssets()->create();
@ -406,7 +406,7 @@ final class UpdateAssetTest extends TestCase
} }
public function testCheckoutToDeletedAssetFailsOnAssetUpdate(): void public function testCheckoutToDeletedAssetFailsOnAssetUpdate()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$user = User::factory()->editAssets()->create(); $user = User::factory()->editAssets()->create();
@ -425,7 +425,7 @@ final class UpdateAssetTest extends TestCase
$this->assertNull($asset->assigned_type); $this->assertNull($asset->assigned_type);
} }
public function testAssetCannotBeUpdatedByUserInSeparateCompany(): void public function testAssetCannotBeUpdatedByUserInSeparateCompany()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class BulkDeleteAssetsTest extends TestCase final class BulkDeleteAssetsTest extends TestCase
{ {
public function testUserWithPermissionsCanAccessPage(): void public function testUserWithPermissionsCanAccessPage()
{ {
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
$assets = Asset::factory()->count(2)->create(); $assets = Asset::factory()->count(2)->create();
@ -25,7 +25,7 @@ final class BulkDeleteAssetsTest extends TestCase
])->assertStatus(200); ])->assertStatus(200);
} }
public function testStandardUserCannotAccessPage(): void public function testStandardUserCannotAccessPage()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$assets = Asset::factory()->count(2)->create(); $assets = Asset::factory()->count(2)->create();
@ -38,7 +38,7 @@ final class BulkDeleteAssetsTest extends TestCase
])->assertStatus(403); ])->assertStatus(403);
} }
public function testPageRedirectFromInterstitialIfNoAssetsSelectedToDelete(): void public function testPageRedirectFromInterstitialIfNoAssetsSelectedToDelete()
{ {
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
$response = $this->actingAs($user) $response = $this->actingAs($user)
@ -52,7 +52,7 @@ final class BulkDeleteAssetsTest extends TestCase
$this->followRedirects($response)->assertSee('alert-danger'); $this->followRedirects($response)->assertSee('alert-danger');
} }
public function testPageRedirectFromInterstitialIfNoAssetsSelectedToRestore(): void public function testPageRedirectFromInterstitialIfNoAssetsSelectedToRestore()
{ {
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
$response = $this->actingAs($user) $response = $this->actingAs($user)
@ -68,7 +68,7 @@ final class BulkDeleteAssetsTest extends TestCase
} }
public function testBulkDeleteSelectedAssetsFromInterstitial(): void public function testBulkDeleteSelectedAssetsFromInterstitial()
{ {
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
$assets = Asset::factory()->count(2)->create(); $assets = Asset::factory()->count(2)->create();
@ -89,7 +89,7 @@ final class BulkDeleteAssetsTest extends TestCase
$this->followRedirects($response)->assertSee('alert-success'); $this->followRedirects($response)->assertSee('alert-success');
} }
public function testBulkRestoreSelectedAssetsFromInterstitial(): void public function testBulkRestoreSelectedAssetsFromInterstitial()
{ {
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
$asset = Asset::factory()->deleted()->create(); $asset = Asset::factory()->deleted()->create();
@ -116,7 +116,7 @@ final class BulkDeleteAssetsTest extends TestCase
} }
public function testActionLogCreatedUponBulkDelete(): void public function testActionLogCreatedUponBulkDelete()
{ {
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -139,7 +139,7 @@ final class BulkDeleteAssetsTest extends TestCase
); );
} }
public function testActionLogCreatedUponBulkRestore(): void public function testActionLogCreatedUponBulkRestore()
{ {
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
$asset = Asset::factory()->deleted()->create(); $asset = Asset::factory()->deleted()->create();

View file

@ -14,7 +14,7 @@ use Tests\TestCase;
final class BulkEditAssetsTest extends TestCase final class BulkEditAssetsTest extends TestCase
{ {
public function testUserWithPermissionsCanAccessPage(): void public function testUserWithPermissionsCanAccessPage()
{ {
$user = User::factory()->viewAssets()->editAssets()->create(); $user = User::factory()->viewAssets()->editAssets()->create();
$assets = Asset::factory()->count(2)->create(); $assets = Asset::factory()->count(2)->create();
@ -29,7 +29,7 @@ final class BulkEditAssetsTest extends TestCase
])->assertStatus(200); ])->assertStatus(200);
} }
public function testStandardUserCannotAccessPage(): void public function testStandardUserCannotAccessPage()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$assets = Asset::factory()->count(2)->create(); $assets = Asset::factory()->count(2)->create();
@ -44,7 +44,7 @@ final class BulkEditAssetsTest extends TestCase
])->assertStatus(403); ])->assertStatus(403);
} }
public function testBulkEditAssetsAcceptsAllPossibleAttributes(): void public function testBulkEditAssetsAcceptsAllPossibleAttributes()
{ {
// sets up all needed models and attributes on the assets // 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 // this test does not deal with custom fields - will be dealt with in separate cases
@ -109,7 +109,7 @@ final class BulkEditAssetsTest extends TestCase
}); });
} }
public function testBulkEditAssetsAcceptsAndUpdatesUnencryptedCustomFields(): void public function testBulkEditAssetsAcceptsAndUpdatesUnencryptedCustomFields()
{ {
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
@ -141,7 +141,7 @@ final class BulkEditAssetsTest extends TestCase
}); });
} }
public function testBulkEditAssetsAcceptsAndUpdatesEncryptedCustomFields(): void public function testBulkEditAssetsAcceptsAndUpdatesEncryptedCustomFields()
{ {
$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL'); $this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');
@ -165,7 +165,7 @@ final class BulkEditAssetsTest extends TestCase
}); });
} }
public function testBulkEditAssetsRequiresAdminUserToUpdateEncryptedCustomFields(): void public function testBulkEditAssetsRequiresAdminUserToUpdateEncryptedCustomFields()
{ {
$this->markIncompleteIfMySQL('Custom Fields tests do not work on mysql'); $this->markIncompleteIfMySQL('Custom Fields tests do not work on mysql');
$edit_user = User::factory()->editAssets()->create(); $edit_user = User::factory()->editAssets()->create();

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class CloneAssetTest extends TestCase final class CloneAssetTest extends TestCase
{ {
public function testPermissionRequiredToCreateAssetModel(): void public function testPermissionRequiredToCreateAssetModel()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
@ -24,7 +24,7 @@ final class CloneAssetTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
} }
public function testAssetCanBeCloned(): void public function testAssetCanBeCloned()
{ {
$asset_to_clone = Asset::factory()->create(['name'=>'Asset to clone']); $asset_to_clone = Asset::factory()->create(['name'=>'Asset to clone']);
$this->actingAs(User::factory()->createAssets()->create()) $this->actingAs(User::factory()->createAssets()->create())

View file

@ -11,7 +11,7 @@ use Tests\TestCase;
final class EditAssetTest extends TestCase final class EditAssetTest extends TestCase
{ {
public function testPermissionRequiredToViewLicense(): void public function testPermissionRequiredToViewLicense()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
@ -27,7 +27,7 @@ final class EditAssetTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
} }
public function testAssetEditPostIsRedirectedIfRedirectSelectionIsIndex(): void public function testAssetEditPostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
@ -45,7 +45,7 @@ final class EditAssetTest extends TestCase
->assertRedirect(route('hardware.index')); ->assertRedirect(route('hardware.index'));
$this->assertDatabaseHas('assets', ['asset_tag' => 'New Asset Tag']); $this->assertDatabaseHas('assets', ['asset_tag' => 'New Asset Tag']);
} }
public function testAssetEditPostIsRedirectedIfRedirectSelectionIsItem(): void public function testAssetEditPostIsRedirectedIfRedirectSelectionIsItem()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();

View file

@ -13,14 +13,14 @@ final class CreateCategoriesTest extends TestCase
{ {
public function testRequiresPermissionToCreateCategory(): void public function testRequiresPermissionToCreateCategory()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.categories.store')) ->postJson(route('api.categories.store'))
->assertForbidden(); ->assertForbidden();
} }
public function testCanCreateCategoryWithValidCategoryType(): void public function testCanCreateCategoryWithValidCategoryType()
{ {
$response = $this->actingAsForApi(User::factory()->superuser()->create()) $response = $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.categories.store'), [ ->postJson(route('api.categories.store'), [
@ -41,7 +41,7 @@ final class CreateCategoriesTest extends TestCase
$this->assertEquals('accessory', $category->category_type); $this->assertEquals('accessory', $category->category_type);
} }
public function testCannotCreateCategoryWithoutCategoryType(): void public function testCannotCreateCategoryWithoutCategoryType()
{ {
$response = $this->actingAsForApi(User::factory()->superuser()->create()) $response = $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.categories.store'), [ ->postJson(route('api.categories.store'), [
@ -59,7 +59,7 @@ final class CreateCategoriesTest extends TestCase
} }
public function testCannotCreateCategoryWithInvalidCategoryType(): void public function testCannotCreateCategoryWithInvalidCategoryType()
{ {
$this->actingAsForApi(User::factory()->superuser()->create()) $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.categories.store'), [ ->postJson(route('api.categories.store'), [

View file

@ -10,14 +10,14 @@ use Tests\TestCase;
final class IndexCategoriesTest extends TestCase final class IndexCategoriesTest extends TestCase
{ {
public function testViewingCategoryIndexRequiresPermission(): void public function testViewingCategoryIndexRequiresPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->getJson(route('api.departments.index')) ->getJson(route('api.departments.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testCategoryIndexReturnsExpectedSearchResults(): void public function testCategoryIndexReturnsExpectedSearchResults()
{ {
Category::factory()->count(10)->create(); Category::factory()->count(10)->create();
Category::factory()->count(1)->forAssets()->create(['name' => 'My Test Category']); Category::factory()->count(1)->forAssets()->create(['name' => 'My Test Category']);
@ -43,7 +43,7 @@ final class IndexCategoriesTest extends TestCase
} }
public function testCategoryIndexReturnsExpectedCategories(): void public function testCategoryIndexReturnsExpectedCategories()
{ {
$this->markTestIncomplete('Not sure why the category factory is generating one more than expected here.'); $this->markTestIncomplete('Not sure why the category factory is generating one more than expected here.');
Category::factory()->count(3)->create(); Category::factory()->count(3)->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class UpdateCategoriesTest extends TestCase final class UpdateCategoriesTest extends TestCase
{ {
public function testCanUpdateCategoryViaPatchWithoutCategoryType(): void public function testCanUpdateCategoryViaPatchWithoutCategoryType()
{ {
$category = Category::factory()->create(); $category = Category::factory()->create();
@ -30,7 +30,7 @@ final class UpdateCategoriesTest extends TestCase
} }
public function testCannotUpdateCategoryViaPatchWithCategoryType(): void public function testCannotUpdateCategoryViaPatchWithCategoryType()
{ {
$category = Category::factory()->create(); $category = Category::factory()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class CreateCategoriesTest extends TestCase final class CreateCategoriesTest extends TestCase
{ {
public function testPermissionRequiredToCreateCategories(): void public function testPermissionRequiredToCreateCategories()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('categories.store'), [ ->post(route('categories.store'), [
@ -19,7 +19,7 @@ final class CreateCategoriesTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanCreateCategories(): void public function testUserCanCreateCategories()
{ {
$this->assertFalse(Category::where('name', 'Test Category')->exists()); $this->assertFalse(Category::where('name', 'Test Category')->exists());
@ -33,7 +33,7 @@ final class CreateCategoriesTest extends TestCase
$this->assertTrue(Category::where('name', 'Test Category')->exists()); $this->assertTrue(Category::where('name', 'Test Category')->exists());
} }
public function testUserCannotCreateCategoriesWithInvalidType(): void public function testUserCannotCreateCategoriesWithInvalidType()
{ {
$this->assertFalse(Category::where('name', 'Test Category')->exists()); $this->assertFalse(Category::where('name', 'Test Category')->exists());

View file

@ -7,14 +7,14 @@ use Tests\TestCase;
final class IndexCategoriesTest extends TestCase final class IndexCategoriesTest extends TestCase
{ {
public function testPermissionRequiredToViewCategoryList(): void public function testPermissionRequiredToViewCategoryList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('categories.index')) ->get(route('categories.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListCategories(): void public function testUserCanListCategories()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('categories.index')) ->get(route('categories.index'))

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class UpdateCategoriesTest extends TestCase final class UpdateCategoriesTest extends TestCase
{ {
public function testPermissionRequiredToStoreCategory(): void public function testPermissionRequiredToStoreCategory()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('categories.store'), [ ->post(route('categories.store'), [
@ -20,7 +20,7 @@ final class UpdateCategoriesTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanCreateCategories(): void public function testUserCanCreateCategories()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->post(route('categories.store'), [ ->post(route('categories.store'), [
@ -34,7 +34,7 @@ final class UpdateCategoriesTest extends TestCase
$this->assertTrue(Category::where('name', 'Test Category')->exists()); $this->assertTrue(Category::where('name', 'Test Category')->exists());
} }
public function testUserCanEditAssetCategory(): void public function testUserCanEditAssetCategory()
{ {
$category = Category::factory()->forAssets()->create(['name' => 'Test Category']); $category = Category::factory()->forAssets()->create(['name' => 'Test Category']);
$this->assertTrue(Category::where('name', 'Test Category')->exists()); $this->assertTrue(Category::where('name', 'Test Category')->exists());
@ -52,7 +52,7 @@ final class UpdateCategoriesTest extends TestCase
} }
public function testUserCanChangeCategoryTypeIfNoAssetsAssociated(): void public function testUserCanChangeCategoryTypeIfNoAssetsAssociated()
{ {
$category = Category::factory()->forAssets()->create(['name' => 'Test Category']); $category = Category::factory()->forAssets()->create(['name' => 'Test Category']);
$this->assertTrue(Category::where('name', 'Test Category')->exists()); $this->assertTrue(Category::where('name', 'Test Category')->exists());
@ -72,7 +72,7 @@ final class UpdateCategoriesTest extends TestCase
} }
public function testUserCannotChangeCategoryTypeIfAssetsAreAssociated(): void public function testUserCannotChangeCategoryTypeIfAssetsAreAssociated()
{ {
Asset::factory()->count(5)->laptopMbp()->create(); Asset::factory()->count(5)->laptopMbp()->create();
$category = Category::where('name', 'Laptops')->first(); $category = Category::where('name', 'Laptops')->first();

View file

@ -15,28 +15,28 @@ use Tests\TestCase;
final class AssetCheckinTest extends TestCase final class AssetCheckinTest extends TestCase
{ {
public function testCheckingInAssetRequiresCorrectPermission(): void public function testCheckingInAssetRequiresCorrectPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create())) ->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()))
->assertForbidden(); ->assertForbidden();
} }
public function testCannotCheckInNonExistentAsset(): void public function testCannotCheckInNonExistentAsset()
{ {
$this->actingAsForApi(User::factory()->checkinAssets()->create()) $this->actingAsForApi(User::factory()->checkinAssets()->create())
->postJson(route('api.asset.checkin', ['id' => 'does-not-exist'])) ->postJson(route('api.asset.checkin', ['id' => 'does-not-exist']))
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testCannotCheckInAssetThatIsNotCheckedOut(): void public function testCannotCheckInAssetThatIsNotCheckedOut()
{ {
$this->actingAsForApi(User::factory()->checkinAssets()->create()) $this->actingAsForApi(User::factory()->checkinAssets()->create())
->postJson(route('api.asset.checkin', Asset::factory()->create()->id)) ->postJson(route('api.asset.checkin', Asset::factory()->create()->id))
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testAssetCanBeCheckedIn(): void public function testAssetCanBeCheckedIn()
{ {
Event::fake([CheckoutableCheckedIn::class]); Event::fake([CheckoutableCheckedIn::class]);
@ -76,7 +76,7 @@ final class AssetCheckinTest extends TestCase
}, 1); }, 1);
} }
public function testLocationIsSetToRTDLocationByDefaultUponCheckin(): void public function testLocationIsSetToRTDLocationByDefaultUponCheckin()
{ {
$rtdLocation = Location::factory()->create(); $rtdLocation = Location::factory()->create();
$asset = Asset::factory()->assignedToUser()->create([ $asset = Asset::factory()->assignedToUser()->create([
@ -90,7 +90,7 @@ final class AssetCheckinTest extends TestCase
$this->assertTrue($asset->refresh()->location()->is($rtdLocation)); $this->assertTrue($asset->refresh()->location()->is($rtdLocation));
} }
public function testDefaultLocationCanBeUpdatedUponCheckin(): void public function testDefaultLocationCanBeUpdatedUponCheckin()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
@ -104,7 +104,7 @@ final class AssetCheckinTest extends TestCase
$this->assertTrue($asset->refresh()->defaultLoc()->is($location)); $this->assertTrue($asset->refresh()->defaultLoc()->is($location));
} }
public function testAssetsLicenseSeatsAreClearedUponCheckin(): void public function testAssetsLicenseSeatsAreClearedUponCheckin()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
LicenseSeat::factory()->assignedToUser()->for($asset)->create(); LicenseSeat::factory()->assignedToUser()->for($asset)->create();
@ -117,7 +117,7 @@ final class AssetCheckinTest extends TestCase
$this->assertNull($asset->refresh()->licenseseats->first()->assigned_to); $this->assertNull($asset->refresh()->licenseseats->first()->assigned_to);
} }
public function testLegacyLocationValuesSetToZeroAreUpdated(): void public function testLegacyLocationValuesSetToZeroAreUpdated()
{ {
$asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([ $asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([
'rtd_location_id' => 0, 'rtd_location_id' => 0,
@ -131,7 +131,7 @@ final class AssetCheckinTest extends TestCase
$this->assertEquals($asset->location_id, $asset->rtd_location_id); $this->assertEquals($asset->location_id, $asset->rtd_location_id);
} }
public function testPendingCheckoutAcceptancesAreClearedUponCheckin(): void public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
@ -143,7 +143,7 @@ final class AssetCheckinTest extends TestCase
$this->assertFalse($acceptance->exists(), 'Acceptance was not deleted'); $this->assertFalse($acceptance->exists(), 'Acceptance was not deleted');
} }
public function testCheckinTimeAndActionLogNoteCanBeSet(): void public function testCheckinTimeAndActionLogNoteCanBeSet()
{ {
Event::fake(); Event::fake();

View file

@ -12,7 +12,7 @@ use Tests\TestCase;
final class AccessoryCheckinTest extends TestCase final class AccessoryCheckinTest extends TestCase
{ {
public function testCheckingInAccessoryRequiresCorrectPermission(): void public function testCheckingInAccessoryRequiresCorrectPermission()
{ {
$accessory = Accessory::factory()->checkedOutToUser()->create(); $accessory = Accessory::factory()->checkedOutToUser()->create();
@ -21,7 +21,7 @@ final class AccessoryCheckinTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testAccessoryCanBeCheckedIn(): void public function testAccessoryCanBeCheckedIn()
{ {
Event::fake([CheckoutableCheckedIn::class]); Event::fake([CheckoutableCheckedIn::class]);
@ -38,7 +38,7 @@ final class AccessoryCheckinTest extends TestCase
Event::assertDispatched(CheckoutableCheckedIn::class, 1); Event::assertDispatched(CheckoutableCheckedIn::class, 1);
} }
public function testEmailSentToUserIfSettingEnabled(): void public function testEmailSentToUserIfSettingEnabled()
{ {
Notification::fake(); Notification::fake();
@ -62,7 +62,7 @@ final class AccessoryCheckinTest extends TestCase
); );
} }
public function testEmailNotSentToUserIfSettingDisabled(): void public function testEmailNotSentToUserIfSettingDisabled()
{ {
Notification::fake(); Notification::fake();

View file

@ -15,7 +15,7 @@ use Tests\TestCase;
final class AssetCheckinTest extends TestCase final class AssetCheckinTest extends TestCase
{ {
public function testCheckingInAssetRequiresCorrectPermission(): void public function testCheckingInAssetRequiresCorrectPermission()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('hardware.checkin.store', [ ->post(route('hardware.checkin.store', [
@ -24,7 +24,7 @@ final class AssetCheckinTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testCannotCheckInAssetThatIsNotCheckedOut(): void public function testCannotCheckInAssetThatIsNotCheckedOut()
{ {
$this->actingAs(User::factory()->checkinAssets()->create()) $this->actingAs(User::factory()->checkinAssets()->create())
->post(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id])) ->post(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id]))
@ -33,7 +33,7 @@ final class AssetCheckinTest extends TestCase
->assertRedirect(route('hardware.index')); ->assertRedirect(route('hardware.index'));
} }
public function testCannotStoreAssetCheckinThatIsNotCheckedOut(): void public function testCannotStoreAssetCheckinThatIsNotCheckedOut()
{ {
$this->actingAs(User::factory()->checkinAssets()->create()) $this->actingAs(User::factory()->checkinAssets()->create())
->get(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id])) ->get(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id]))
@ -42,7 +42,7 @@ final class AssetCheckinTest extends TestCase
->assertRedirect(route('hardware.index')); ->assertRedirect(route('hardware.index'));
} }
public function testAssetCanBeCheckedIn(): void public function testAssetCanBeCheckedIn()
{ {
Event::fake([CheckoutableCheckedIn::class]); Event::fake([CheckoutableCheckedIn::class]);
@ -85,7 +85,7 @@ final class AssetCheckinTest extends TestCase
}, 1); }, 1);
} }
public function testLocationIsSetToRTDLocationByDefaultUponCheckin(): void public function testLocationIsSetToRTDLocationByDefaultUponCheckin()
{ {
$rtdLocation = Location::factory()->create(); $rtdLocation = Location::factory()->create();
$asset = Asset::factory()->assignedToUser()->create([ $asset = Asset::factory()->assignedToUser()->create([
@ -99,7 +99,7 @@ final class AssetCheckinTest extends TestCase
$this->assertTrue($asset->refresh()->location()->is($rtdLocation)); $this->assertTrue($asset->refresh()->location()->is($rtdLocation));
} }
public function testDefaultLocationCanBeUpdatedUponCheckin(): void public function testDefaultLocationCanBeUpdatedUponCheckin()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
@ -113,7 +113,7 @@ final class AssetCheckinTest extends TestCase
$this->assertTrue($asset->refresh()->defaultLoc()->is($location)); $this->assertTrue($asset->refresh()->defaultLoc()->is($location));
} }
public function testAssetsLicenseSeatsAreClearedUponCheckin(): void public function testAssetsLicenseSeatsAreClearedUponCheckin()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
LicenseSeat::factory()->assignedToUser()->for($asset)->create(); LicenseSeat::factory()->assignedToUser()->for($asset)->create();
@ -126,7 +126,7 @@ final class AssetCheckinTest extends TestCase
$this->assertNull($asset->refresh()->licenseseats->first()->assigned_to); $this->assertNull($asset->refresh()->licenseseats->first()->assigned_to);
} }
public function testLegacyLocationValuesSetToZeroAreUpdated(): void public function testLegacyLocationValuesSetToZeroAreUpdated()
{ {
$asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([ $asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([
'rtd_location_id' => 0, 'rtd_location_id' => 0,
@ -140,7 +140,7 @@ final class AssetCheckinTest extends TestCase
$this->assertEquals($asset->location_id, $asset->rtd_location_id); $this->assertEquals($asset->location_id, $asset->rtd_location_id);
} }
public function testPendingCheckoutAcceptancesAreClearedUponCheckin(): void public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
@ -152,7 +152,7 @@ final class AssetCheckinTest extends TestCase
$this->assertFalse($acceptance->exists(), 'Acceptance was not deleted'); $this->assertFalse($acceptance->exists(), 'Acceptance was not deleted');
} }
public function testCheckinTimeAndActionLogNoteCanBeSet(): void public function testCheckinTimeAndActionLogNoteCanBeSet()
{ {
Event::fake([CheckoutableCheckedIn::class]); Event::fake([CheckoutableCheckedIn::class]);
@ -170,7 +170,7 @@ final class AssetCheckinTest extends TestCase
}, 1); }, 1);
} }
public function testAssetCheckinPageIsRedirectedIfModelIsInvalid(): void public function testAssetCheckinPageIsRedirectedIfModelIsInvalid()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
@ -184,7 +184,7 @@ final class AssetCheckinTest extends TestCase
->assertRedirect(route('hardware.show',['hardware' => $asset->id])); ->assertRedirect(route('hardware.show',['hardware' => $asset->id]));
} }
public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid(): void public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
$asset->model_id = 0; $asset->model_id = 0;
@ -197,7 +197,7 @@ final class AssetCheckinTest extends TestCase
->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); ->assertRedirect(route('hardware.show', ['hardware' => $asset->id]));
} }
public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex(): void public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();
@ -210,7 +210,7 @@ final class AssetCheckinTest extends TestCase
->assertRedirect(route('hardware.index')); ->assertRedirect(route('hardware.index'));
} }
public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsItem(): void public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsItem()
{ {
$asset = Asset::factory()->assignedToUser()->create(); $asset = Asset::factory()->assignedToUser()->create();

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class ComponentCheckinTest extends TestCase final class ComponentCheckinTest extends TestCase
{ {
public function testCheckingInComponentRequiresCorrectPermission(): void public function testCheckingInComponentRequiresCorrectPermission()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('components.checkin.store', [ ->post(route('components.checkin.store', [
@ -18,7 +18,7 @@ final class ComponentCheckinTest extends TestCase
} }
public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex(): void public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$component = Component::factory()->checkedOutToAsset()->create(); $component = Component::factory()->checkedOutToAsset()->create();
@ -32,7 +32,7 @@ final class ComponentCheckinTest extends TestCase
->assertRedirect(route('components.index')); ->assertRedirect(route('components.index'));
} }
public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsItem(): void public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsItem()
{ {
$component = Component::factory()->checkedOutToAsset()->create(); $component = Component::factory()->checkedOutToAsset()->create();

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class LicenseCheckinTest extends TestCase final class LicenseCheckinTest extends TestCase
{ {
public function testCheckingInLicenseRequiresCorrectPermission(): void public function testCheckingInLicenseRequiresCorrectPermission()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('licenses.checkin.save', [ ->post(route('licenses.checkin.save', [

View file

@ -16,7 +16,7 @@ final class AccessoryAcceptanceTest extends TestCase
/** /**
* This can be absorbed into a bigger test * This can be absorbed into a bigger test
*/ */
public function testUsersNameIsIncludedInAccessoryAcceptedNotification(): void public function testUsersNameIsIncludedInAccessoryAcceptedNotification()
{ {
Notification::fake(); Notification::fake();
@ -49,7 +49,7 @@ final class AccessoryAcceptanceTest extends TestCase
/** /**
* This can be absorbed into a bigger test * This can be absorbed into a bigger test
*/ */
public function testUsersNameIsIncludedInAccessoryDeclinedNotification(): void public function testUsersNameIsIncludedInAccessoryDeclinedNotification()
{ {
Notification::fake(); Notification::fake();
@ -79,7 +79,7 @@ final class AccessoryAcceptanceTest extends TestCase
); );
} }
public function testUserIsNotAbleToAcceptAnAssetAssignedToADifferentUser(): void public function testUserIsNotAbleToAcceptAnAssetAssignedToADifferentUser()
{ {
Notification::fake(); Notification::fake();

View file

@ -11,14 +11,14 @@ use Tests\TestCase;
final class AccessoryCheckoutTest extends TestCase final class AccessoryCheckoutTest extends TestCase
{ {
public function testCheckingOutAccessoryRequiresCorrectPermission(): void public function testCheckingOutAccessoryRequiresCorrectPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.accessories.checkout', Accessory::factory()->create())) ->postJson(route('api.accessories.checkout', Accessory::factory()->create()))
->assertForbidden(); ->assertForbidden();
} }
public function testValidationWhenCheckingOutAccessory(): void public function testValidationWhenCheckingOutAccessory()
{ {
$this->actingAsForApi(User::factory()->checkoutAccessories()->create()) $this->actingAsForApi(User::factory()->checkoutAccessories()->create())
->postJson(route('api.accessories.checkout', Accessory::factory()->create()), [ ->postJson(route('api.accessories.checkout', Accessory::factory()->create()), [
@ -27,7 +27,7 @@ final class AccessoryCheckoutTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testAccessoryMustBeAvailableWhenCheckingOut(): void public function testAccessoryMustBeAvailableWhenCheckingOut()
{ {
$this->actingAsForApi(User::factory()->checkoutAccessories()->create()) $this->actingAsForApi(User::factory()->checkoutAccessories()->create())
->postJson(route('api.accessories.checkout', Accessory::factory()->withoutItemsRemaining()->create()), [ ->postJson(route('api.accessories.checkout', Accessory::factory()->withoutItemsRemaining()->create()), [
@ -58,7 +58,7 @@ final class AccessoryCheckoutTest extends TestCase
->json(); ->json();
} }
public function testAccessoryCanBeCheckedOutWithoutQty(): void public function testAccessoryCanBeCheckedOutWithoutQty()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
$user = User::factory()->create(); $user = User::factory()->create();
@ -90,7 +90,7 @@ final class AccessoryCheckoutTest extends TestCase
); );
} }
public function testAccessoryCanBeCheckedOutWithQty(): void public function testAccessoryCanBeCheckedOutWithQty()
{ {
$accessory = Accessory::factory()->create(['qty' => 20]); $accessory = Accessory::factory()->create(['qty' => 20]);
$user = User::factory()->create(); $user = User::factory()->create();
@ -124,7 +124,7 @@ final class AccessoryCheckoutTest extends TestCase
); );
} }
public function testAccessoryCannotBeCheckedOutToInvalidUser(): void public function testAccessoryCannotBeCheckedOutToInvalidUser()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
$user = User::factory()->create(); $user = User::factory()->create();
@ -143,7 +143,7 @@ final class AccessoryCheckoutTest extends TestCase
$this->assertFalse($accessory->checkouts()->where('assigned_type', User::class)->where('assigned_to', $user->id)->count() > 0); $this->assertFalse($accessory->checkouts()->where('assigned_type', User::class)->where('assigned_to', $user->id)->count() > 0);
} }
public function testUserSentNotificationUponCheckout(): void public function testUserSentNotificationUponCheckout()
{ {
Notification::fake(); Notification::fake();
@ -159,7 +159,7 @@ final class AccessoryCheckoutTest extends TestCase
Notification::assertSentTo($user, CheckoutAccessoryNotification::class); Notification::assertSentTo($user, CheckoutAccessoryNotification::class);
} }
public function testActionLogCreatedUponCheckout(): void public function testActionLogCreatedUponCheckout()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
$actor = User::factory()->checkoutAccessories()->create(); $actor = User::factory()->checkoutAccessories()->create();

View file

@ -21,7 +21,7 @@ final class AssetCheckoutTest extends TestCase
Event::fake([CheckoutableCheckedOut::class]); Event::fake([CheckoutableCheckedOut::class]);
} }
public function testCheckingOutAssetRequiresCorrectPermission(): void public function testCheckingOutAssetRequiresCorrectPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.asset.checkout', Asset::factory()->create()), [ ->postJson(route('api.asset.checkout', Asset::factory()->create()), [
@ -31,7 +31,7 @@ final class AssetCheckoutTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testNonExistentAssetCannotBeCheckedOut(): void public function testNonExistentAssetCannotBeCheckedOut()
{ {
$this->actingAsForApi(User::factory()->checkoutAssets()->create()) $this->actingAsForApi(User::factory()->checkoutAssets()->create())
->postJson(route('api.asset.checkout', 1000), [ ->postJson(route('api.asset.checkout', 1000), [
@ -41,7 +41,7 @@ final class AssetCheckoutTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testAssetNotAvailableForCheckoutCannotBeCheckedOut(): void public function testAssetNotAvailableForCheckoutCannotBeCheckedOut()
{ {
$assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create(); $assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create();
@ -53,7 +53,7 @@ final class AssetCheckoutTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testAssetCannotBeCheckedOutToItself(): void public function testAssetCannotBeCheckedOutToItself()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -65,7 +65,7 @@ final class AssetCheckoutTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testValidationWhenCheckingOutAsset(): void public function testValidationWhenCheckingOutAsset()
{ {
$this->actingAsForApi(User::factory()->checkoutAssets()->create()) $this->actingAsForApi(User::factory()->checkoutAssets()->create())
->postJson(route('api.asset.checkout', Asset::factory()->create()), []) ->postJson(route('api.asset.checkout', Asset::factory()->create()), [])
@ -74,7 +74,7 @@ final class AssetCheckoutTest extends TestCase
Event::assertNotDispatched(CheckoutableCheckedOut::class); Event::assertNotDispatched(CheckoutableCheckedOut::class);
} }
public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled(): void public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled()
{ {
$this->markTestIncomplete('This is not implemented'); $this->markTestIncomplete('This is not implemented');
} }
@ -150,7 +150,7 @@ final class AssetCheckoutTest extends TestCase
} }
#[DataProvider('checkoutTargets')] #[DataProvider('checkoutTargets')]
public function testAssetCanBeCheckedOut($data): void public function testAssetCanBeCheckedOut($data)
{ {
['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data(); ['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data();
@ -192,12 +192,12 @@ final class AssetCheckoutTest extends TestCase
}); });
} }
public function testLicenseSeatsAreAssignedToUserUponCheckout(): void public function testLicenseSeatsAreAssignedToUserUponCheckout()
{ {
$this->markTestIncomplete('This is not implemented'); $this->markTestIncomplete('This is not implemented');
} }
public function testLastCheckoutUsesCurrentDateIfNotProvided(): void public function testLastCheckoutUsesCurrentDateIfNotProvided()
{ {
$asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]); $asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]);

View file

@ -11,14 +11,14 @@ use Tests\TestCase;
final class ConsumableCheckoutTest extends TestCase final class ConsumableCheckoutTest extends TestCase
{ {
public function testCheckingOutConsumableRequiresCorrectPermission(): void public function testCheckingOutConsumableRequiresCorrectPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.consumables.checkout', Consumable::factory()->create())) ->postJson(route('api.consumables.checkout', Consumable::factory()->create()))
->assertForbidden(); ->assertForbidden();
} }
public function testValidationWhenCheckingOutConsumable(): void public function testValidationWhenCheckingOutConsumable()
{ {
$this->actingAsForApi(User::factory()->checkoutConsumables()->create()) $this->actingAsForApi(User::factory()->checkoutConsumables()->create())
->postJson(route('api.consumables.checkout', Consumable::factory()->create()), [ ->postJson(route('api.consumables.checkout', Consumable::factory()->create()), [
@ -27,7 +27,7 @@ final class ConsumableCheckoutTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testConsumableMustBeAvailableWhenCheckingOut(): void public function testConsumableMustBeAvailableWhenCheckingOut()
{ {
$this->actingAsForApi(User::factory()->checkoutConsumables()->create()) $this->actingAsForApi(User::factory()->checkoutConsumables()->create())
->postJson(route('api.consumables.checkout', Consumable::factory()->withoutItemsRemaining()->create()), [ ->postJson(route('api.consumables.checkout', Consumable::factory()->withoutItemsRemaining()->create()), [
@ -36,7 +36,7 @@ final class ConsumableCheckoutTest extends TestCase
->assertStatusMessageIs('error'); ->assertStatusMessageIs('error');
} }
public function testConsumableCanBeCheckedOut(): void public function testConsumableCanBeCheckedOut()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
$user = User::factory()->create(); $user = User::factory()->create();
@ -49,7 +49,7 @@ final class ConsumableCheckoutTest extends TestCase
$this->assertTrue($user->consumables->contains($consumable)); $this->assertTrue($user->consumables->contains($consumable));
} }
public function testUserSentNotificationUponCheckout(): void public function testUserSentNotificationUponCheckout()
{ {
Notification::fake(); Notification::fake();
@ -65,7 +65,7 @@ final class ConsumableCheckoutTest extends TestCase
Notification::assertSentTo($user, CheckoutConsumableNotification::class); Notification::assertSentTo($user, CheckoutConsumableNotification::class);
} }
public function testActionLogCreatedUponCheckout(): void public function testActionLogCreatedUponCheckout()
{$consumable = Consumable::factory()->create(); {$consumable = Consumable::factory()->create();
$actor = User::factory()->checkoutConsumables()->create(); $actor = User::factory()->checkoutConsumables()->create();
$user = User::factory()->create(); $user = User::factory()->create();

View file

@ -13,14 +13,14 @@ use Tests\TestCase;
final class AccessoryCheckoutTest extends TestCase final class AccessoryCheckoutTest extends TestCase
{ {
public function testCheckingOutAccessoryRequiresCorrectPermission(): void public function testCheckingOutAccessoryRequiresCorrectPermission()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('accessories.checkout.store', Accessory::factory()->create())) ->post(route('accessories.checkout.store', Accessory::factory()->create()))
->assertForbidden(); ->assertForbidden();
} }
public function testValidationWhenCheckingOutAccessory(): void public function testValidationWhenCheckingOutAccessory()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
$response = $this->actingAs(User::factory()->superuser()->create()) $response = $this->actingAs(User::factory()->superuser()->create())
@ -35,7 +35,7 @@ final class AccessoryCheckoutTest extends TestCase
$this->followRedirects($response)->assertSee(trans('general.error')); $this->followRedirects($response)->assertSee(trans('general.error'));
} }
public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut(): void public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut()
{ {
$accessory = Accessory::factory()->withoutItemsRemaining()->create(); $accessory = Accessory::factory()->withoutItemsRemaining()->create();
@ -52,7 +52,7 @@ final class AccessoryCheckoutTest extends TestCase
$this->followRedirects($response)->assertSee(trans('general.error')); $this->followRedirects($response)->assertSee(trans('general.error'));
} }
public function testAccessoryCanBeCheckedOutWithoutQuantity(): void public function testAccessoryCanBeCheckedOutWithoutQuantity()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
$user = User::factory()->create(); $user = User::factory()->create();
@ -76,7 +76,7 @@ final class AccessoryCheckoutTest extends TestCase
]); ]);
} }
public function testAccessoryCanBeCheckedOutWithQuantity(): void public function testAccessoryCanBeCheckedOutWithQuantity()
{ {
$accessory = Accessory::factory()->create(['qty'=>5]); $accessory = Accessory::factory()->create(['qty'=>5]);
$user = User::factory()->create(); $user = User::factory()->create();
@ -102,7 +102,7 @@ final class AccessoryCheckoutTest extends TestCase
]); ]);
} }
public function testAccessoryCanBeCheckedOutToLocationWithQuantity(): void public function testAccessoryCanBeCheckedOutToLocationWithQuantity()
{ {
$accessory = Accessory::factory()->create(['qty'=>5]); $accessory = Accessory::factory()->create(['qty'=>5]);
$location = Location::factory()->create(); $location = Location::factory()->create();
@ -128,7 +128,7 @@ final class AccessoryCheckoutTest extends TestCase
]); ]);
} }
public function testAccessoryCanBeCheckedOutToAssetWithQuantity(): void public function testAccessoryCanBeCheckedOutToAssetWithQuantity()
{ {
$accessory = Accessory::factory()->create(['qty'=>5]); $accessory = Accessory::factory()->create(['qty'=>5]);
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -154,7 +154,7 @@ final class AccessoryCheckoutTest extends TestCase
]); ]);
} }
public function testUserSentNotificationUponCheckout(): void public function testUserSentNotificationUponCheckout()
{ {
Notification::fake(); Notification::fake();
@ -171,7 +171,7 @@ final class AccessoryCheckoutTest extends TestCase
Notification::assertSentTo($user, CheckoutAccessoryNotification::class); Notification::assertSentTo($user, CheckoutAccessoryNotification::class);
} }
public function testActionLogCreatedUponCheckout(): void public function testActionLogCreatedUponCheckout()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
$actor = User::factory()->checkoutAccessories()->create(); $actor = User::factory()->checkoutAccessories()->create();
@ -200,7 +200,7 @@ final class AccessoryCheckoutTest extends TestCase
); );
} }
public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
@ -216,7 +216,7 @@ final class AccessoryCheckoutTest extends TestCase
->assertRedirect(route('accessories.index')); ->assertRedirect(route('accessories.index'));
} }
public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
{ {
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();
@ -233,7 +233,7 @@ final class AccessoryCheckoutTest extends TestCase
->assertRedirect(route('accessories.show', ['accessory' => $accessory->id])); ->assertRedirect(route('accessories.show', ['accessory' => $accessory->id]));
} }
public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$accessory = Accessory::factory()->create(); $accessory = Accessory::factory()->create();

View file

@ -24,7 +24,7 @@ final class AssetCheckoutTest extends TestCase
Event::fake([CheckoutableCheckedOut::class]); Event::fake([CheckoutableCheckedOut::class]);
} }
public function testCheckingOutAssetRequiresCorrectPermission(): void public function testCheckingOutAssetRequiresCorrectPermission()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('hardware.checkout.store', Asset::factory()->create()), [ ->post(route('hardware.checkout.store', Asset::factory()->create()), [
@ -34,7 +34,7 @@ final class AssetCheckoutTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testNonExistentAssetCannotBeCheckedOut(): void public function testNonExistentAssetCannotBeCheckedOut()
{ {
$this->actingAs(User::factory()->checkoutAssets()->create()) $this->actingAs(User::factory()->checkoutAssets()->create())
->post(route('hardware.checkout.store', 1000), [ ->post(route('hardware.checkout.store', 1000), [
@ -48,7 +48,7 @@ final class AssetCheckoutTest extends TestCase
Event::assertNotDispatched(CheckoutableCheckedOut::class); Event::assertNotDispatched(CheckoutableCheckedOut::class);
} }
public function testAssetNotAvailableForCheckoutCannotBeCheckedOut(): void public function testAssetNotAvailableForCheckoutCannotBeCheckedOut()
{ {
$assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create(); $assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create();
@ -63,7 +63,7 @@ final class AssetCheckoutTest extends TestCase
Event::assertNotDispatched(CheckoutableCheckedOut::class); Event::assertNotDispatched(CheckoutableCheckedOut::class);
} }
public function testAssetCannotBeCheckedOutToItself(): void public function testAssetCannotBeCheckedOutToItself()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -77,7 +77,7 @@ final class AssetCheckoutTest extends TestCase
Event::assertNotDispatched(CheckoutableCheckedOut::class); Event::assertNotDispatched(CheckoutableCheckedOut::class);
} }
public function testValidationWhenCheckingOutAsset(): void public function testValidationWhenCheckingOutAsset()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('hardware.checkout.store', Asset::factory()->create()), [ ->post(route('hardware.checkout.store', Asset::factory()->create()), [
@ -98,7 +98,7 @@ final class AssetCheckoutTest extends TestCase
Event::assertNotDispatched(CheckoutableCheckedOut::class); Event::assertNotDispatched(CheckoutableCheckedOut::class);
} }
public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled(): void public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -169,7 +169,7 @@ final class AssetCheckoutTest extends TestCase
} }
#[DataProvider('checkoutTargets')] #[DataProvider('checkoutTargets')]
public function testAssetCanBeCheckedOut($data): void public function testAssetCanBeCheckedOut($data)
{ {
['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data(); ['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data();
@ -207,7 +207,7 @@ final class AssetCheckoutTest extends TestCase
}); });
} }
public function testLicenseSeatsAreAssignedToUserUponCheckout(): void public function testLicenseSeatsAreAssignedToUserUponCheckout()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$seat = LicenseSeat::factory()->assignedToAsset($asset)->create(); $seat = LicenseSeat::factory()->assignedToAsset($asset)->create();
@ -224,7 +224,7 @@ final class AssetCheckoutTest extends TestCase
$this->assertTrue($user->fresh()->licenses->contains($seat->license)); $this->assertTrue($user->fresh()->licenses->contains($seat->license));
} }
public function testLastCheckoutUsesCurrentDateIfNotProvided(): void public function testLastCheckoutUsesCurrentDateIfNotProvided()
{ {
$asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]); $asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]);
@ -239,7 +239,7 @@ final class AssetCheckoutTest extends TestCase
$this->assertTrue(Carbon::parse($asset->last_checkout)->diffInSeconds(now()) < 2); $this->assertTrue(Carbon::parse($asset->last_checkout)->diffInSeconds(now()) < 2);
} }
public function testAssetCheckoutPageIsRedirectedIfModelIsInvalid(): void public function testAssetCheckoutPageIsRedirectedIfModelIsInvalid()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -253,7 +253,7 @@ final class AssetCheckoutTest extends TestCase
->assertRedirect(route('hardware.show',['hardware' => $asset->id])); ->assertRedirect(route('hardware.show',['hardware' => $asset->id]));
} }
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -268,7 +268,7 @@ final class AssetCheckoutTest extends TestCase
->assertRedirect(route('hardware.index')); ->assertRedirect(route('hardware.index'));
} }
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -284,7 +284,7 @@ final class AssetCheckoutTest extends TestCase
->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); ->assertRedirect(route('hardware.show', ['hardware' => $asset->id]));
} }
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget(): void public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -301,7 +301,7 @@ final class AssetCheckoutTest extends TestCase
->assertRedirect(route('users.show', ['user' => $user])); ->assertRedirect(route('users.show', ['user' => $user]));
} }
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget(): void public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget()
{ {
$target = Asset::factory()->create(); $target = Asset::factory()->create();
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -318,7 +318,7 @@ final class AssetCheckoutTest extends TestCase
->assertRedirect(route('hardware.show', ['hardware' => $target])); ->assertRedirect(route('hardware.show', ['hardware' => $target]));
} }
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget(): void public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget()
{ {
$target = Location::factory()->create(); $target = Location::factory()->create();
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class ComponentsCheckoutTest extends TestCase final class ComponentsCheckoutTest extends TestCase
{ {
public function testCheckingOutComponentRequiresCorrectPermission(): void public function testCheckingOutComponentRequiresCorrectPermission()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('components.checkout.store', [ ->post(route('components.checkout.store', [
@ -18,7 +18,7 @@ final class ComponentsCheckoutTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$component = Component::factory()->create(); $component = Component::factory()->create();
@ -33,7 +33,7 @@ final class ComponentsCheckoutTest extends TestCase
->assertRedirect(route('components.index')); ->assertRedirect(route('components.index'));
} }
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
{ {
$component = Component::factory()->create(); $component = Component::factory()->create();
@ -48,7 +48,7 @@ final class ComponentsCheckoutTest extends TestCase
->assertRedirect(route('components.show', ['component' => $component->id])); ->assertRedirect(route('components.show', ['component' => $component->id]));
} }
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$component = Component::factory()->create(); $component = Component::factory()->create();

View file

@ -13,14 +13,14 @@ use Tests\TestCase;
final class ConsumableCheckoutTest extends TestCase final class ConsumableCheckoutTest extends TestCase
{ {
public function testCheckingOutConsumableRequiresCorrectPermission(): void public function testCheckingOutConsumableRequiresCorrectPermission()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('consumables.checkout.store', Consumable::factory()->create())) ->post(route('consumables.checkout.store', Consumable::factory()->create()))
->assertForbidden(); ->assertForbidden();
} }
public function testValidationWhenCheckingOutConsumable(): void public function testValidationWhenCheckingOutConsumable()
{ {
$this->actingAs(User::factory()->checkoutConsumables()->create()) $this->actingAs(User::factory()->checkoutConsumables()->create())
->post(route('consumables.checkout.store', Consumable::factory()->create()), [ ->post(route('consumables.checkout.store', Consumable::factory()->create()), [
@ -29,7 +29,7 @@ final class ConsumableCheckoutTest extends TestCase
->assertSessionHas('error'); ->assertSessionHas('error');
} }
public function testConsumableMustBeAvailableWhenCheckingOut(): void public function testConsumableMustBeAvailableWhenCheckingOut()
{ {
$this->actingAs(User::factory()->checkoutConsumables()->create()) $this->actingAs(User::factory()->checkoutConsumables()->create())
->post(route('consumables.checkout.store', Consumable::factory()->withoutItemsRemaining()->create()), [ ->post(route('consumables.checkout.store', Consumable::factory()->withoutItemsRemaining()->create()), [
@ -38,7 +38,7 @@ final class ConsumableCheckoutTest extends TestCase
->assertSessionHas('error'); ->assertSessionHas('error');
} }
public function testConsumableCanBeCheckedOut(): void public function testConsumableCanBeCheckedOut()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
$user = User::factory()->create(); $user = User::factory()->create();
@ -51,7 +51,7 @@ final class ConsumableCheckoutTest extends TestCase
$this->assertTrue($user->consumables->contains($consumable)); $this->assertTrue($user->consumables->contains($consumable));
} }
public function testUserSentNotificationUponCheckout(): void public function testUserSentNotificationUponCheckout()
{ {
Notification::fake(); Notification::fake();
@ -66,7 +66,7 @@ final class ConsumableCheckoutTest extends TestCase
Notification::assertSentTo($user, CheckoutConsumableNotification::class); Notification::assertSentTo($user, CheckoutConsumableNotification::class);
} }
public function testActionLogCreatedUponCheckout(): void public function testActionLogCreatedUponCheckout()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
$actor = User::factory()->checkoutConsumables()->create(); $actor = User::factory()->checkoutConsumables()->create();
@ -93,7 +93,7 @@ final class ConsumableCheckoutTest extends TestCase
); );
} }
public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
@ -108,7 +108,7 @@ final class ConsumableCheckoutTest extends TestCase
->assertRedirect(route('consumables.index')); ->assertRedirect(route('consumables.index'));
} }
public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
@ -123,7 +123,7 @@ final class ConsumableCheckoutTest extends TestCase
->assertRedirect(route('consumables.show', ['consumable' => $consumable->id])); ->assertRedirect(route('consumables.show', ['consumable' => $consumable->id]));
} }
public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class LicenseCheckoutTest extends TestCase final class LicenseCheckoutTest extends TestCase
{ {
public function testNotesAreStoredInActionLogOnCheckoutToAsset(): void public function testNotesAreStoredInActionLogOnCheckoutToAsset()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -34,7 +34,7 @@ final class LicenseCheckoutTest extends TestCase
]); ]);
} }
public function testNotesAreStoredInActionLogOnCheckoutToUser(): void public function testNotesAreStoredInActionLogOnCheckoutToUser()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$licenseSeat = LicenseSeat::factory()->create(); $licenseSeat = LicenseSeat::factory()->create();
@ -57,7 +57,7 @@ final class LicenseCheckoutTest extends TestCase
]); ]);
} }
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
{ {
$license = License::factory()->create(); $license = License::factory()->create();
@ -72,7 +72,7 @@ final class LicenseCheckoutTest extends TestCase
->assertRedirect(route('licenses.index')); ->assertRedirect(route('licenses.index'));
} }
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
{ {
$license = License::factory()->create(); $license = License::factory()->create();
@ -86,7 +86,7 @@ final class LicenseCheckoutTest extends TestCase
->assertRedirect(route('licenses.show', ['license' => $license->id])); ->assertRedirect(route('licenses.show', ['license' => $license->id]));
} }
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget(): void public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$license = License::factory()->create(); $license = License::factory()->create();
@ -100,7 +100,7 @@ final class LicenseCheckoutTest extends TestCase
->assertStatus(302) ->assertStatus(302)
->assertRedirect(route('users.show', ['user' => $user->id])); ->assertRedirect(route('users.show', ['user' => $user->id]));
} }
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget(): void public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$license = License::factory()->create(); $license = License::factory()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class ComponentIndexTest extends TestCase final class ComponentIndexTest extends TestCase
{ {
public function testComponentIndexAdheresToCompanyScoping(): void public function testComponentIndexAdheresToCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -7,14 +7,14 @@ use Tests\TestCase;
final class ComponentIndexTest extends TestCase final class ComponentIndexTest extends TestCase
{ {
public function testPermissionRequiredToViewComponentsList(): void public function testPermissionRequiredToViewComponentsList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('components.index')) ->get(route('components.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListComponents(): void public function testUserCanListComponents()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('components.index')) ->get(route('components.index'))

View file

@ -13,7 +13,7 @@ use Tests\TestCase;
final class MergeUsersTest extends TestCase final class MergeUsersTest extends TestCase
{ {
public function testAssetsAreTransferredOnUserMerge(): void public function testAssetsAreTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(['username' => 'user1']); $user1 = User::factory()->create(['username' => 'user1']);
$user_to_merge_into = User::factory()->create(['username' => 'user1@example.com']); $user_to_merge_into = User::factory()->create(['username' => 'user1@example.com']);

View file

@ -6,7 +6,7 @@ use Tests\TestCase;
final class OptimizeTest extends TestCase final class OptimizeTest extends TestCase
{ {
public function testOptimizeSucceeds(): void public function testOptimizeSucceeds()
{ {
$this->beforeApplicationDestroyed(function () { $this->beforeApplicationDestroyed(function () {
$this->artisan('config:clear'); $this->artisan('config:clear');

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class ConsumableIndexTest extends TestCase final class ConsumableIndexTest extends TestCase
{ {
public function testConsumableIndexAdheresToCompanyScoping(): void public function testConsumableIndexAdheresToCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();
@ -55,7 +55,7 @@ final class ConsumableIndexTest extends TestCase
->assertResponseContainsInRows($consumableB); ->assertResponseContainsInRows($consumableB);
} }
public function testConsumableIndexReturnsExpectedSearchResults(): void public function testConsumableIndexReturnsExpectedSearchResults()
{ {
Consumable::factory()->count(10)->create(); Consumable::factory()->count(10)->create();
Consumable::factory()->count(1)->create(['name' => 'My Test Consumable']); Consumable::factory()->count(1)->create(['name' => 'My Test Consumable']);

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class ConsumableUpdateTest extends TestCase final class ConsumableUpdateTest extends TestCase
{ {
public function testCanUpdateConsumableViaPatchWithoutCategoryType(): void public function testCanUpdateConsumableViaPatchWithoutCategoryType()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
@ -28,7 +28,7 @@ final class ConsumableUpdateTest extends TestCase
} }
public function testCannotUpdateConsumableViaPatchWithInvalidCategoryType(): void public function testCannotUpdateConsumableViaPatchWithInvalidCategoryType()
{ {
$category = Category::factory()->create(['category_type' => 'asset']); $category = Category::factory()->create(['category_type' => 'asset']);
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class ConsumableViewTest extends TestCase final class ConsumableViewTest extends TestCase
{ {
public function testConsumableViewAdheresToCompanyScoping(): void public function testConsumableViewAdheresToCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -7,14 +7,14 @@ use Tests\TestCase;
final class ConsumableIndexTest extends TestCase final class ConsumableIndexTest extends TestCase
{ {
public function testPermissionRequiredToViewConsumablesList(): void public function testPermissionRequiredToViewConsumablesList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('consumables.index')) ->get(route('consumables.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListConsumables(): void public function testUserCanListConsumables()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('consumables.index')) ->get(route('consumables.index'))

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class ConsumableViewTest extends TestCase final class ConsumableViewTest extends TestCase
{ {
public function testPermissionRequiredToViewConsumable(): void public function testPermissionRequiredToViewConsumable()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
@ -16,7 +16,7 @@ final class ConsumableViewTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListConsumables(): void public function testUserCanListConsumables()
{ {
$consumable = Consumable::factory()->create(); $consumable = Consumable::factory()->create();
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())

View file

@ -7,7 +7,7 @@ use Tests\TestCase;
final class DashboardTest extends TestCase final class DashboardTest extends TestCase
{ {
public function testUsersWithoutAdminAccessAreRedirected(): void public function testUsersWithoutAdminAccessAreRedirected()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('home')) ->get(route('home'))

View file

@ -13,7 +13,7 @@ final class CreateDepartmentsTest extends TestCase
{ {
public function testRequiresPermissionToCreateDepartment(): void public function testRequiresPermissionToCreateDepartment()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.departments.store')) ->postJson(route('api.departments.store'))

View file

@ -10,19 +10,19 @@ use Tests\TestCase;
final class DepartmentsIndexTest extends TestCase final class DepartmentsIndexTest extends TestCase
{ {
public function testViewingDepartmentIndexRequiresAuthentication(): void public function testViewingDepartmentIndexRequiresAuthentication()
{ {
$this->getJson(route('api.departments.index'))->assertRedirect(); $this->getJson(route('api.departments.index'))->assertRedirect();
} }
public function testViewingDepartmentIndexRequiresPermission(): void public function testViewingDepartmentIndexRequiresPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->getJson(route('api.departments.index')) ->getJson(route('api.departments.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testDepartmentIndexReturnsExpectedDepartments(): void public function testDepartmentIndexReturnsExpectedDepartments()
{ {
Department::factory()->count(3)->create(); Department::factory()->count(3)->create();
@ -42,7 +42,7 @@ final class DepartmentsIndexTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
} }
public function testDepartmentIndexAdheresToCompanyScoping(): void public function testDepartmentIndexAdheresToCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class UpdateDepartmentsTest extends TestCase final class UpdateDepartmentsTest extends TestCase
{ {
public function testRequiresPermissionToEditDepartment(): void public function testRequiresPermissionToEditDepartment()
{ {
$department = Department::factory()->create(); $department = Department::factory()->create();
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
@ -18,7 +18,7 @@ final class UpdateDepartmentsTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testCanUpdateDepartmentViaPatch(): void public function testCanUpdateDepartmentViaPatch()
{ {
$department = Department::factory()->create(); $department = Department::factory()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class CreateDepartmentsTest extends TestCase final class CreateDepartmentsTest extends TestCase
{ {
public function testPermissionRequiredToCreateDepartment(): void public function testPermissionRequiredToCreateDepartment()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('departments.store'), [ ->post(route('departments.store'), [
@ -19,7 +19,7 @@ final class CreateDepartmentsTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanCreateDepartments(): void public function testUserCanCreateDepartments()
{ {
$this->assertFalse(Department::where('name', 'Test Department')->exists()); $this->assertFalse(Department::where('name', 'Test Department')->exists());

View file

@ -7,14 +7,14 @@ use Tests\TestCase;
final class IndexDepartmentsTest extends TestCase final class IndexDepartmentsTest extends TestCase
{ {
public function testPermissionRequiredToViewDepartmentsList(): void public function testPermissionRequiredToViewDepartmentsList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('departments.index')) ->get(route('departments.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListDepartments(): void public function testUserCanListDepartments()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('departments.index')) ->get(route('departments.index'))

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class UpdateDepartmentsTest extends TestCase final class UpdateDepartmentsTest extends TestCase
{ {
public function testPermissionRequiredToStoreDepartment(): void public function testPermissionRequiredToStoreDepartment()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('departments.store'), [ ->post(route('departments.store'), [
@ -20,7 +20,7 @@ final class UpdateDepartmentsTest extends TestCase
} }
public function testUserCanEditDepartments(): void public function testUserCanEditDepartments()
{ {
$department = Department::factory()->create(['name' => 'Test Department']); $department = Department::factory()->create(['name' => 'Test Department']);
$this->assertTrue(Department::where('name', 'Test Department')->exists()); $this->assertTrue(Department::where('name', 'Test Department')->exists());

View file

@ -9,14 +9,14 @@ use Tests\TestCase;
final class StoreGroupTest extends TestCase final class StoreGroupTest extends TestCase
{ {
public function testStoringGroupRequiresSuperAdminPermission(): void public function testStoringGroupRequiresSuperAdminPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.groups.store')) ->postJson(route('api.groups.store'))
->assertForbidden(); ->assertForbidden();
} }
public function testCanStoreGroupWithPermissionsPassed(): void public function testCanStoreGroupWithPermissionsPassed()
{ {
$this->actingAsForApi(User::factory()->superuser()->create()) $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.groups.store'), [ ->postJson(route('api.groups.store'), [
@ -37,7 +37,7 @@ final class StoreGroupTest extends TestCase
$this->assertEquals('0', $group->decodePermissions()['reports.view']); $this->assertEquals('0', $group->decodePermissions()['reports.view']);
} }
public function testStoringGroupWithoutPermissionPassed(): void public function testStoringGroupWithoutPermissionPassed()
{ {
$superuser = User::factory()->superuser()->create(); $superuser = User::factory()->superuser()->create();
$this->actingAsForApi($superuser) $this->actingAsForApi($superuser)
@ -61,7 +61,7 @@ final class StoreGroupTest extends TestCase
->assertOk(); ->assertOk();
} }
public function testStoringGroupWithInvalidPermissionDropsBadPermission(): void public function testStoringGroupWithInvalidPermissionDropsBadPermission()
{ {
$this->actingAsForApi(User::factory()->superuser()->create()) $this->actingAsForApi(User::factory()->superuser()->create())
->postJson(route('api.groups.store'), [ ->postJson(route('api.groups.store'), [

View file

@ -7,7 +7,7 @@ use Tests\TestCase;
final class IndexGroupTest extends TestCase final class IndexGroupTest extends TestCase
{ {
public function testPermissionRequiredToViewGroupList(): void public function testPermissionRequiredToViewGroupList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('groups.index')) ->get(route('groups.index'))
@ -16,7 +16,7 @@ final class IndexGroupTest extends TestCase
//$this->followRedirects($response)->assertSee('sad-panda.png'); //$this->followRedirects($response)->assertSee('sad-panda.png');
} }
public function testUserCanListGroups(): void public function testUserCanListGroups()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('groups.index')) ->get(route('groups.index'))

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class LicenseIndexTest extends TestCase final class LicenseIndexTest extends TestCase
{ {
public function testLicensesIndexAdheresToCompanyScoping(): void public function testLicensesIndexAdheresToCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -11,7 +11,7 @@ use Tests\TestCase;
final class CreateLicenseTest extends TestCase final class CreateLicenseTest extends TestCase
{ {
public function testPermissionRequiredToViewLicense(): void public function testPermissionRequiredToViewLicense()
{ {
$license = License::factory()->create(); $license = License::factory()->create();
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
@ -21,7 +21,7 @@ final class CreateLicenseTest extends TestCase
public function testLicenseWithoutPurchaseDateFailsValidation(): void public function testLicenseWithoutPurchaseDateFailsValidation()
{ {
$response = $this->actingAs(User::factory()->superuser()->create()) $response = $this->actingAs(User::factory()->superuser()->create())
->from(route('licenses.create')) ->from(route('licenses.create'))

View file

@ -7,14 +7,14 @@ use Tests\TestCase;
final class LicenseIndexTest extends TestCase final class LicenseIndexTest extends TestCase
{ {
public function testPermissionRequiredToViewLicenseList(): void public function testPermissionRequiredToViewLicenseList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('licenses.index')) ->get(route('licenses.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListLicenses(): void public function testUserCanListLicenses()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('licenses.index')) ->get(route('licenses.index'))

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class LicenseViewTest extends TestCase final class LicenseViewTest extends TestCase
{ {
public function testPermissionRequiredToViewLicense(): void public function testPermissionRequiredToViewLicense()
{ {
$license = License::factory()->create(); $license = License::factory()->create();
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
@ -17,7 +17,7 @@ final class LicenseViewTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testLicenseWithPurchaseDateDepreciatesCorrectly(): void public function testLicenseWithPurchaseDateDepreciatesCorrectly()
{ {
$depreciation = Depreciation::factory()->create(['months' => 12]); $depreciation = Depreciation::factory()->create(['months' => 12]);
$license = License::factory()->create(['depreciation_id' => $depreciation->id, 'purchase_date' => '2020-01-01']); $license = License::factory()->create(['depreciation_id' => $depreciation->id, 'purchase_date' => '2020-01-01']);

View file

@ -8,12 +8,12 @@ use Tests\TestCase;
final class CategoryEditFormTest extends TestCase final class CategoryEditFormTest extends TestCase
{ {
public function testTheComponentCanRender(): void public function testTheComponentCanRender()
{ {
Livewire::test(CategoryEditForm::class)->assertStatus(200); Livewire::test(CategoryEditForm::class)->assertStatus(200);
} }
public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting(): void public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => true, 'sendCheckInEmail' => true,
@ -22,7 +22,7 @@ final class CategoryEditFormTest extends TestCase
])->assertSet('sendCheckInEmail', true); ])->assertSet('sendCheckInEmail', true);
} }
public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet(): void public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false, 'sendCheckInEmail' => false,
@ -31,7 +31,7 @@ final class CategoryEditFormTest extends TestCase
])->assertSet('sendCheckInEmail', true); ])->assertSet('sendCheckInEmail', true);
} }
public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula(): void public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false, 'sendCheckInEmail' => false,
@ -40,7 +40,7 @@ final class CategoryEditFormTest extends TestCase
])->assertSet('sendCheckInEmail', true); ])->assertSet('sendCheckInEmail', true);
} }
public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula(): void public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false, 'sendCheckInEmail' => false,
@ -49,7 +49,7 @@ final class CategoryEditFormTest extends TestCase
])->assertSet('sendCheckInEmail', false); ])->assertSet('sendCheckInEmail', false);
} }
public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered(): void public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false, 'sendCheckInEmail' => false,
@ -59,7 +59,7 @@ final class CategoryEditFormTest extends TestCase
->assertSet('sendCheckInEmail', true); ->assertSet('sendCheckInEmail', true);
} }
public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected(): void public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false, 'sendCheckInEmail' => false,
@ -71,7 +71,7 @@ final class CategoryEditFormTest extends TestCase
->assertSet('sendCheckInEmailDisabled', true); ->assertSet('sendCheckInEmailDisabled', true);
} }
public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula(): void public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'eulaText' => 'Some Content', 'eulaText' => 'Some Content',
@ -94,7 +94,7 @@ final class CategoryEditFormTest extends TestCase
->assertSet('sendCheckInEmailDisabled', false); ->assertSet('sendCheckInEmailDisabled', false);
} }
public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula(): void public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula()
{ {
Livewire::test(CategoryEditForm::class, [ Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false, 'sendCheckInEmail' => false,

View file

@ -9,14 +9,14 @@ use Tests\TestCase;
final class CreateLocationsTest extends TestCase final class CreateLocationsTest extends TestCase
{ {
public function testRequiresPermissionToCreateLocation(): void public function testRequiresPermissionToCreateLocation()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.departments.store')) ->postJson(route('api.departments.store'))
->assertForbidden(); ->assertForbidden();
} }
public function testCannotCreateNewLocationsWithTheSameName(): void public function testCannotCreateNewLocationsWithTheSameName()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
$location2 = Location::factory()->create(); $location2 = Location::factory()->create();
@ -33,7 +33,7 @@ final class CreateLocationsTest extends TestCase
} }
public function testUserCannotCreateLocationsThatAreTheirOwnParent(): void public function testUserCannotCreateLocationsThatAreTheirOwnParent()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class DeleteLocationsTest extends TestCase final class DeleteLocationsTest extends TestCase
{ {
public function testErrorReturnedViaApiIfLocationDoesNotExist(): void public function testErrorReturnedViaApiIfLocationDoesNotExist()
{ {
$this->actingAsForApi(User::factory()->superuser()->create()) $this->actingAsForApi(User::factory()->superuser()->create())
->deleteJson(route('api.users.destroy', 'invalid-id')) ->deleteJson(route('api.users.destroy', 'invalid-id'))
@ -20,7 +20,7 @@ final class DeleteLocationsTest extends TestCase
->json(); ->json();
} }
public function testErrorReturnedViaApiIfLocationIsAlreadyDeleted(): void public function testErrorReturnedViaApiIfLocationIsAlreadyDeleted()
{ {
$location = Location::factory()->deletedLocation()->create(); $location = Location::factory()->deletedLocation()->create();
$this->actingAsForApi(User::factory()->superuser()->create()) $this->actingAsForApi(User::factory()->superuser()->create())
@ -31,7 +31,7 @@ final class DeleteLocationsTest extends TestCase
->json(); ->json();
} }
public function testDisallowLocationDeletionViaApiIfStillHasPeople(): void public function testDisallowLocationDeletionViaApiIfStillHasPeople()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
User::factory()->count(5)->create(['location_id' => $location->id]); User::factory()->count(5)->create(['location_id' => $location->id]);
@ -46,7 +46,7 @@ final class DeleteLocationsTest extends TestCase
->json(); ->json();
} }
public function testDisallowUserDeletionViaApiIfStillHasChildLocations(): void public function testDisallowUserDeletionViaApiIfStillHasChildLocations()
{ {
$parent = Location::factory()->create(); $parent = Location::factory()->create();
Location::factory()->count(5)->create(['parent_id' => $parent->id]); Location::factory()->count(5)->create(['parent_id' => $parent->id]);
@ -60,7 +60,7 @@ final class DeleteLocationsTest extends TestCase
->json(); ->json();
} }
public function testDisallowUserDeletionViaApiIfStillHasAssetsAssigned(): void public function testDisallowUserDeletionViaApiIfStillHasAssetsAssigned()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
Asset::factory()->count(5)->assignedToLocation($location)->create(); Asset::factory()->count(5)->assignedToLocation($location)->create();
@ -75,7 +75,7 @@ final class DeleteLocationsTest extends TestCase
->json(); ->json();
} }
public function testDisallowUserDeletionViaApiIfStillHasAssetsAsLocation(): void public function testDisallowUserDeletionViaApiIfStillHasAssetsAsLocation()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
Asset::factory()->count(5)->create(['location_id' => $location->id]); Asset::factory()->count(5)->create(['location_id' => $location->id]);

View file

@ -10,19 +10,19 @@ use Tests\TestCase;
final class IndexLocationsTest extends TestCase final class IndexLocationsTest extends TestCase
{ {
public function testViewingLocationIndexRequiresAuthentication(): void public function testViewingLocationIndexRequiresAuthentication()
{ {
$this->getJson(route('api.locations.index'))->assertRedirect(); $this->getJson(route('api.locations.index'))->assertRedirect();
} }
public function testViewingLocationIndexRequiresPermission(): void public function testViewingLocationIndexRequiresPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->getJson(route('api.locations.index')) ->getJson(route('api.locations.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testLocationIndexReturnsExpectedLocations(): void public function testLocationIndexReturnsExpectedLocations()
{ {
Location::factory()->count(3)->create(); Location::factory()->count(3)->create();

View file

@ -9,14 +9,14 @@ use Tests\TestCase;
final class LocationsForSelectListTest extends TestCase final class LocationsForSelectListTest extends TestCase
{ {
public function testGettingLocationListRequiresProperPermission(): void public function testGettingLocationListRequiresProperPermission()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->getJson(route('api.locations.selectlist')) ->getJson(route('api.locations.selectlist'))
->assertForbidden(); ->assertForbidden();
} }
public function testLocationsReturned(): void public function testLocationsReturned()
{ {
Location::factory()->create(); Location::factory()->create();
@ -35,7 +35,7 @@ final class LocationsForSelectListTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('results', 1)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('results', 1)->etc());
} }
public function testLocationsAreReturnedWhenUserIsUpdatingTheirProfileAndHasPermissionToUpdateLocation(): void public function testLocationsAreReturnedWhenUserIsUpdatingTheirProfileAndHasPermissionToUpdateLocation()
{ {
$this->actingAsForApi(User::factory()->canEditOwnLocation()->create()) $this->actingAsForApi(User::factory()->canEditOwnLocation()->create())
->withHeader('referer', route('profile')) ->withHeader('referer', route('profile'))

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class LocationsViewTest extends TestCase final class LocationsViewTest extends TestCase
{ {
public function testViewingLocationRequiresPermission(): void public function testViewingLocationRequiresPermission()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
@ -17,7 +17,7 @@ final class LocationsViewTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testViewingLocationAssetIndexRequiresPermission(): void public function testViewingLocationAssetIndexRequiresPermission()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
@ -25,7 +25,7 @@ final class LocationsViewTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testViewingLocationAssetIndex(): void public function testViewingLocationAssetIndex()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();
Asset::factory()->count(3)->assignedToLocation($location)->create(); Asset::factory()->count(3)->assignedToLocation($location)->create();

View file

@ -9,14 +9,14 @@ use Tests\TestCase;
final class UpdateLocationsTest extends TestCase final class UpdateLocationsTest extends TestCase
{ {
public function testRequiresPermissionToEditLocation(): void public function testRequiresPermissionToEditLocation()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.locations.store', Location::factory()->create())) ->postJson(route('api.locations.store', Location::factory()->create()))
->assertForbidden(); ->assertForbidden();
} }
public function testCanUpdateLocationViaPatch(): void public function testCanUpdateLocationViaPatch()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class CreateLocationsTest extends TestCase final class CreateLocationsTest extends TestCase
{ {
public function testPermissionRequiredToCreateLocation(): void public function testPermissionRequiredToCreateLocation()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('locations.store'), [ ->post(route('locations.store'), [
@ -19,7 +19,7 @@ final class CreateLocationsTest extends TestCase
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanCreateLocations(): void public function testUserCanCreateLocations()
{ {
$this->assertFalse(Location::where('name', 'Test Location')->exists()); $this->assertFalse(Location::where('name', 'Test Location')->exists());

View file

@ -7,14 +7,14 @@ use Tests\TestCase;
final class IndexLocationsTest extends TestCase final class IndexLocationsTest extends TestCase
{ {
public function testPermissionRequiredToViewLocationsList(): void public function testPermissionRequiredToViewLocationsList()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('locations.index')) ->get(route('locations.index'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListLocations(): void public function testUserCanListLocations()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('locations.index')) ->get(route('locations.index'))

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class UpdateLocationsTest extends TestCase final class UpdateLocationsTest extends TestCase
{ {
public function testPermissionRequiredToStoreLocation(): void public function testPermissionRequiredToStoreLocation()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->post(route('locations.store'), [ ->post(route('locations.store'), [
@ -19,7 +19,7 @@ final class UpdateLocationsTest extends TestCase
} }
public function testUserCanEditLocations(): void public function testUserCanEditLocations()
{ {
$location = Location::factory()->create(['name' => 'Test Location']); $location = Location::factory()->create(['name' => 'Test Location']);
$this->assertTrue(Location::where('name', 'Test Location')->exists()); $this->assertTrue(Location::where('name', 'Test Location')->exists());
@ -36,7 +36,7 @@ final class UpdateLocationsTest extends TestCase
$this->assertTrue(Location::where('name', 'Test Location Edited')->exists()); $this->assertTrue(Location::where('name', 'Test Location Edited')->exists());
} }
public function testUserCannotEditLocationsToMakeThemTheirOwnParent(): void public function testUserCannotEditLocationsToMakeThemTheirOwnParent()
{ {
$location = Location::factory()->create(); $location = Location::factory()->create();

View file

@ -20,7 +20,7 @@ final class EmailNotificationsUponCheckinTest extends TestCase
Notification::fake(); Notification::fake();
} }
public function testCheckInEmailSentToUserIfSettingEnabled(): void public function testCheckInEmailSentToUserIfSettingEnabled()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$asset = Asset::factory()->assignedToUser($user)->create(); $asset = Asset::factory()->assignedToUser($user)->create();
@ -37,7 +37,7 @@ final class EmailNotificationsUponCheckinTest extends TestCase
); );
} }
public function testCheckInEmailNotSentToUserIfSettingDisabled(): void public function testCheckInEmailNotSentToUserIfSettingDisabled()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$asset = Asset::factory()->assignedToUser($user)->create(); $asset = Asset::factory()->assignedToUser($user)->create();

View file

@ -45,7 +45,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
]; ];
} }
public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled(): void public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled()
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -57,7 +57,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
$this->assertSlackNotificationSent(CheckinAccessoryNotification::class); $this->assertSlackNotificationSent(CheckinAccessoryNotification::class);
} }
public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled(): void public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled()
{ {
$this->settings->disableSlackWebhook(); $this->settings->disableSlackWebhook();
@ -70,7 +70,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
} }
#[DataProvider('assetCheckInTargets')] #[DataProvider('assetCheckInTargets')]
public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -83,7 +83,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
} }
#[DataProvider('assetCheckInTargets')] #[DataProvider('assetCheckInTargets')]
public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{ {
$this->settings->disableSlackWebhook(); $this->settings->disableSlackWebhook();
@ -95,7 +95,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
$this->assertNoSlackNotificationSent(CheckinAssetNotification::class); $this->assertNoSlackNotificationSent(CheckinAssetNotification::class);
} }
public function testComponentCheckinDoesNotSendSlackNotification(): void public function testComponentCheckinDoesNotSendSlackNotification()
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -108,7 +108,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
} }
#[DataProvider('licenseCheckInTargets')] #[DataProvider('licenseCheckInTargets')]
public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -121,7 +121,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
} }
#[DataProvider('licenseCheckInTargets')] #[DataProvider('licenseCheckInTargets')]
public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{ {
$this->settings->disableSlackWebhook(); $this->settings->disableSlackWebhook();

View file

@ -47,7 +47,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
]; ];
} }
public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled(): void public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled()
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -59,7 +59,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
$this->assertSlackNotificationSent(CheckoutAccessoryNotification::class); $this->assertSlackNotificationSent(CheckoutAccessoryNotification::class);
} }
public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled(): void public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()
{ {
$this->settings->disableSlackWebhook(); $this->settings->disableSlackWebhook();
@ -72,7 +72,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
} }
#[DataProvider('assetCheckoutTargets')] #[DataProvider('assetCheckoutTargets')]
public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -85,7 +85,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
} }
#[DataProvider('assetCheckoutTargets')] #[DataProvider('assetCheckoutTargets')]
public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{ {
$this->settings->disableSlackWebhook(); $this->settings->disableSlackWebhook();
@ -97,7 +97,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
$this->assertNoSlackNotificationSent(CheckoutAssetNotification::class); $this->assertNoSlackNotificationSent(CheckoutAssetNotification::class);
} }
public function testComponentCheckoutDoesNotSendSlackNotification(): void public function testComponentCheckoutDoesNotSendSlackNotification()
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -109,7 +109,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
Notification::assertNothingSent(); Notification::assertNothingSent();
} }
public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled(): void public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled()
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -121,7 +121,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
$this->assertSlackNotificationSent(CheckoutConsumableNotification::class); $this->assertSlackNotificationSent(CheckoutConsumableNotification::class);
} }
public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled(): void public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()
{ {
$this->settings->disableSlackWebhook(); $this->settings->disableSlackWebhook();
@ -134,7 +134,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
} }
#[DataProvider('licenseCheckoutTargets')] #[DataProvider('licenseCheckoutTargets')]
public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{ {
$this->settings->enableSlackWebhook(); $this->settings->enableSlackWebhook();
@ -147,7 +147,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
} }
#[DataProvider('licenseCheckoutTargets')] #[DataProvider('licenseCheckoutTargets')]
public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{ {
$this->settings->disableSlackWebhook(); $this->settings->disableSlackWebhook();

View file

@ -43,7 +43,7 @@ final class CustomReportTest extends TestCase
); );
} }
public function testCustomAssetReport(): void public function testCustomAssetReport()
{ {
Asset::factory()->create(['name' => 'Asset A']); Asset::factory()->create(['name' => 'Asset A']);
Asset::factory()->create(['name' => 'Asset B']); Asset::factory()->create(['name' => 'Asset B']);
@ -59,7 +59,7 @@ final class CustomReportTest extends TestCase
->assertSeeTextInStreamedResponse('Asset B'); ->assertSeeTextInStreamedResponse('Asset B');
} }
public function testCustomAssetReportAdheresToCompanyScoping(): void public function testCustomAssetReportAdheresToCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();
@ -105,7 +105,7 @@ final class CustomReportTest extends TestCase
->assertSeeTextInStreamedResponse('Asset B'); ->assertSeeTextInStreamedResponse('Asset B');
} }
public function testCanLimitAssetsByLastCheckIn(): void public function testCanLimitAssetsByLastCheckIn()
{ {
Asset::factory()->create(['name' => 'Asset A', 'last_checkin' => '2023-08-01']); Asset::factory()->create(['name' => 'Asset A', 'last_checkin' => '2023-08-01']);
Asset::factory()->create(['name' => 'Asset B', 'last_checkin' => '2023-08-02']); Asset::factory()->create(['name' => 'Asset B', 'last_checkin' => '2023-08-02']);

View file

@ -44,14 +44,14 @@ final class UnacceptedAssetReportTest extends TestCase
} }
public function testPermissionRequiredToViewUnacceptedAssetReport(): void public function testPermissionRequiredToViewUnacceptedAssetReport()
{ {
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
->get(route('reports/unaccepted_assets')) ->get(route('reports/unaccepted_assets'))
->assertForbidden(); ->assertForbidden();
} }
public function testUserCanListUnacceptedAssets(): void public function testUserCanListUnacceptedAssets()
{ {
$this->actingAs(User::factory()->superuser()->create()) $this->actingAs(User::factory()->superuser()->create())
->get(route('reports/unaccepted_assets')) ->get(route('reports/unaccepted_assets'))

View file

@ -12,7 +12,7 @@ use App\Models\Setting;
final class BrandingSettingsTest extends TestCase final class BrandingSettingsTest extends TestCase
{ {
public function testSiteNameIsRequired(): void public function testSiteNameIsRequired()
{ {
$response = $this->actingAs(User::factory()->superuser()->create()) $response = $this->actingAs(User::factory()->superuser()->create())
->from(route('settings.branding.index')) ->from(route('settings.branding.index'))
@ -25,7 +25,7 @@ final class BrandingSettingsTest extends TestCase
$this->followRedirects($response)->assertSee(trans('general.error')); $this->followRedirects($response)->assertSee(trans('general.error'));
} }
public function testSiteNameCanBeSaved(): void public function testSiteNameCanBeSaved()
{ {
$response = $this->actingAs(User::factory()->superuser()->create()) $response = $this->actingAs(User::factory()->superuser()->create())
->post(route('settings.branding.save', ['site_name' => 'My Awesome Site'])) ->post(route('settings.branding.save', ['site_name' => 'My Awesome Site']))
@ -38,7 +38,7 @@ final class BrandingSettingsTest extends TestCase
} }
public function testLogoCanBeUploaded(): void public function testLogoCanBeUploaded()
{ {
Storage::fake('public'); Storage::fake('public');
$setting = Setting::factory()->create(['logo' => null]); $setting = Setting::factory()->create(['logo' => null]);
@ -58,7 +58,7 @@ final class BrandingSettingsTest extends TestCase
Storage::disk('public')->assertExists($setting->logo); Storage::disk('public')->assertExists($setting->logo);
} }
public function testLogoCanBeDeleted(): void public function testLogoCanBeDeleted()
{ {
Storage::fake('public'); Storage::fake('public');
@ -82,7 +82,7 @@ final class BrandingSettingsTest extends TestCase
//Storage::disk('public')->assertMissing($original_file); //Storage::disk('public')->assertMissing($original_file);
} }
public function testEmailLogoCanBeUploaded(): void public function testEmailLogoCanBeUploaded()
{ {
Storage::fake('public'); Storage::fake('public');
@ -108,7 +108,7 @@ final class BrandingSettingsTest extends TestCase
// Storage::disk('public')->assertMissing($original_file); // Storage::disk('public')->assertMissing($original_file);
} }
public function testEmailLogoCanBeDeleted(): void public function testEmailLogoCanBeDeleted()
{ {
Storage::fake('public'); Storage::fake('public');
@ -135,7 +135,7 @@ final class BrandingSettingsTest extends TestCase
} }
public function testLabelLogoCanBeUploaded(): void public function testLabelLogoCanBeUploaded()
{ {
Storage::fake('public'); Storage::fake('public');
@ -164,7 +164,7 @@ final class BrandingSettingsTest extends TestCase
} }
public function testLabelLogoCanBeDeleted(): void public function testLabelLogoCanBeDeleted()
{ {
Storage::fake('public'); Storage::fake('public');
@ -191,7 +191,7 @@ final class BrandingSettingsTest extends TestCase
} }
public function testDefaultAvatarCanBeUploaded(): void public function testDefaultAvatarCanBeUploaded()
{ {
Storage::fake('public'); Storage::fake('public');
@ -213,7 +213,7 @@ final class BrandingSettingsTest extends TestCase
// Storage::disk('public')->assertMissing($original_file); // Storage::disk('public')->assertMissing($original_file);
} }
public function testDefaultAvatarCanBeDeleted(): void public function testDefaultAvatarCanBeDeleted()
{ {
Storage::fake('public'); Storage::fake('public');
@ -238,7 +238,7 @@ final class BrandingSettingsTest extends TestCase
// Storage::disk('public')->assertMissing($original_file); // Storage::disk('public')->assertMissing($original_file);
} }
public function testSnipeDefaultAvatarCanBeDeleted(): void public function testSnipeDefaultAvatarCanBeDeleted()
{ {
$setting = Setting::getSettings()->first(); $setting = Setting::getSettings()->first();
@ -263,7 +263,7 @@ final class BrandingSettingsTest extends TestCase
} }
public function testFaviconCanBeUploaded(): void public function testFaviconCanBeUploaded()
{ {
$this->markTestIncomplete('This fails mimetype validation on the mock'); $this->markTestIncomplete('This fails mimetype validation on the mock');
Storage::fake('public'); Storage::fake('public');
@ -284,7 +284,7 @@ final class BrandingSettingsTest extends TestCase
Storage::disk('public')->assertExists('favicon.png'); Storage::disk('public')->assertExists('favicon.png');
} }
public function testFaviconCanBeDeleted(): void public function testFaviconCanBeDeleted()
{ {
$this->markTestIncomplete('This fails mimetype validation on the mock'); $this->markTestIncomplete('This fails mimetype validation on the mock');
Storage::fake('public'); Storage::fake('public');

View file

@ -302,7 +302,7 @@ final class ShowSetUpPageTest extends TestCase
$this->assertSeeDirectoryPermissionError(false); $this->assertSeeDirectoryPermissionError(false);
} }
public function testInvalidTLSCertsOkWhenCheckingForEnvFile(): void public function testInvalidTLSCertsOkWhenCheckingForEnvFile()
{ {
//set the weird bad SSL cert place - https://self-signed.badssl.com //set the weird bad SSL cert place - https://self-signed.badssl.com
$this->markTestIncomplete("Not yet sure how to write this test, it requires messing with .env ..."); $this->markTestIncomplete("Not yet sure how to write this test, it requires messing with .env ...");

View file

@ -12,7 +12,7 @@ final class DeleteUserTest extends TestCase
{ {
public function testErrorReturnedViaApiIfUserDoesNotExist(): void public function testErrorReturnedViaApiIfUserDoesNotExist()
{ {
$this->actingAsForApi(User::factory()->deleteUsers()->create()) $this->actingAsForApi(User::factory()->deleteUsers()->create())
->deleteJson(route('api.users.destroy', 'invalid-id')) ->deleteJson(route('api.users.destroy', 'invalid-id'))
@ -22,7 +22,7 @@ final class DeleteUserTest extends TestCase
->json(); ->json();
} }
public function testErrorReturnedViaApiIfUserIsAlreadyDeleted(): void public function testErrorReturnedViaApiIfUserIsAlreadyDeleted()
{ {
$user = User::factory()->deletedUser()->create(); $user = User::factory()->deletedUser()->create();
$this->actingAsForApi(User::factory()->deleteUsers()->create()) $this->actingAsForApi(User::factory()->deleteUsers()->create())
@ -34,7 +34,7 @@ final class DeleteUserTest extends TestCase
} }
public function testDisallowUserDeletionViaApiIfStillManagingPeople(): void public function testDisallowUserDeletionViaApiIfStillManagingPeople()
{ {
$manager = User::factory()->create(); $manager = User::factory()->create();
User::factory()->count(5)->create(['manager_id' => $manager->id]); User::factory()->count(5)->create(['manager_id' => $manager->id]);
@ -48,7 +48,7 @@ final class DeleteUserTest extends TestCase
->json(); ->json();
} }
public function testDisallowUserDeletionViaApiIfStillManagingLocations(): void public function testDisallowUserDeletionViaApiIfStillManagingLocations()
{ {
$manager = User::factory()->create(); $manager = User::factory()->create();
Location::factory()->count(5)->create(['manager_id' => $manager->id]); Location::factory()->count(5)->create(['manager_id' => $manager->id]);
@ -63,7 +63,7 @@ final class DeleteUserTest extends TestCase
->json(); ->json();
} }
public function testDisallowUserDeletionViaApiIfStillHasLicenses(): void public function testDisallowUserDeletionViaApiIfStillHasLicenses()
{ {
$manager = User::factory()->create(); $manager = User::factory()->create();
LicenseSeat::factory()->count(5)->create(['assigned_to' => $manager->id]); LicenseSeat::factory()->count(5)->create(['assigned_to' => $manager->id]);
@ -78,7 +78,7 @@ final class DeleteUserTest extends TestCase
->json(); ->json();
} }
public function testDeniedPermissionsForDeletingUserViaApi(): void public function testDeniedPermissionsForDeletingUserViaApi()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.users.destroy', User::factory()->create())) ->deleteJson(route('api.users.destroy', User::factory()->create()))
@ -86,7 +86,7 @@ final class DeleteUserTest extends TestCase
->json(); ->json();
} }
public function testSuccessPermissionsForDeletingUserViaApi(): void public function testSuccessPermissionsForDeletingUserViaApi()
{ {
$this->actingAsForApi(User::factory()->deleteUsers()->create()) $this->actingAsForApi(User::factory()->deleteUsers()->create())
->deleteJson(route('api.users.destroy', User::factory()->create())) ->deleteJson(route('api.users.destroy', User::factory()->create()))
@ -97,7 +97,7 @@ final class DeleteUserTest extends TestCase
} }
public function testPermissionsForDeletingIfNotInSameCompanyAndNotSuperadmin(): void public function testPermissionsForDeletingIfNotInSameCompanyAndNotSuperadmin()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -139,7 +139,7 @@ final class DeleteUserTest extends TestCase
} }
public function testUsersCannotDeleteThemselves(): void public function testUsersCannotDeleteThemselves()
{ {
$user = User::factory()->deleteUsers()->create(); $user = User::factory()->deleteUsers()->create();
$this->actingAsForApi($user) $this->actingAsForApi($user)

View file

@ -12,7 +12,7 @@ final class RestoreUserTest extends TestCase
{ {
public function testErrorReturnedViaApiIfUserDoesNotExist(): void public function testErrorReturnedViaApiIfUserDoesNotExist()
{ {
$this->actingAsForApi(User::factory()->deleteUsers()->create()) $this->actingAsForApi(User::factory()->deleteUsers()->create())
->postJson(route('api.users.restore', 'invalid-id')) ->postJson(route('api.users.restore', 'invalid-id'))
@ -22,7 +22,7 @@ final class RestoreUserTest extends TestCase
->json(); ->json();
} }
public function testErrorReturnedViaApiIfUserIsNotDeleted(): void public function testErrorReturnedViaApiIfUserIsNotDeleted()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$this->actingAsForApi(User::factory()->deleteUsers()->create()) $this->actingAsForApi(User::factory()->deleteUsers()->create())
@ -34,7 +34,7 @@ final class RestoreUserTest extends TestCase
} }
public function testDeniedPermissionsForRestoringUserViaApi(): void public function testDeniedPermissionsForRestoringUserViaApi()
{ {
$this->actingAsForApi(User::factory()->create()) $this->actingAsForApi(User::factory()->create())
->postJson(route('api.users.restore', User::factory()->deletedUser()->create())) ->postJson(route('api.users.restore', User::factory()->deletedUser()->create()))
@ -42,7 +42,7 @@ final class RestoreUserTest extends TestCase
->json(); ->json();
} }
public function testSuccessPermissionsForRestoringUserViaApi(): void public function testSuccessPermissionsForRestoringUserViaApi()
{ {
$deleted_user = User::factory()->deletedUser()->create(); $deleted_user = User::factory()->deletedUser()->create();
@ -57,7 +57,7 @@ final class RestoreUserTest extends TestCase
$this->assertNull($deleted_user->deleted_at); $this->assertNull($deleted_user->deleted_at);
} }
public function testPermissionsForRestoringIfNotInSameCompanyAndNotSuperadmin(): void public function testPermissionsForRestoringIfNotInSameCompanyAndNotSuperadmin()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();

View file

@ -12,7 +12,7 @@ use Tests\TestCase;
final class UpdateUserTest extends TestCase final class UpdateUserTest extends TestCase
{ {
public function testCanUpdateUserViaPatch(): void public function testCanUpdateUserViaPatch()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$manager = User::factory()->create(); $manager = User::factory()->create();
@ -82,7 +82,7 @@ final class UpdateUserTest extends TestCase
$this->assertTrue($user->groups->contains($groupB), 'Not part of expected group'); $this->assertTrue($user->groups->contains($groupB), 'Not part of expected group');
} }
public function testApiUsersCanBeActivatedWithNumber(): void public function testApiUsersCanBeActivatedWithNumber()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => 0]); $user = User::factory()->create(['activated' => 0]);
@ -95,7 +95,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(1, $user->refresh()->activated); $this->assertEquals(1, $user->refresh()->activated);
} }
public function testApiUsersCanBeActivatedWithBooleanTrue(): void public function testApiUsersCanBeActivatedWithBooleanTrue()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => false]); $user = User::factory()->create(['activated' => false]);
@ -108,7 +108,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(1, $user->refresh()->activated); $this->assertEquals(1, $user->refresh()->activated);
} }
public function testApiUsersCanBeDeactivatedWithNumber(): void public function testApiUsersCanBeDeactivatedWithNumber()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => true]); $user = User::factory()->create(['activated' => true]);
@ -121,7 +121,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(0, $user->refresh()->activated); $this->assertEquals(0, $user->refresh()->activated);
} }
public function testApiUsersCanBeDeactivatedWithBooleanFalse(): void public function testApiUsersCanBeDeactivatedWithBooleanFalse()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => true]); $user = User::factory()->create(['activated' => true]);
@ -134,7 +134,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(0, $user->refresh()->activated); $this->assertEquals(0, $user->refresh()->activated);
} }
public function testUsersScopedToCompanyDuringUpdateWhenMultipleFullCompanySupportEnabled(): void public function testUsersScopedToCompanyDuringUpdateWhenMultipleFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -223,7 +223,7 @@ final class UpdateUserTest extends TestCase
->json(); ->json();
} }
public function testUserGroupsAreOnlyUpdatedIfAuthenticatedUserIsSuperUser(): void public function testUserGroupsAreOnlyUpdatedIfAuthenticatedUserIsSuperUser()
{ {
$groupToJoin = Group::factory()->create(); $groupToJoin = Group::factory()->create();
@ -250,7 +250,7 @@ final class UpdateUserTest extends TestCase
$this->assertTrue($userToUpdateByToUserBySuperuser->refresh()->groups->contains($groupToJoin)); $this->assertTrue($userToUpdateByToUserBySuperuser->refresh()->groups->contains($groupToJoin));
} }
public function testUserGroupsCanBeClearedBySuperUser(): void public function testUserGroupsCanBeClearedBySuperUser()
{ {
$normalUser = User::factory()->editUsers()->create(); $normalUser = User::factory()->editUsers()->create();
$superUser = User::factory()->superuser()->create(); $superUser = User::factory()->superuser()->create();
@ -276,7 +276,7 @@ final class UpdateUserTest extends TestCase
$this->assertFalse($anotherUserToUpdate->refresh()->groups->contains($joinedGroup)); $this->assertFalse($anotherUserToUpdate->refresh()->groups->contains($joinedGroup));
} }
public function testNonSuperuserCannotUpdateOwnGroups(): void public function testNonSuperuserCannotUpdateOwnGroups()
{ {
$groupToJoin = Group::factory()->create(); $groupToJoin = Group::factory()->create();
$user = User::factory()->editUsers()->create(); $user = User::factory()->editUsers()->create();
@ -292,7 +292,7 @@ final class UpdateUserTest extends TestCase
} }
public function testNonSuperuserCannotUpdateGroups(): void public function testNonSuperuserCannotUpdateGroups()
{ {
$user = User::factory()->editUsers()->create(); $user = User::factory()->editUsers()->create();
$group = Group::factory()->create(); $group = Group::factory()->create();
@ -313,7 +313,7 @@ final class UpdateUserTest extends TestCase
} }
public function testUsersGroupsAreNotClearedIfNoGroupPassedBySuperUser(): void public function testUsersGroupsAreNotClearedIfNoGroupPassedBySuperUser()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$superUser = User::factory()->superuser()->create(); $superUser = User::factory()->superuser()->create();
@ -327,7 +327,7 @@ final class UpdateUserTest extends TestCase
$this->assertTrue($user->refresh()->groups->contains($group)); $this->assertTrue($user->refresh()->groups->contains($group));
} }
public function testMultipleGroupsUpdateBySuperUser(): void public function testMultipleGroupsUpdateBySuperUser()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$superUser = User::factory()->superuser()->create(); $superUser = User::factory()->superuser()->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class UserSearchTest extends TestCase final class UserSearchTest extends TestCase
{ {
public function testCanSearchByUserFirstAndLastName(): void public function testCanSearchByUserFirstAndLastName()
{ {
User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']); User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);
User::factory()->create(['first_name' => 'Darth', 'last_name' => 'Vader']); User::factory()->create(['first_name' => 'Darth', 'last_name' => 'Vader']);
@ -24,7 +24,7 @@ final class UserSearchTest extends TestCase
$this->assertFalse($results->pluck('name')->contains(fn($text) => str_contains($text, 'Darth'))); $this->assertFalse($results->pluck('name')->contains(fn($text) => str_contains($text, 'Darth')));
} }
public function testResultsWhenSearchingForActiveUsers(): void public function testResultsWhenSearchingForActiveUsers()
{ {
User::factory()->create(['first_name' => 'Active', 'last_name' => 'User']); User::factory()->create(['first_name' => 'Active', 'last_name' => 'User']);
User::factory()->create(['first_name' => 'Deleted', 'last_name' => 'User'])->delete(); User::factory()->create(['first_name' => 'Deleted', 'last_name' => 'User'])->delete();
@ -53,7 +53,7 @@ final class UserSearchTest extends TestCase
); );
} }
public function testResultsWhenSearchingForDeletedUsers(): void public function testResultsWhenSearchingForDeletedUsers()
{ {
User::factory()->create(['first_name' => 'Active', 'last_name' => 'User']); User::factory()->create(['first_name' => 'Active', 'last_name' => 'User']);
User::factory()->create(['first_name' => 'Deleted', 'last_name' => 'User'])->delete(); User::factory()->create(['first_name' => 'Deleted', 'last_name' => 'User'])->delete();
@ -82,7 +82,7 @@ final class UserSearchTest extends TestCase
); );
} }
public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled(): void public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -110,7 +110,7 @@ final class UserSearchTest extends TestCase
); );
} }
public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled(): void public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -145,7 +145,7 @@ final class UserSearchTest extends TestCase
); );
} }
public function testUsersIndexWhenInvalidSortFieldIsPassed(): void public function testUsersIndexWhenInvalidSortFieldIsPassed()
{ {
$this->markIncompleteIfSqlite('This test is not compatible with SQLite'); $this->markIncompleteIfSqlite('This test is not compatible with SQLite');

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class UsersForSelectListTest extends TestCase final class UsersForSelectListTest extends TestCase
{ {
public function testUsersAreReturned(): void public function testUsersAreReturned()
{ {
$users = User::factory()->superuser()->count(3)->create(); $users = User::factory()->superuser()->count(3)->create();
@ -27,7 +27,7 @@ final class UsersForSelectListTest extends TestCase
->assertJson(fn(AssertableJson $json) => $json->has('results', 3)->etc()); ->assertJson(fn(AssertableJson $json) => $json->has('results', 3)->etc());
} }
public function testUsersCanBeSearchedByFirstAndLastName(): void public function testUsersCanBeSearchedByFirstAndLastName()
{ {
User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']); User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);
@ -40,7 +40,7 @@ final class UsersForSelectListTest extends TestCase
$this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, 'Luke'))); $this->assertTrue($results->pluck('text')->contains(fn($text) => str_contains($text, 'Luke')));
} }
public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled(): void public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -68,7 +68,7 @@ final class UsersForSelectListTest extends TestCase
); );
} }
public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled(): void public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();

View file

@ -11,7 +11,7 @@ use Tests\TestCase;
final class ViewUserTest extends TestCase final class ViewUserTest extends TestCase
{ {
public function testCanReturnUser(): void public function testCanReturnUser()
{ {
$user = User::factory()->create(); $user = User::factory()->create();

View file

@ -14,7 +14,7 @@ use App\Models\Asset;
final class DeleteUserTest extends TestCase final class DeleteUserTest extends TestCase
{ {
public function testUserCanDeleteAnotherUser(): void public function testUserCanDeleteAnotherUser()
{ {
$user = User::factory()->deleteUsers()->viewUsers()->create(); $user = User::factory()->deleteUsers()->viewUsers()->create();
$this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($user->isDeletable()); $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($user->isDeletable());
@ -28,7 +28,7 @@ final class DeleteUserTest extends TestCase
} }
public function testErrorReturnedIfUserDoesNotExist(): void public function testErrorReturnedIfUserDoesNotExist()
{ {
$response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create()) $response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())
->delete(route('users.destroy', ['user' => '40596803548609346'])) ->delete(route('users.destroy', ['user' => '40596803548609346']))
@ -37,7 +37,7 @@ final class DeleteUserTest extends TestCase
$this->followRedirects($response)->assertSee(trans('alert-danger')); $this->followRedirects($response)->assertSee(trans('alert-danger'));
} }
public function testErrorReturnedIfUserIsAlreadyDeleted(): void public function testErrorReturnedIfUserIsAlreadyDeleted()
{ {
$user = User::factory()->deletedUser()->viewUsers()->create(); $user = User::factory()->deletedUser()->viewUsers()->create();
$response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create()) $response = $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())
@ -49,7 +49,7 @@ final class DeleteUserTest extends TestCase
} }
public function testFmcsPermissionsToDeleteUser(): void public function testFmcsPermissionsToDeleteUser()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -90,7 +90,7 @@ final class DeleteUserTest extends TestCase
} }
public function testDisallowUserDeletionIfStillManagingPeople(): void public function testDisallowUserDeletionIfStillManagingPeople()
{ {
$manager = User::factory()->create(); $manager = User::factory()->create();
User::factory()->count(1)->create(['manager_id' => $manager->id]); User::factory()->count(1)->create(['manager_id' => $manager->id]);
@ -105,7 +105,7 @@ final class DeleteUserTest extends TestCase
$this->followRedirects($response)->assertSee('Error'); $this->followRedirects($response)->assertSee('Error');
} }
public function testDisallowUserDeletionIfStillManagingLocations(): void public function testDisallowUserDeletionIfStillManagingLocations()
{ {
$manager = User::factory()->create(); $manager = User::factory()->create();
Location::factory()->count(2)->create(['manager_id' => $manager->id]); Location::factory()->count(2)->create(['manager_id' => $manager->id]);
@ -120,7 +120,7 @@ final class DeleteUserTest extends TestCase
$this->followRedirects($response)->assertSee('Error'); $this->followRedirects($response)->assertSee('Error');
} }
public function testDisallowUserDeletionIfStillHaveAccessories(): void public function testDisallowUserDeletionIfStillHaveAccessories()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
Accessory::factory()->count(3)->checkedOutToUser($user)->create(); Accessory::factory()->count(3)->checkedOutToUser($user)->create();
@ -135,7 +135,7 @@ final class DeleteUserTest extends TestCase
$this->followRedirects($response)->assertSee('Error'); $this->followRedirects($response)->assertSee('Error');
} }
public function testDisallowUserDeletionIfStillHaveLicenses(): void public function testDisallowUserDeletionIfStillHaveLicenses()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
LicenseSeat::factory()->count(4)->create(['assigned_to' => $user->id]); LicenseSeat::factory()->count(4)->create(['assigned_to' => $user->id]);
@ -151,7 +151,7 @@ final class DeleteUserTest extends TestCase
} }
public function testAllowUserDeletionIfNotManagingLocations(): void public function testAllowUserDeletionIfNotManagingLocations()
{ {
$manager = User::factory()->create(); $manager = User::factory()->create();
$this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable()); $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable());
@ -165,14 +165,14 @@ final class DeleteUserTest extends TestCase
} }
public function testDisallowUserDeletionIfNoDeletePermissions(): void public function testDisallowUserDeletionIfNoDeletePermissions()
{ {
$manager = User::factory()->create(); $manager = User::factory()->create();
Location::factory()->create(['manager_id' => $manager->id]); Location::factory()->create(['manager_id' => $manager->id]);
$this->actingAs(User::factory()->editUsers()->viewUsers()->create())->assertFalse($manager->isDeletable()); $this->actingAs(User::factory()->editUsers()->viewUsers()->create())->assertFalse($manager->isDeletable());
} }
public function testDisallowUserDeletionIfTheyStillHaveAssets(): void public function testDisallowUserDeletionIfTheyStillHaveAssets()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
@ -195,7 +195,7 @@ final class DeleteUserTest extends TestCase
} }
public function testUsersCannotDeleteThemselves(): void public function testUsersCannotDeleteThemselves()
{ {
$manager = User::factory()->deleteUsers()->viewUsers()->create(); $manager = User::factory()->deleteUsers()->viewUsers()->create();
$this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable()); $this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable());

View file

@ -13,7 +13,7 @@ use Tests\TestCase;
final class MergeUsersTest extends TestCase final class MergeUsersTest extends TestCase
{ {
public function testAssetsAreTransferredOnUserMerge(): void public function testAssetsAreTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(); $user1 = User::factory()->create();
$user2 = User::factory()->create(); $user2 = User::factory()->create();
@ -39,7 +39,7 @@ final class MergeUsersTest extends TestCase
} }
public function testLicensesAreTransferredOnUserMerge(): void public function testLicensesAreTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(); $user1 = User::factory()->create();
$user2 = User::factory()->create(); $user2 = User::factory()->create();
@ -67,7 +67,7 @@ final class MergeUsersTest extends TestCase
} }
public function testAccessoriesTransferredOnUserMerge(): void public function testAccessoriesTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(); $user1 = User::factory()->create();
$user2 = User::factory()->create(); $user2 = User::factory()->create();
@ -95,7 +95,7 @@ final class MergeUsersTest extends TestCase
} }
public function testConsumablesTransferredOnUserMerge(): void public function testConsumablesTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(); $user1 = User::factory()->create();
$user2 = User::factory()->create(); $user2 = User::factory()->create();
@ -123,7 +123,7 @@ final class MergeUsersTest extends TestCase
} }
public function testFilesAreTransferredOnUserMerge(): void public function testFilesAreTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(); $user1 = User::factory()->create();
$user2 = User::factory()->create(); $user2 = User::factory()->create();
@ -151,7 +151,7 @@ final class MergeUsersTest extends TestCase
} }
public function testAcceptancesAreTransferredOnUserMerge(): void public function testAcceptancesAreTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(); $user1 = User::factory()->create();
$user2 = User::factory()->create(); $user2 = User::factory()->create();
@ -179,7 +179,7 @@ final class MergeUsersTest extends TestCase
} }
public function testUserUpdateHistoryIsTransferredOnUserMerge(): void public function testUserUpdateHistoryIsTransferredOnUserMerge()
{ {
$user1 = User::factory()->create(); $user1 = User::factory()->create();
$user2 = User::factory()->create(); $user2 = User::factory()->create();

View file

@ -7,7 +7,7 @@ use Tests\TestCase;
final class UpdateUserTest extends TestCase final class UpdateUserTest extends TestCase
{ {
public function testUsersCanBeActivatedWithNumber(): void public function testUsersCanBeActivatedWithNumber()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => 0]); $user = User::factory()->create(['activated' => 0]);
@ -22,7 +22,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(1, $user->refresh()->activated); $this->assertEquals(1, $user->refresh()->activated);
} }
public function testUsersCanBeActivatedWithBooleanTrue(): void public function testUsersCanBeActivatedWithBooleanTrue()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => false]); $user = User::factory()->create(['activated' => false]);
@ -37,7 +37,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(1, $user->refresh()->activated); $this->assertEquals(1, $user->refresh()->activated);
} }
public function testUsersCanBeDeactivatedWithNumber(): void public function testUsersCanBeDeactivatedWithNumber()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => true]); $user = User::factory()->create(['activated' => true]);
@ -52,7 +52,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(0, $user->refresh()->activated); $this->assertEquals(0, $user->refresh()->activated);
} }
public function testUsersCanBeDeactivatedWithBooleanFalse(): void public function testUsersCanBeDeactivatedWithBooleanFalse()
{ {
$admin = User::factory()->superuser()->create(); $admin = User::factory()->superuser()->create();
$user = User::factory()->create(['activated' => true]); $user = User::factory()->create(['activated' => true]);
@ -67,7 +67,7 @@ final class UpdateUserTest extends TestCase
$this->assertEquals(0, $user->refresh()->activated); $this->assertEquals(0, $user->refresh()->activated);
} }
public function testUsersUpdatingThemselvesDoNotDeactivateTheirAccount(): void public function testUsersUpdatingThemselvesDoNotDeactivateTheirAccount()
{ {
$admin = User::factory()->superuser()->create(['activated' => true]); $admin = User::factory()->superuser()->create(['activated' => true]);

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class ViewUserTest extends TestCase final class ViewUserTest extends TestCase
{ {
public function testPermissionsForUserDetailPage(): void public function testPermissionsForUserDetailPage()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -29,7 +29,7 @@ final class ViewUserTest extends TestCase
->assertStatus(200); ->assertStatus(200);
} }
public function testPermissionsForPrintAllInventoryPage(): void public function testPermissionsForPrintAllInventoryPage()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -52,7 +52,7 @@ final class ViewUserTest extends TestCase
->assertStatus(200); ->assertStatus(200);
} }
public function testUserWithoutCompanyPermissionsCannotSendInventory(): void public function testUserWithoutCompanyPermissionsCannotSendInventory()
{ {
Notification::fake(); Notification::fake();

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class AccessoryTest extends TestCase final class AccessoryTest extends TestCase
{ {
public function testAnAccessoryBelongsToACompany(): void public function testAnAccessoryBelongsToACompany()
{ {
$accessory = Accessory::factory() $accessory = Accessory::factory()
->create( ->create(
@ -20,7 +20,7 @@ final class AccessoryTest extends TestCase
$this->assertInstanceOf(Company::class, $accessory->company); $this->assertInstanceOf(Company::class, $accessory->company);
} }
public function testAnAccessoryHasALocation(): void public function testAnAccessoryHasALocation()
{ {
$accessory = Accessory::factory() $accessory = Accessory::factory()
->create( ->create(
@ -30,7 +30,7 @@ final class AccessoryTest extends TestCase
$this->assertInstanceOf(Location::class, $accessory->location); $this->assertInstanceOf(Location::class, $accessory->location);
} }
public function testAnAccessoryBelongsToACategory(): void public function testAnAccessoryBelongsToACategory()
{ {
$accessory = Accessory::factory()->appleBtKeyboard() $accessory = Accessory::factory()->appleBtKeyboard()
->create( ->create(
@ -45,7 +45,7 @@ final class AccessoryTest extends TestCase
$this->assertEquals('accessory', $accessory->category->category_type); $this->assertEquals('accessory', $accessory->category->category_type);
} }
public function testAnAccessoryHasAManufacturer(): void public function testAnAccessoryHasAManufacturer()
{ {
$accessory = Accessory::factory()->appleBtKeyboard()->create( $accessory = Accessory::factory()->appleBtKeyboard()->create(
[ [

View file

@ -6,7 +6,7 @@ use Tests\TestCase;
final class AssetMaintenanceTest extends TestCase final class AssetMaintenanceTest extends TestCase
{ {
public function testZerosOutWarrantyIfBlank(): void public function testZerosOutWarrantyIfBlank()
{ {
$c = new AssetMaintenance; $c = new AssetMaintenance;
$c->is_warranty = ''; $c->is_warranty = '';
@ -15,7 +15,7 @@ final class AssetMaintenanceTest extends TestCase
$this->assertTrue($c->is_warranty == 4); $this->assertTrue($c->is_warranty == 4);
} }
public function testSetsCostsAppropriately(): void public function testSetsCostsAppropriately()
{ {
$c = new AssetMaintenance(); $c = new AssetMaintenance();
$c->cost = '0.00'; $c->cost = '0.00';
@ -26,7 +26,7 @@ final class AssetMaintenanceTest extends TestCase
$this->assertTrue($c->cost === 9.5); $this->assertTrue($c->cost === 9.5);
} }
public function testNullsOutNotesIfBlank(): void public function testNullsOutNotesIfBlank()
{ {
$c = new AssetMaintenance; $c = new AssetMaintenance;
$c->notes = ''; $c->notes = '';
@ -35,7 +35,7 @@ final class AssetMaintenanceTest extends TestCase
$this->assertTrue($c->notes === 'This is a long note'); $this->assertTrue($c->notes === 'This is a long note');
} }
public function testNullsOutCompletionDateIfBlankOrInvalid(): void public function testNullsOutCompletionDateIfBlankOrInvalid()
{ {
$c = new AssetMaintenance; $c = new AssetMaintenance;
$c->completion_date = ''; $c->completion_date = '';

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class AssetModelTest extends TestCase final class AssetModelTest extends TestCase
{ {
public function testAnAssetModelContainsAssets(): void public function testAnAssetModelContainsAssets()
{ {
$category = Category::factory()->create([ $category = Category::factory()->create([
'category_type' => 'asset' 'category_type' => 'asset'

View file

@ -10,7 +10,7 @@ use App\Models\Setting;
final class AssetTest extends TestCase final class AssetTest extends TestCase
{ {
public function testAutoIncrement(): void public function testAutoIncrement()
{ {
$this->settings->enableAutoIncrement(); $this->settings->enableAutoIncrement();
@ -22,7 +22,7 @@ final class AssetTest extends TestCase
} }
public function testAutoIncrementCollision(): void public function testAutoIncrementCollision()
{ {
$this->settings->enableAutoIncrement(); $this->settings->enableAutoIncrement();
@ -34,7 +34,7 @@ final class AssetTest extends TestCase
$this->assertFalse($b->save()); $this->assertFalse($b->save());
} }
public function testAutoIncrementDouble(): void public function testAutoIncrementDouble()
{ {
// make one asset with the autoincrement *ONE* higher than the next auto-increment // make one asset with the autoincrement *ONE* higher than the next auto-increment
// make sure you can then still make another // make sure you can then still make another
@ -53,7 +53,7 @@ final class AssetTest extends TestCase
$this->assertEquals($c->asset_tag, $final_number); $this->assertEquals($c->asset_tag, $final_number);
} }
public function testAutoIncrementGapAndBackfill(): void public function testAutoIncrementGapAndBackfill()
{ {
// make one asset 3 higher than the next auto-increment // make one asset 3 higher than the next auto-increment
// manually make one that's 1 lower than that // manually make one that's 1 lower than that
@ -82,7 +82,7 @@ final class AssetTest extends TestCase
$this->assertEquals($final->asset_tag, $final_result); $this->assertEquals($final->asset_tag, $final_result);
} }
public function testPrefixlessAutoincrementBackfill(): void public function testPrefixlessAutoincrementBackfill()
{ {
// TODO: COPYPASTA FROM above, is there a way to still run this test but not have it be so duplicative? // 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' => '']); $this->settings->enableAutoIncrement()->set(['auto_increment_prefix' => '']);
@ -109,7 +109,7 @@ final class AssetTest extends TestCase
$this->assertEquals($final->asset_tag, $final_result); $this->assertEquals($final->asset_tag, $final_result);
} }
public function testUnzerofilledPrefixlessAutoincrementBackfill(): void public function testUnzerofilledPrefixlessAutoincrementBackfill()
{ {
// TODO: COPYPASTA FROM above (AGAIN), is there a way to still run this test but not have it be so duplicative? // TODO: COPYPASTA FROM above (AGAIN), is there a way to still run this test but not have it be so duplicative?
$this->settings->enableAutoIncrement()->set(['auto_increment_prefix' => '','zerofill_count' => 0]); $this->settings->enableAutoIncrement()->set(['auto_increment_prefix' => '','zerofill_count' => 0]);
@ -136,7 +136,7 @@ final class AssetTest extends TestCase
$this->assertEquals($final->asset_tag, $final_result); $this->assertEquals($final->asset_tag, $final_result);
} }
public function testAutoIncrementBIG(): void public function testAutoIncrementBIG()
{ {
$this->settings->enableAutoIncrement(); $this->settings->enableAutoIncrement();
@ -153,7 +153,7 @@ final 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"); $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(): void public function testAutoIncrementAlmostBIG()
{ {
// TODO: this looks pretty close to the one above, could we maybe squish them together? // TODO: this looks pretty close to the one above, could we maybe squish them together?
$this->settings->enableAutoIncrement(); $this->settings->enableAutoIncrement();
@ -170,7 +170,7 @@ final class AssetTest extends TestCase
} }
public function testWarrantyExpiresAttribute(): void public function testWarrantyExpiresAttribute()
{ {
$asset = Asset::factory() $asset = Asset::factory()

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class CategoryTest extends TestCase final class CategoryTest extends TestCase
{ {
public function testFailsEmptyValidation(): void public function testFailsEmptyValidation()
{ {
// An Asset requires a name, a qty, and a category_id. // An Asset requires a name, a qty, and a category_id.
$a = Category::create(); $a = Category::create();
@ -24,7 +24,7 @@ final class CategoryTest extends TestCase
} }
} }
public function testACategoryCanHaveAssets(): void public function testACategoryCanHaveAssets()
{ {
$category = Category::factory()->assetDesktopCategory()->create(); $category = Category::factory()->assetDesktopCategory()->create();

View file

@ -29,7 +29,7 @@ final class CompanyScopingTest extends TestCase
} }
#[DataProvider('models')] #[DataProvider('models')]
public function testCompanyScoping($model): void public function testCompanyScoping($model)
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();
@ -69,7 +69,7 @@ final class CompanyScopingTest extends TestCase
$this->assertCanSee($modelB); $this->assertCanSee($modelB);
} }
public function testAssetMaintenanceCompanyScoping(): void public function testAssetMaintenanceCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();
@ -109,7 +109,7 @@ final class CompanyScopingTest extends TestCase
$this->assertCanSee($assetMaintenanceForCompanyB); $this->assertCanSee($assetMaintenanceForCompanyB);
} }
public function testLicenseSeatCompanyScoping(): void public function testLicenseSeatCompanyScoping()
{ {
[$companyA, $companyB] = Company::factory()->count(2)->create(); [$companyA, $companyB] = Company::factory()->count(2)->create();

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class ComponentTest extends TestCase final class ComponentTest extends TestCase
{ {
public function testAComponentBelongsToACompany(): void public function testAComponentBelongsToACompany()
{ {
$component = Component::factory() $component = Component::factory()
->create( ->create(
@ -20,14 +20,14 @@ final class ComponentTest extends TestCase
$this->assertInstanceOf(Company::class, $component->company); $this->assertInstanceOf(Company::class, $component->company);
} }
public function testAComponentHasALocation(): void public function testAComponentHasALocation()
{ {
$component = Component::factory() $component = Component::factory()
->create(['location_id' => Location::factory()->create()->id]); ->create(['location_id' => Location::factory()->create()->id]);
$this->assertInstanceOf(Location::class, $component->location); $this->assertInstanceOf(Location::class, $component->location);
} }
public function testAComponentBelongsToACategory(): void public function testAComponentBelongsToACategory()
{ {
$component = Component::factory()->ramCrucial4() $component = Component::factory()->ramCrucial4()
->create( ->create(

View file

@ -10,14 +10,14 @@ use Tests\TestCase;
*/ */
final class CustomFieldTest extends TestCase final class CustomFieldTest extends TestCase
{ {
public function testFormat(): void public function testFormat()
{ {
$customfield = CustomField::factory()->make(['format' => 'IP']); $customfield = CustomField::factory()->make(['format' => 'IP']);
$this->assertEquals($customfield->getAttributes()['format'], CustomField::PREDEFINED_FORMATS['IP']); //this seems undocumented... $this->assertEquals($customfield->getAttributes()['format'], CustomField::PREDEFINED_FORMATS['IP']); //this seems undocumented...
$this->assertEquals($customfield->format, 'IP'); $this->assertEquals($customfield->format, 'IP');
} }
public function testDbNameAscii(): void public function testDbNameAscii()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = 'My hovercraft is full of eels'; $customfield->name = 'My hovercraft is full of eels';
@ -26,7 +26,7 @@ final class CustomFieldTest extends TestCase
} }
// Western Europe // Western Europe
public function testDbNameLatin(): void public function testDbNameLatin()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = 'My hovercraft is full of eels'; $customfield->name = 'My hovercraft is full of eels';
@ -35,7 +35,7 @@ final class CustomFieldTest extends TestCase
} }
// Asian // Asian
public function testDbNameChinese(): void public function testDbNameChinese()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = '我的氣墊船裝滿了鱔魚'; $customfield->name = '我的氣墊船裝滿了鱔魚';
@ -47,7 +47,7 @@ final class CustomFieldTest extends TestCase
} }
} }
public function testDbNameJapanese(): void public function testDbNameJapanese()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = '私のホバークラフトは鰻でいっぱいです'; $customfield->name = '私のホバークラフトは鰻でいっぱいです';
@ -59,7 +59,7 @@ final class CustomFieldTest extends TestCase
} }
} }
public function testDbNameKorean(): void public function testDbNameKorean()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = '내 호버크라프트는 장어로 가득 차 있어요'; $customfield->name = '내 호버크라프트는 장어로 가득 차 있어요';
@ -72,7 +72,7 @@ final class CustomFieldTest extends TestCase
} }
// Nordic languages // Nordic languages
public function testDbNameNonLatinEuro(): void public function testDbNameNonLatinEuro()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = 'Mój poduszkowiec jest pełen węgorzy'; $customfield->name = 'Mój poduszkowiec jest pełen węgorzy';
@ -85,7 +85,7 @@ final class CustomFieldTest extends TestCase
} }
// //
public function testDbNameTurkish(): void public function testDbNameTurkish()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = 'Hoverkraftım yılan balığı dolu'; $customfield->name = 'Hoverkraftım yılan balığı dolu';
@ -97,7 +97,7 @@ final class CustomFieldTest extends TestCase
} }
} }
public function testDbNameArabic(): void public function testDbNameArabic()
{ {
$customfield = new CustomField(); $customfield = new CustomField();
$customfield->name = 'حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون'; $customfield->name = 'حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون';

View file

@ -9,7 +9,7 @@ use Tests\TestCase;
final class DepreciationTest extends TestCase final class DepreciationTest extends TestCase
{ {
public function testADepreciationHasModels(): void public function testADepreciationHasModels()
{ {
$depreciation = Depreciation::factory()->create(); $depreciation = Depreciation::factory()->create();
@ -26,7 +26,7 @@ final class DepreciationTest extends TestCase
$this->assertEquals(5, $depreciation->models->count()); $this->assertEquals(5, $depreciation->models->count());
} }
public function testADepreciationHasLicenses(): void public function testADepreciationHasLicenses()
{ {
$depreciation = Depreciation::factory()->create(); $depreciation = Depreciation::factory()->create();

View file

@ -10,17 +10,17 @@ use Tests\TestCase;
final class HelperTest extends TestCase final class HelperTest extends TestCase
{ {
public function testDefaultChartColorsMethodHandlesHighValues(): void public function testDefaultChartColorsMethodHandlesHighValues()
{ {
$this->assertIsString(Helper::defaultChartColors(1000)); $this->assertIsString(Helper::defaultChartColors(1000));
} }
public function testDefaultChartColorsMethodHandlesNegativeNumbers(): void public function testDefaultChartColorsMethodHandlesNegativeNumbers()
{ {
$this->assertIsString(Helper::defaultChartColors(-1)); $this->assertIsString(Helper::defaultChartColors(-1));
} }
public function testParseCurrencyMethod(): void public function testParseCurrencyMethod()
{ {
$this->settings->set(['default_currency' => 'USD']); $this->settings->set(['default_currency' => 'USD']);
$this->assertSame(12.34, Helper::ParseCurrency('USD 12.34')); $this->assertSame(12.34, Helper::ParseCurrency('USD 12.34'));
@ -28,7 +28,7 @@ final class HelperTest extends TestCase
$this->settings->set(['digit_separator' => '1.234,56']); $this->settings->set(['digit_separator' => '1.234,56']);
$this->assertSame(12.34, Helper::ParseCurrency('12,34')); $this->assertSame(12.34, Helper::ParseCurrency('12,34'));
} }
public function testGetRedirectOptionMethod(): void public function testGetRedirectOptionMethod()
{ {
$test_data = [ $test_data = [
'Option target: redirect for user assigned to ' => [ 'Option target: redirect for user assigned to ' => [

View file

@ -11,7 +11,7 @@ final class LdapTest extends TestCase
{ {
use \phpmock\phpunit\PHPMock; use \phpmock\phpunit\PHPMock;
public function testConnect(): void public function testConnect()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();
@ -31,14 +31,14 @@ final class LdapTest extends TestCase
// with/without ignore cert validation? // with/without ignore cert validation?
// test (and mock) ldap_start_tls() ? // test (and mock) ldap_start_tls() ?
public function testBindAdmin(): void public function testBindAdmin()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();
$this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true); $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true);
$this->assertNull(Ldap::bindAdminToLdap("dummy")); $this->assertNull(Ldap::bindAdminToLdap("dummy"));
} }
public function testBindBad(): void public function testBindBad()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();
$this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false); $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false);
@ -49,7 +49,7 @@ final class LdapTest extends TestCase
} }
// other test cases - test donked password? // other test cases - test donked password?
public function testAnonymousBind(): void public function testAnonymousBind()
{ {
//todo - would be nice to introspect somehow to make sure the right parameters were passed? //todo - would be nice to introspect somehow to make sure the right parameters were passed?
$this->settings->enableAnonymousLdap(); $this->settings->enableAnonymousLdap();
@ -57,7 +57,7 @@ final class LdapTest extends TestCase
$this->assertNull(Ldap::bindAdminToLdap("dummy")); $this->assertNull(Ldap::bindAdminToLdap("dummy"));
} }
public function testBadAnonymousBind(): void public function testBadAnonymousBind()
{ {
$this->settings->enableAnonymousLdap(); $this->settings->enableAnonymousLdap();
$this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false); $this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(false);
@ -67,7 +67,7 @@ final class LdapTest extends TestCase
$this->assertNull(Ldap::bindAdminToLdap("dummy")); $this->assertNull(Ldap::bindAdminToLdap("dummy"));
} }
public function testBadEncryptedPassword(): void public function testBadEncryptedPassword()
{ {
$this->settings->enableBadPasswordLdap(); $this->settings->enableBadPasswordLdap();
@ -75,7 +75,7 @@ final class LdapTest extends TestCase
$this->assertNull(Ldap::bindAdminToLdap("dummy")); $this->assertNull(Ldap::bindAdminToLdap("dummy"));
} }
public function testFindAndBind(): void public function testFindAndBind()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();
@ -105,7 +105,7 @@ final class LdapTest extends TestCase
$this->assertEqualsCanonicalizing(["count" =>1,0 =>['sn' => 'Surname','firstname' => 'FirstName']],$results); $this->assertEqualsCanonicalizing(["count" =>1,0 =>['sn' => 'Surname','firstname' => 'FirstName']],$results);
} }
public function testFindAndBindBadPassword(): void public function testFindAndBindBadPassword()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();
@ -126,7 +126,7 @@ final class LdapTest extends TestCase
$this->assertFalse($results); $this->assertFalse($results);
} }
public function testFindAndBindCannotFindSelf(): void public function testFindAndBindCannotFindSelf()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();
@ -147,7 +147,7 @@ final class LdapTest extends TestCase
//maybe should do an AD test as well? //maybe should do an AD test as well?
public function testFindLdapUsers(): void public function testFindLdapUsers()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();
@ -170,7 +170,7 @@ final class LdapTest extends TestCase
$this->assertEqualsCanonicalizing(["count" => 1], $results); $this->assertEqualsCanonicalizing(["count" => 1], $results);
} }
public function testFindLdapUsersPaginated(): void public function testFindLdapUsersPaginated()
{ {
$this->settings->enableLdap(); $this->settings->enableLdap();

View file

@ -10,7 +10,7 @@ use Tests\TestCase;
final class LogListenerTest extends TestCase final class LogListenerTest extends TestCase
{ {
public function testLogsEntryOnCheckoutableCheckedOut(): void public function testLogsEntryOnCheckoutableCheckedOut()
{ {
$asset = Asset::factory()->create(); $asset = Asset::factory()->create();
$checkedOutTo = User::factory()->create(); $checkedOutTo = User::factory()->create();

View file

@ -6,7 +6,7 @@ use Tests\TestCase;
final class LocationTest extends TestCase final class LocationTest extends TestCase
{ {
public function testPassesIfNotSelfParent(): void public function testPassesIfNotSelfParent()
{ {
$a = Location::factory()->make([ $a = Location::factory()->make([
'name' => 'Test Location', 'name' => 'Test Location',
@ -17,7 +17,7 @@ final class LocationTest extends TestCase
$this->assertTrue($a->isValid()); $this->assertTrue($a->isValid());
} }
public function testFailsIfSelfParent(): void public function testFailsIfSelfParent()
{ {
$a = Location::factory()->make([ $a = Location::factory()->make([
'name' => 'Test Location', 'name' => 'Test Location',

View file

@ -7,7 +7,7 @@ use Tests\TestCase;
final class CompanyTest extends TestCase final class CompanyTest extends TestCase
{ {
public function testACompanyCanHaveUsers(): void public function testACompanyCanHaveUsers()
{ {
$company = Company::factory()->create(); $company = Company::factory()->create();
$user = User::factory() $user = User::factory()

View file

@ -8,7 +8,7 @@ use Tests\TestCase;
final class GetIdForCurrentUserTest extends TestCase final class GetIdForCurrentUserTest extends TestCase
{ {
public function testReturnsProvidedValueWhenFullCompanySupportDisabled(): void public function testReturnsProvidedValueWhenFullCompanySupportDisabled()
{ {
$this->settings->disableMultipleFullCompanySupport(); $this->settings->disableMultipleFullCompanySupport();
@ -16,7 +16,7 @@ final class GetIdForCurrentUserTest extends TestCase
$this->assertEquals(1000, Company::getIdForCurrentUser(1000)); $this->assertEquals(1000, Company::getIdForCurrentUser(1000));
} }
public function testReturnsProvidedValueForSuperUsersWhenFullCompanySupportEnabled(): void public function testReturnsProvidedValueForSuperUsersWhenFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -24,7 +24,7 @@ final class GetIdForCurrentUserTest extends TestCase
$this->assertEquals(2000, Company::getIdForCurrentUser(2000)); $this->assertEquals(2000, Company::getIdForCurrentUser(2000));
} }
public function testReturnsNonSuperUsersCompanyIdWhenFullCompanySupportEnabled(): void public function testReturnsNonSuperUsersCompanyIdWhenFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();
@ -32,7 +32,7 @@ final class GetIdForCurrentUserTest extends TestCase
$this->assertEquals(2000, Company::getIdForCurrentUser(1000)); $this->assertEquals(2000, Company::getIdForCurrentUser(1000));
} }
public function testReturnsProvidedValueForNonSuperUserWithoutCompanyIdWhenFullCompanySupportEnabled(): void public function testReturnsProvidedValueForNonSuperUserWithoutCompanyIdWhenFullCompanySupportEnabled()
{ {
$this->settings->enableMultipleFullCompanySupport(); $this->settings->enableMultipleFullCompanySupport();

Some files were not shown because too many files have changed in this diff Show more