mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Revert "Add return types to test methods"
This reverts commit 83fb6826ee
.
This commit is contained in:
parent
95516b0343
commit
82e795b642
|
@ -12,14 +12,14 @@ final class CreateAssetModelsTest extends TestCase
|
|||
{
|
||||
|
||||
|
||||
public function testRequiresPermissionToCreateAssetModel(): void
|
||||
public function testRequiresPermissionToCreateAssetModel()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.models.store'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCanCreateAssetModelWithAssetModelType(): void
|
||||
public function testCanCreateAssetModelWithAssetModelType()
|
||||
{
|
||||
$response = $this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->postJson(route('api.models.store'), [
|
||||
|
@ -37,7 +37,7 @@ final class CreateAssetModelsTest extends TestCase
|
|||
$this->assertEquals('Test AssetModel', $model->name);
|
||||
}
|
||||
|
||||
public function testCannotCreateAssetModelWithoutCategory(): void
|
||||
public function testCannotCreateAssetModelWithoutCategory()
|
||||
{
|
||||
$response = $this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->postJson(route('api.models.store'), [
|
||||
|
|
|
@ -10,19 +10,19 @@ use Tests\TestCase;
|
|||
|
||||
final class IndexAssetModelsTest extends TestCase
|
||||
{
|
||||
public function testViewingAssetModelIndexRequiresAuthentication(): void
|
||||
public function testViewingAssetModelIndexRequiresAuthentication()
|
||||
{
|
||||
$this->getJson(route('api.models.index'))->assertRedirect();
|
||||
}
|
||||
|
||||
public function testViewingAssetModelIndexRequiresPermission(): void
|
||||
public function testViewingAssetModelIndexRequiresPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->getJson(route('api.models.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testAssetModelIndexReturnsExpectedAssetModels(): void
|
||||
public function testAssetModelIndexReturnsExpectedAssetModels()
|
||||
{
|
||||
AssetModel::factory()->count(3)->create();
|
||||
|
||||
|
@ -42,7 +42,7 @@ final class IndexAssetModelsTest extends TestCase
|
|||
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
|
||||
}
|
||||
|
||||
public function testAssetModelIndexSearchReturnsExpectedAssetModels(): void
|
||||
public function testAssetModelIndexSearchReturnsExpectedAssetModels()
|
||||
{
|
||||
AssetModel::factory()->count(3)->create();
|
||||
AssetModel::factory()->count(1)->create(['name' => 'Test Model']);
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
final class UpdateAssetModelsTest extends TestCase
|
||||
{
|
||||
|
||||
public function testRequiresPermissionToEditAssetModel(): void
|
||||
public function testRequiresPermissionToEditAssetModel()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
|
@ -18,7 +18,7 @@ final class UpdateAssetModelsTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCanUpdateAssetModelViaPatch(): void
|
||||
public function testCanUpdateAssetModelViaPatch()
|
||||
{
|
||||
$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();
|
||||
$model = AssetModel::factory()->create();
|
||||
|
@ -57,7 +57,7 @@ final class UpdateAssetModelsTest extends TestCase
|
|||
$this->assertNotEquals('category_id', $category->id, 'Category ID was not updated');
|
||||
}
|
||||
|
||||
public function testCannotUpdateAssetModelViaPatchWithLicenseCategory(): void
|
||||
public function testCannotUpdateAssetModelViaPatchWithLicenseCategory()
|
||||
{
|
||||
$category = Category::factory()->forLicenses()->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');
|
||||
}
|
||||
|
||||
public function testCannotUpdateAssetModelViaPatchWithConsumableCategory(): void
|
||||
public function testCannotUpdateAssetModelViaPatchWithConsumableCategory()
|
||||
{
|
||||
$category = Category::factory()->forConsumables()->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');
|
||||
}
|
||||
|
||||
public function testCannotUpdateAssetModelViaPatchWithComponentCategory(): void
|
||||
public function testCannotUpdateAssetModelViaPatchWithComponentCategory()
|
||||
{
|
||||
$category = Category::factory()->forComponents()->create();
|
||||
$model = AssetModel::factory()->create();
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CreateAssetModelsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToCreateAssetModel(): void
|
||||
public function testPermissionRequiredToCreateAssetModel()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('models.store'), [
|
||||
|
@ -19,7 +19,7 @@ final class CreateAssetModelsTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanCreateAssetModels(): void
|
||||
public function testUserCanCreateAssetModels()
|
||||
{
|
||||
$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());
|
||||
}
|
||||
|
||||
public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType(): void
|
||||
public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType()
|
||||
{
|
||||
|
||||
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||
|
|
|
@ -7,14 +7,14 @@ use Tests\TestCase;
|
|||
|
||||
final class IndexAssetModelsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewAssetModelList(): void
|
||||
public function testPermissionRequiredToViewAssetModelList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('models.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListAssetModels(): void
|
||||
public function testUserCanListAssetModels()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('models.index'))
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class UpdateAssetModelsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToStoreAssetModel(): void
|
||||
public function testPermissionRequiredToStoreAssetModel()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('models.store'), [
|
||||
|
@ -20,7 +20,7 @@ final class UpdateAssetModelsTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanEditAssetModels(): void
|
||||
public function testUserCanEditAssetModels()
|
||||
{
|
||||
$category = Category::factory()->forAssets()->create();
|
||||
$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();
|
||||
$model = AssetModel::factory()->create(['name' => 'Test Model', 'category_id' => $category->id]);
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AssetFilesTest extends TestCase
|
||||
{
|
||||
public function testAssetApiAcceptsFileUpload(): void
|
||||
public function testAssetApiAcceptsFileUpload()
|
||||
{
|
||||
// Upload a file to an asset
|
||||
|
||||
|
@ -28,7 +28,7 @@ final class AssetFilesTest extends TestCase
|
|||
->assertOk();
|
||||
}
|
||||
|
||||
public function testAssetApiListsFiles(): void
|
||||
public function testAssetApiListsFiles()
|
||||
{
|
||||
// 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
|
||||
|
||||
|
@ -84,7 +84,7 @@ final class AssetFilesTest extends TestCase
|
|||
->assertOk();
|
||||
}
|
||||
|
||||
public function testAssetApiDeletesFile(): void
|
||||
public function testAssetApiDeletesFile()
|
||||
{
|
||||
// Delete a file from an asset
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AssetIndexTest extends TestCase
|
||||
{
|
||||
public function testAssetApiIndexReturnsExpectedAssets(): void
|
||||
public function testAssetApiIndexReturnsExpectedAssets()
|
||||
{
|
||||
Asset::factory()->count(3)->create();
|
||||
|
||||
|
@ -31,7 +31,7 @@ final class AssetIndexTest extends TestCase
|
|||
->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')]);
|
||||
|
||||
|
@ -47,7 +47,7 @@ final class AssetIndexTest extends TestCase
|
|||
->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')]);
|
||||
|
||||
|
@ -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(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')]);
|
||||
|
||||
|
@ -97,7 +97,7 @@ final class AssetIndexTest extends TestCase
|
|||
->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')]);
|
||||
|
||||
|
@ -111,7 +111,7 @@ final class AssetIndexTest extends TestCase
|
|||
->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(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());
|
||||
}
|
||||
|
||||
public function testAssetApiIndexAdheresToCompanyScoping(): void
|
||||
public function testAssetApiIndexAdheresToCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AssetsForSelectListTest extends TestCase
|
||||
{
|
||||
public function testAssetsCanBeSearchedForByAssetTag(): void
|
||||
public function testAssetsCanBeSearchedForByAssetTag()
|
||||
{
|
||||
Asset::factory()->create(['asset_tag' => '0001']);
|
||||
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')));
|
||||
}
|
||||
|
||||
public function testAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled(): void
|
||||
public function testAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ use Tests\TestCase;
|
|||
|
||||
final class RequestableAssetTest extends TestCase
|
||||
{
|
||||
public function testViewingRequestableAssetsRequiresCorrectPermission(): void
|
||||
public function testViewingRequestableAssetsRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->getJson(route('api.assets.requestable'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testReturnsRequestableAssets(): void
|
||||
public function testReturnsRequestableAssets()
|
||||
{
|
||||
$requestableAsset = Asset::factory()->requestable()->create(['asset_tag' => 'requestable']);
|
||||
$nonRequestableAsset = Asset::factory()->nonrequestable()->create(['asset_tag' => 'non-requestable']);
|
||||
|
@ -28,7 +28,7 @@ final class RequestableAssetTest extends TestCase
|
|||
->assertResponseDoesNotContainInRows($nonRequestableAsset, 'asset_tag');
|
||||
}
|
||||
|
||||
public function testRequestableAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled(): void
|
||||
public function testRequestableAssetsAreScopedToCompanyWhenMultipleCompanySupportEnabled()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ use Tests\TestCase;
|
|||
|
||||
final class StoreAssetTest extends TestCase
|
||||
{
|
||||
public function testRequiresPermissionToCreateAsset(): void
|
||||
public function testRequiresPermissionToCreateAsset()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.assets.store'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testAllAssetAttributesAreStored(): void
|
||||
public function testAllAssetAttributesAreStored()
|
||||
{
|
||||
$company = Company::factory()->create();
|
||||
$location = Location::factory()->create();
|
||||
|
@ -83,7 +83,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertEquals(10, $asset->warranty_months);
|
||||
}
|
||||
|
||||
public function testSetsLastAuditDateToMidnightOfProvidedDate(): void
|
||||
public function testSetsLastAuditDateToMidnightOfProvidedDate()
|
||||
{
|
||||
$response = $this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->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);
|
||||
}
|
||||
|
||||
public function testLastAuditDateCanBeNull(): void
|
||||
public function testLastAuditDateCanBeNull()
|
||||
{
|
||||
$response = $this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->postJson(route('api.assets.store'), [
|
||||
|
@ -115,7 +115,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertNull($asset->last_audit_date);
|
||||
}
|
||||
|
||||
public function testNonDateUsedForLastAuditDateReturnsValidationError(): void
|
||||
public function testNonDateUsedForLastAuditDateReturnsValidationError()
|
||||
{
|
||||
$response = $this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->postJson(route('api.assets.store'), [
|
||||
|
@ -129,7 +129,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertNotNull($response->json('messages.last_audit_date'));
|
||||
}
|
||||
|
||||
public function testArchivedDepreciateAndPhysicalCanBeNull(): void
|
||||
public function testArchivedDepreciateAndPhysicalCanBeNull()
|
||||
{
|
||||
$model = AssetModel::factory()->ipadModel()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -154,7 +154,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertEquals(0, $asset->depreciate);
|
||||
}
|
||||
|
||||
public function testArchivedDepreciateAndPhysicalCanBeEmpty(): void
|
||||
public function testArchivedDepreciateAndPhysicalCanBeEmpty()
|
||||
{
|
||||
$model = AssetModel::factory()->ipadModel()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -179,7 +179,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertEquals(0, $asset->depreciate);
|
||||
}
|
||||
|
||||
public function testAssetEolDateIsCalculatedIfPurchaseDateSet(): void
|
||||
public function testAssetEolDateIsCalculatedIfPurchaseDateSet()
|
||||
{
|
||||
$model = AssetModel::factory()->mbp13Model()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -200,7 +200,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertEquals('2024-01-01', $asset->asset_eol_date);
|
||||
}
|
||||
|
||||
public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet(): void
|
||||
public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet()
|
||||
{
|
||||
$model = AssetModel::factory()->mbp13Model()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -220,7 +220,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertNull($asset->asset_eol_date);
|
||||
}
|
||||
|
||||
public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet(): void
|
||||
public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet()
|
||||
{
|
||||
$model = AssetModel::factory()->mbp13Model()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -242,7 +242,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertTrue($asset->eol_explicit);
|
||||
}
|
||||
|
||||
public function testAssetGetsAssetTagWithAutoIncrement(): void
|
||||
public function testAssetGetsAssetTagWithAutoIncrement()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -262,7 +262,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertNotNull($asset->asset_tag);
|
||||
}
|
||||
|
||||
public function testAssetCreationFailsWithNoAssetTagOrAutoIncrement(): void
|
||||
public function testAssetCreationFailsWithNoAssetTagOrAutoIncrement()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -278,7 +278,7 @@ final class StoreAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testStoresPeriodAsDecimalSeparatorForPurchaseCost(): void
|
||||
public function testStoresPeriodAsDecimalSeparatorForPurchaseCost()
|
||||
{
|
||||
$this->settings->set([
|
||||
'default_currency' => 'USD',
|
||||
|
@ -300,7 +300,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertEquals(12.34, $asset->purchase_cost);
|
||||
}
|
||||
|
||||
public function testStoresPeriodAsCommaSeparatorForPurchaseCost(): void
|
||||
public function testStoresPeriodAsCommaSeparatorForPurchaseCost()
|
||||
{
|
||||
$this->settings->set([
|
||||
'default_currency' => 'EUR',
|
||||
|
@ -322,7 +322,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertEquals(12.34, $asset->purchase_cost);
|
||||
}
|
||||
|
||||
public function testUniqueSerialNumbersIsEnforcedWhenEnabled(): void
|
||||
public function testUniqueSerialNumbersIsEnforcedWhenEnabled()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -350,7 +350,7 @@ final class StoreAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testUniqueSerialNumbersIsNotEnforcedWhenDisabled(): void
|
||||
public function testUniqueSerialNumbersIsNotEnforcedWhenDisabled()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -378,7 +378,7 @@ final class StoreAssetTest extends TestCase
|
|||
->assertStatusMessageIs('success');
|
||||
}
|
||||
|
||||
public function testAssetTagsMustBeUniqueWhenUndeleted(): void
|
||||
public function testAssetTagsMustBeUniqueWhenUndeleted()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -405,7 +405,7 @@ final class StoreAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testAssetTagsCanBeDuplicatedIfDeleted(): void
|
||||
public function testAssetTagsCanBeDuplicatedIfDeleted()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -435,7 +435,7 @@ final class StoreAssetTest extends TestCase
|
|||
->assertStatusMessageIs('success');
|
||||
}
|
||||
|
||||
public function testAnAssetCanBeCheckedOutToUserOnStore(): void
|
||||
public function testAnAssetCanBeCheckedOutToUserOnStore()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -461,7 +461,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertTrue($asset->assignedTo->is($userAssigned));
|
||||
}
|
||||
|
||||
public function testAnAssetCanBeCheckedOutToLocationOnStore(): void
|
||||
public function testAnAssetCanBeCheckedOutToLocationOnStore()
|
||||
{
|
||||
$model = AssetModel::factory()->create();
|
||||
$status = Statuslabel::factory()->create();
|
||||
|
@ -487,7 +487,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertTrue($asset->location->is($location));
|
||||
}
|
||||
|
||||
public function testAnAssetCanBeCheckedOutToAssetOnStore(): void
|
||||
public function testAnAssetCanBeCheckedOutToAssetOnStore()
|
||||
{
|
||||
$model = AssetModel::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));
|
||||
}
|
||||
|
||||
public function testCompanyIdNeedsToBeInteger(): void
|
||||
public function testCompanyIdNeedsToBeInteger()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->createAssets()->create())
|
||||
->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');
|
||||
|
||||
|
@ -550,7 +550,7 @@ final class StoreAssetTest extends TestCase
|
|||
$this->assertEquals('This is encrypted field', Crypt::decrypt($asset->{$field->db_column_name()}));
|
||||
}
|
||||
|
||||
public function testPermissionNeededToStoreEncryptedField(): void
|
||||
public function testPermissionNeededToStoreEncryptedField()
|
||||
{
|
||||
// @todo:
|
||||
$this->markTestIncomplete();
|
||||
|
|
|
@ -15,14 +15,14 @@ use Tests\TestCase;
|
|||
|
||||
final class UpdateAssetTest extends TestCase
|
||||
{
|
||||
public function testThatANonExistentAssetIdReturnsError(): void
|
||||
public function testThatANonExistentAssetIdReturnsError()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->editAssets()->createAssets()->create())
|
||||
->patchJson(route('api.assets.update', 123456789))
|
||||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testRequiresPermissionToUpdateAsset(): void
|
||||
public function testRequiresPermissionToUpdateAsset()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
|
||||
|
@ -31,7 +31,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testGivenPermissionUpdateAssetIsAllowed(): void
|
||||
public function testGivenPermissionUpdateAssetIsAllowed()
|
||||
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
|
@ -43,7 +43,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertOk();
|
||||
}
|
||||
|
||||
public function testAllAssetAttributesAreStored(): void
|
||||
public function testAllAssetAttributesAreStored()
|
||||
{
|
||||
$asset = Asset::factory()->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);
|
||||
}
|
||||
|
||||
public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated(): void
|
||||
public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create();
|
||||
|
||||
|
@ -120,7 +120,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertEquals('2024-01-01', $asset->asset_eol_date);
|
||||
}
|
||||
|
||||
public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet(): void
|
||||
public function testAssetEolDateIsNotCalculatedIfPurchaseDateNotSet()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->noPurchaseOrEolDate()->create();
|
||||
|
||||
|
@ -138,7 +138,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertEquals('2022-01-01', $asset->asset_eol_date);
|
||||
}
|
||||
|
||||
public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet(): void
|
||||
public function testAssetEolExplicitIsSetIfAssetEolDateIsExplicitlySet()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
||||
|
@ -156,7 +156,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertTrue($asset->eol_explicit);
|
||||
}
|
||||
|
||||
public function testAssetTagCannotUpdateToNullValue(): void
|
||||
public function testAssetTagCannotUpdateToNullValue()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
||||
|
@ -168,7 +168,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testAssetTagCannotUpdateToEmptyStringValue(): void
|
||||
public function testAssetTagCannotUpdateToEmptyStringValue()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
||||
|
@ -180,7 +180,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testModelIdCannotUpdateToNullValue(): void
|
||||
public function testModelIdCannotUpdateToNullValue()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
||||
|
@ -192,7 +192,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testModelIdCannotUpdateToEmptyStringValue(): void
|
||||
public function testModelIdCannotUpdateToEmptyStringValue()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
||||
|
@ -204,7 +204,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testStatusIdCannotUpdateToNullValue(): void
|
||||
public function testStatusIdCannotUpdateToNullValue()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
||||
|
@ -216,7 +216,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testStatusIdCannotUpdateToEmptyStringValue(): void
|
||||
public function testStatusIdCannotUpdateToEmptyStringValue()
|
||||
{
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
||||
|
@ -228,7 +228,7 @@ final class UpdateAssetTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testIfRtdLocationIdIsSetWithoutLocationIdAssetReturnsToDefault(): void
|
||||
public function testIfRtdLocationIdIsSetWithoutLocationIdAssetReturnsToDefault()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
$asset = Asset::factory()->laptopMbp()->create([
|
||||
|
@ -247,7 +247,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertTrue($asset->location->is($rtdLocation));
|
||||
}
|
||||
|
||||
public function testIfLocationAndRtdLocationAreSetLocationIdIsLocation(): void
|
||||
public function testIfLocationAndRtdLocationAreSetLocationIdIsLocation()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
$asset = Asset::factory()->laptopMbp()->create();
|
||||
|
@ -265,7 +265,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertTrue($asset->location->is($location));
|
||||
}
|
||||
|
||||
public function testEncryptedCustomFieldCanBeUpdated(): void
|
||||
public function testEncryptedCustomFieldCanBeUpdated()
|
||||
{
|
||||
$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()}));
|
||||
}
|
||||
|
||||
public function testPermissionNeededToUpdateEncryptedField(): void
|
||||
public function testPermissionNeededToUpdateEncryptedField()
|
||||
{
|
||||
$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()}));
|
||||
}
|
||||
|
||||
public function testCheckoutToUserOnAssetUpdate(): void
|
||||
public function testCheckoutToUserOnAssetUpdate()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$user = User::factory()->editAssets()->create();
|
||||
|
@ -327,7 +327,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertEquals($asset->assigned_type, 'App\Models\User');
|
||||
}
|
||||
|
||||
public function testCheckoutToDeletedUserFailsOnAssetUpdate(): void
|
||||
public function testCheckoutToDeletedUserFailsOnAssetUpdate()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$user = User::factory()->editAssets()->create();
|
||||
|
@ -346,7 +346,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertNull($asset->assigned_type);
|
||||
}
|
||||
|
||||
public function testCheckoutToLocationOnAssetUpdate(): void
|
||||
public function testCheckoutToLocationOnAssetUpdate()
|
||||
{
|
||||
$asset = Asset::factory()->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();
|
||||
$user = User::factory()->editAssets()->create();
|
||||
|
@ -385,7 +385,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertNull($asset->assigned_type);
|
||||
}
|
||||
|
||||
public function testCheckoutAssetOnAssetUpdate(): void
|
||||
public function testCheckoutAssetOnAssetUpdate()
|
||||
{
|
||||
$asset = Asset::factory()->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();
|
||||
$user = User::factory()->editAssets()->create();
|
||||
|
@ -425,7 +425,7 @@ final class UpdateAssetTest extends TestCase
|
|||
$this->assertNull($asset->assigned_type);
|
||||
}
|
||||
|
||||
public function testAssetCannotBeUpdatedByUserInSeparateCompany(): void
|
||||
public function testAssetCannotBeUpdatedByUserInSeparateCompany()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
|
||||
final class BulkDeleteAssetsTest extends TestCase
|
||||
{
|
||||
public function testUserWithPermissionsCanAccessPage(): void
|
||||
public function testUserWithPermissionsCanAccessPage()
|
||||
{
|
||||
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
|
||||
$assets = Asset::factory()->count(2)->create();
|
||||
|
@ -25,7 +25,7 @@ final class BulkDeleteAssetsTest extends TestCase
|
|||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testStandardUserCannotAccessPage(): void
|
||||
public function testStandardUserCannotAccessPage()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$assets = Asset::factory()->count(2)->create();
|
||||
|
@ -38,7 +38,7 @@ final class BulkDeleteAssetsTest extends TestCase
|
|||
])->assertStatus(403);
|
||||
}
|
||||
|
||||
public function testPageRedirectFromInterstitialIfNoAssetsSelectedToDelete(): void
|
||||
public function testPageRedirectFromInterstitialIfNoAssetsSelectedToDelete()
|
||||
{
|
||||
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
|
||||
$response = $this->actingAs($user)
|
||||
|
@ -52,7 +52,7 @@ final class BulkDeleteAssetsTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee('alert-danger');
|
||||
}
|
||||
|
||||
public function testPageRedirectFromInterstitialIfNoAssetsSelectedToRestore(): void
|
||||
public function testPageRedirectFromInterstitialIfNoAssetsSelectedToRestore()
|
||||
{
|
||||
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->create();
|
||||
$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();
|
||||
$assets = Asset::factory()->count(2)->create();
|
||||
|
@ -89,7 +89,7 @@ final class BulkDeleteAssetsTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee('alert-success');
|
||||
}
|
||||
|
||||
public function testBulkRestoreSelectedAssetsFromInterstitial(): void
|
||||
public function testBulkRestoreSelectedAssetsFromInterstitial()
|
||||
{
|
||||
$user = User::factory()->viewAssets()->deleteAssets()->editAssets()->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();
|
||||
$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();
|
||||
$asset = Asset::factory()->deleted()->create();
|
||||
|
|
|
@ -14,7 +14,7 @@ use Tests\TestCase;
|
|||
|
||||
final class BulkEditAssetsTest extends TestCase
|
||||
{
|
||||
public function testUserWithPermissionsCanAccessPage(): void
|
||||
public function testUserWithPermissionsCanAccessPage()
|
||||
{
|
||||
$user = User::factory()->viewAssets()->editAssets()->create();
|
||||
$assets = Asset::factory()->count(2)->create();
|
||||
|
@ -29,7 +29,7 @@ final class BulkEditAssetsTest extends TestCase
|
|||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testStandardUserCannotAccessPage(): void
|
||||
public function testStandardUserCannotAccessPage()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$assets = Asset::factory()->count(2)->create();
|
||||
|
@ -44,7 +44,7 @@ final class BulkEditAssetsTest extends TestCase
|
|||
])->assertStatus(403);
|
||||
}
|
||||
|
||||
public function testBulkEditAssetsAcceptsAllPossibleAttributes(): void
|
||||
public function testBulkEditAssetsAcceptsAllPossibleAttributes()
|
||||
{
|
||||
// sets up all needed models and attributes on the assets
|
||||
// this test does not deal with custom fields - will be dealt with in separate cases
|
||||
|
@ -109,7 +109,7 @@ final class BulkEditAssetsTest extends TestCase
|
|||
});
|
||||
}
|
||||
|
||||
public function testBulkEditAssetsAcceptsAndUpdatesUnencryptedCustomFields(): void
|
||||
public function testBulkEditAssetsAcceptsAndUpdatesUnencryptedCustomFields()
|
||||
{
|
||||
$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');
|
||||
|
||||
|
@ -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');
|
||||
$edit_user = User::factory()->editAssets()->create();
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CloneAssetTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToCreateAssetModel(): void
|
||||
public function testPermissionRequiredToCreateAssetModel()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$this->actingAs(User::factory()->create())
|
||||
|
@ -24,7 +24,7 @@ final class CloneAssetTest extends TestCase
|
|||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testAssetCanBeCloned(): void
|
||||
public function testAssetCanBeCloned()
|
||||
{
|
||||
$asset_to_clone = Asset::factory()->create(['name'=>'Asset to clone']);
|
||||
$this->actingAs(User::factory()->createAssets()->create())
|
||||
|
|
|
@ -11,7 +11,7 @@ use Tests\TestCase;
|
|||
final class EditAssetTest extends TestCase
|
||||
{
|
||||
|
||||
public function testPermissionRequiredToViewLicense(): void
|
||||
public function testPermissionRequiredToViewLicense()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$this->actingAs(User::factory()->create())
|
||||
|
@ -27,7 +27,7 @@ final class EditAssetTest extends TestCase
|
|||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testAssetEditPostIsRedirectedIfRedirectSelectionIsIndex(): void
|
||||
public function testAssetEditPostIsRedirectedIfRedirectSelectionIsIndex()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
||||
|
@ -45,7 +45,7 @@ final class EditAssetTest extends TestCase
|
|||
->assertRedirect(route('hardware.index'));
|
||||
$this->assertDatabaseHas('assets', ['asset_tag' => 'New Asset Tag']);
|
||||
}
|
||||
public function testAssetEditPostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testAssetEditPostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ final class CreateCategoriesTest extends TestCase
|
|||
{
|
||||
|
||||
|
||||
public function testRequiresPermissionToCreateCategory(): void
|
||||
public function testRequiresPermissionToCreateCategory()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.categories.store'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCanCreateCategoryWithValidCategoryType(): void
|
||||
public function testCanCreateCategoryWithValidCategoryType()
|
||||
{
|
||||
$response = $this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->postJson(route('api.categories.store'), [
|
||||
|
@ -41,7 +41,7 @@ final class CreateCategoriesTest extends TestCase
|
|||
$this->assertEquals('accessory', $category->category_type);
|
||||
}
|
||||
|
||||
public function testCannotCreateCategoryWithoutCategoryType(): void
|
||||
public function testCannotCreateCategoryWithoutCategoryType()
|
||||
{
|
||||
$response = $this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->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())
|
||||
->postJson(route('api.categories.store'), [
|
||||
|
|
|
@ -10,14 +10,14 @@ use Tests\TestCase;
|
|||
final class IndexCategoriesTest extends TestCase
|
||||
{
|
||||
|
||||
public function testViewingCategoryIndexRequiresPermission(): void
|
||||
public function testViewingCategoryIndexRequiresPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->getJson(route('api.departments.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCategoryIndexReturnsExpectedSearchResults(): void
|
||||
public function testCategoryIndexReturnsExpectedSearchResults()
|
||||
{
|
||||
Category::factory()->count(10)->create();
|
||||
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.');
|
||||
Category::factory()->count(3)->create();
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
final class UpdateCategoriesTest extends TestCase
|
||||
{
|
||||
|
||||
public function testCanUpdateCategoryViaPatchWithoutCategoryType(): void
|
||||
public function testCanUpdateCategoryViaPatchWithoutCategoryType()
|
||||
{
|
||||
$category = Category::factory()->create();
|
||||
|
||||
|
@ -30,7 +30,7 @@ final class UpdateCategoriesTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testCannotUpdateCategoryViaPatchWithCategoryType(): void
|
||||
public function testCannotUpdateCategoryViaPatchWithCategoryType()
|
||||
{
|
||||
$category = Category::factory()->create();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CreateCategoriesTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToCreateCategories(): void
|
||||
public function testPermissionRequiredToCreateCategories()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('categories.store'), [
|
||||
|
@ -19,7 +19,7 @@ final class CreateCategoriesTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanCreateCategories(): void
|
||||
public function testUserCanCreateCategories()
|
||||
{
|
||||
$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());
|
||||
}
|
||||
|
||||
public function testUserCannotCreateCategoriesWithInvalidType(): void
|
||||
public function testUserCannotCreateCategoriesWithInvalidType()
|
||||
{
|
||||
$this->assertFalse(Category::where('name', 'Test Category')->exists());
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ use Tests\TestCase;
|
|||
|
||||
final class IndexCategoriesTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewCategoryList(): void
|
||||
public function testPermissionRequiredToViewCategoryList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('categories.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListCategories(): void
|
||||
public function testUserCanListCategories()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('categories.index'))
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class UpdateCategoriesTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToStoreCategory(): void
|
||||
public function testPermissionRequiredToStoreCategory()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('categories.store'), [
|
||||
|
@ -20,7 +20,7 @@ final class UpdateCategoriesTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanCreateCategories(): void
|
||||
public function testUserCanCreateCategories()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->post(route('categories.store'), [
|
||||
|
@ -34,7 +34,7 @@ final class UpdateCategoriesTest extends TestCase
|
|||
$this->assertTrue(Category::where('name', 'Test Category')->exists());
|
||||
}
|
||||
|
||||
public function testUserCanEditAssetCategory(): void
|
||||
public function testUserCanEditAssetCategory()
|
||||
{
|
||||
$category = Category::factory()->forAssets()->create(['name' => 'Test Category']);
|
||||
$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']);
|
||||
$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();
|
||||
$category = Category::where('name', 'Laptops')->first();
|
||||
|
|
|
@ -15,28 +15,28 @@ use Tests\TestCase;
|
|||
|
||||
final class AssetCheckinTest extends TestCase
|
||||
{
|
||||
public function testCheckingInAssetRequiresCorrectPermission(): void
|
||||
public function testCheckingInAssetRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCannotCheckInNonExistentAsset(): void
|
||||
public function testCannotCheckInNonExistentAsset()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||
->postJson(route('api.asset.checkin', ['id' => 'does-not-exist']))
|
||||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testCannotCheckInAssetThatIsNotCheckedOut(): void
|
||||
public function testCannotCheckInAssetThatIsNotCheckedOut()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||
->postJson(route('api.asset.checkin', Asset::factory()->create()->id))
|
||||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testAssetCanBeCheckedIn(): void
|
||||
public function testAssetCanBeCheckedIn()
|
||||
{
|
||||
Event::fake([CheckoutableCheckedIn::class]);
|
||||
|
||||
|
@ -76,7 +76,7 @@ final class AssetCheckinTest extends TestCase
|
|||
}, 1);
|
||||
}
|
||||
|
||||
public function testLocationIsSetToRTDLocationByDefaultUponCheckin(): void
|
||||
public function testLocationIsSetToRTDLocationByDefaultUponCheckin()
|
||||
{
|
||||
$rtdLocation = Location::factory()->create();
|
||||
$asset = Asset::factory()->assignedToUser()->create([
|
||||
|
@ -90,7 +90,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertTrue($asset->refresh()->location()->is($rtdLocation));
|
||||
}
|
||||
|
||||
public function testDefaultLocationCanBeUpdatedUponCheckin(): void
|
||||
public function testDefaultLocationCanBeUpdatedUponCheckin()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
@ -104,7 +104,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertTrue($asset->refresh()->defaultLoc()->is($location));
|
||||
}
|
||||
|
||||
public function testAssetsLicenseSeatsAreClearedUponCheckin(): void
|
||||
public function testAssetsLicenseSeatsAreClearedUponCheckin()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
LicenseSeat::factory()->assignedToUser()->for($asset)->create();
|
||||
|
@ -117,7 +117,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertNull($asset->refresh()->licenseseats->first()->assigned_to);
|
||||
}
|
||||
|
||||
public function testLegacyLocationValuesSetToZeroAreUpdated(): void
|
||||
public function testLegacyLocationValuesSetToZeroAreUpdated()
|
||||
{
|
||||
$asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([
|
||||
'rtd_location_id' => 0,
|
||||
|
@ -131,7 +131,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertEquals($asset->location_id, $asset->rtd_location_id);
|
||||
}
|
||||
|
||||
public function testPendingCheckoutAcceptancesAreClearedUponCheckin(): void
|
||||
public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
||||
|
@ -143,7 +143,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertFalse($acceptance->exists(), 'Acceptance was not deleted');
|
||||
}
|
||||
|
||||
public function testCheckinTimeAndActionLogNoteCanBeSet(): void
|
||||
public function testCheckinTimeAndActionLogNoteCanBeSet()
|
||||
{
|
||||
Event::fake();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AccessoryCheckinTest extends TestCase
|
||||
{
|
||||
public function testCheckingInAccessoryRequiresCorrectPermission(): void
|
||||
public function testCheckingInAccessoryRequiresCorrectPermission()
|
||||
{
|
||||
$accessory = Accessory::factory()->checkedOutToUser()->create();
|
||||
|
||||
|
@ -21,7 +21,7 @@ final class AccessoryCheckinTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedIn(): void
|
||||
public function testAccessoryCanBeCheckedIn()
|
||||
{
|
||||
Event::fake([CheckoutableCheckedIn::class]);
|
||||
|
||||
|
@ -38,7 +38,7 @@ final class AccessoryCheckinTest extends TestCase
|
|||
Event::assertDispatched(CheckoutableCheckedIn::class, 1);
|
||||
}
|
||||
|
||||
public function testEmailSentToUserIfSettingEnabled(): void
|
||||
public function testEmailSentToUserIfSettingEnabled()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
@ -62,7 +62,7 @@ final class AccessoryCheckinTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testEmailNotSentToUserIfSettingDisabled(): void
|
||||
public function testEmailNotSentToUserIfSettingDisabled()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AssetCheckinTest extends TestCase
|
||||
{
|
||||
public function testCheckingInAssetRequiresCorrectPermission(): void
|
||||
public function testCheckingInAssetRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('hardware.checkin.store', [
|
||||
|
@ -24,7 +24,7 @@ final class AssetCheckinTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCannotCheckInAssetThatIsNotCheckedOut(): void
|
||||
public function testCannotCheckInAssetThatIsNotCheckedOut()
|
||||
{
|
||||
$this->actingAs(User::factory()->checkinAssets()->create())
|
||||
->post(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id]))
|
||||
|
@ -33,7 +33,7 @@ final class AssetCheckinTest extends TestCase
|
|||
->assertRedirect(route('hardware.index'));
|
||||
}
|
||||
|
||||
public function testCannotStoreAssetCheckinThatIsNotCheckedOut(): void
|
||||
public function testCannotStoreAssetCheckinThatIsNotCheckedOut()
|
||||
{
|
||||
$this->actingAs(User::factory()->checkinAssets()->create())
|
||||
->get(route('hardware.checkin.store', ['assetId' => Asset::factory()->create()->id]))
|
||||
|
@ -42,7 +42,7 @@ final class AssetCheckinTest extends TestCase
|
|||
->assertRedirect(route('hardware.index'));
|
||||
}
|
||||
|
||||
public function testAssetCanBeCheckedIn(): void
|
||||
public function testAssetCanBeCheckedIn()
|
||||
{
|
||||
Event::fake([CheckoutableCheckedIn::class]);
|
||||
|
||||
|
@ -85,7 +85,7 @@ final class AssetCheckinTest extends TestCase
|
|||
}, 1);
|
||||
}
|
||||
|
||||
public function testLocationIsSetToRTDLocationByDefaultUponCheckin(): void
|
||||
public function testLocationIsSetToRTDLocationByDefaultUponCheckin()
|
||||
{
|
||||
$rtdLocation = Location::factory()->create();
|
||||
$asset = Asset::factory()->assignedToUser()->create([
|
||||
|
@ -99,7 +99,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertTrue($asset->refresh()->location()->is($rtdLocation));
|
||||
}
|
||||
|
||||
public function testDefaultLocationCanBeUpdatedUponCheckin(): void
|
||||
public function testDefaultLocationCanBeUpdatedUponCheckin()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
@ -113,7 +113,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertTrue($asset->refresh()->defaultLoc()->is($location));
|
||||
}
|
||||
|
||||
public function testAssetsLicenseSeatsAreClearedUponCheckin(): void
|
||||
public function testAssetsLicenseSeatsAreClearedUponCheckin()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
LicenseSeat::factory()->assignedToUser()->for($asset)->create();
|
||||
|
@ -126,7 +126,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertNull($asset->refresh()->licenseseats->first()->assigned_to);
|
||||
}
|
||||
|
||||
public function testLegacyLocationValuesSetToZeroAreUpdated(): void
|
||||
public function testLegacyLocationValuesSetToZeroAreUpdated()
|
||||
{
|
||||
$asset = Asset::factory()->canBeInvalidUponCreation()->assignedToUser()->create([
|
||||
'rtd_location_id' => 0,
|
||||
|
@ -140,7 +140,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertEquals($asset->location_id, $asset->rtd_location_id);
|
||||
}
|
||||
|
||||
public function testPendingCheckoutAcceptancesAreClearedUponCheckin(): void
|
||||
public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
||||
|
@ -152,7 +152,7 @@ final class AssetCheckinTest extends TestCase
|
|||
$this->assertFalse($acceptance->exists(), 'Acceptance was not deleted');
|
||||
}
|
||||
|
||||
public function testCheckinTimeAndActionLogNoteCanBeSet(): void
|
||||
public function testCheckinTimeAndActionLogNoteCanBeSet()
|
||||
{
|
||||
Event::fake([CheckoutableCheckedIn::class]);
|
||||
|
||||
|
@ -170,7 +170,7 @@ final class AssetCheckinTest extends TestCase
|
|||
}, 1);
|
||||
}
|
||||
|
||||
public function testAssetCheckinPageIsRedirectedIfModelIsInvalid(): void
|
||||
public function testAssetCheckinPageIsRedirectedIfModelIsInvalid()
|
||||
{
|
||||
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
@ -184,7 +184,7 @@ final class AssetCheckinTest extends TestCase
|
|||
->assertRedirect(route('hardware.show',['hardware' => $asset->id]));
|
||||
}
|
||||
|
||||
public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid(): void
|
||||
public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
$asset->model_id = 0;
|
||||
|
@ -197,7 +197,7 @@ final class AssetCheckinTest extends TestCase
|
|||
->assertRedirect(route('hardware.show', ['hardware' => $asset->id]));
|
||||
}
|
||||
|
||||
public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex(): void
|
||||
public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
||||
|
@ -210,7 +210,7 @@ final class AssetCheckinTest extends TestCase
|
|||
->assertRedirect(route('hardware.index'));
|
||||
}
|
||||
|
||||
public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$asset = Asset::factory()->assignedToUser()->create();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ComponentCheckinTest extends TestCase
|
||||
{
|
||||
public function testCheckingInComponentRequiresCorrectPermission(): void
|
||||
public function testCheckingInComponentRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->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();
|
||||
|
||||
|
@ -32,7 +32,7 @@ final class ComponentCheckinTest extends TestCase
|
|||
->assertRedirect(route('components.index'));
|
||||
}
|
||||
|
||||
public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$component = Component::factory()->checkedOutToAsset()->create();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class LicenseCheckinTest extends TestCase
|
||||
{
|
||||
public function testCheckingInLicenseRequiresCorrectPermission(): void
|
||||
public function testCheckingInLicenseRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('licenses.checkin.save', [
|
||||
|
|
|
@ -16,7 +16,7 @@ final class AccessoryAcceptanceTest extends TestCase
|
|||
/**
|
||||
* This can be absorbed into a bigger test
|
||||
*/
|
||||
public function testUsersNameIsIncludedInAccessoryAcceptedNotification(): void
|
||||
public function testUsersNameIsIncludedInAccessoryAcceptedNotification()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
@ -49,7 +49,7 @@ final class AccessoryAcceptanceTest extends TestCase
|
|||
/**
|
||||
* This can be absorbed into a bigger test
|
||||
*/
|
||||
public function testUsersNameIsIncludedInAccessoryDeclinedNotification(): void
|
||||
public function testUsersNameIsIncludedInAccessoryDeclinedNotification()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
@ -79,7 +79,7 @@ final class AccessoryAcceptanceTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testUserIsNotAbleToAcceptAnAssetAssignedToADifferentUser(): void
|
||||
public function testUserIsNotAbleToAcceptAnAssetAssignedToADifferentUser()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ use Tests\TestCase;
|
|||
|
||||
final class AccessoryCheckoutTest extends TestCase
|
||||
{
|
||||
public function testCheckingOutAccessoryRequiresCorrectPermission(): void
|
||||
public function testCheckingOutAccessoryRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.accessories.checkout', Accessory::factory()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testValidationWhenCheckingOutAccessory(): void
|
||||
public function testValidationWhenCheckingOutAccessory()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkoutAccessories()->create())
|
||||
->postJson(route('api.accessories.checkout', Accessory::factory()->create()), [
|
||||
|
@ -27,7 +27,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testAccessoryMustBeAvailableWhenCheckingOut(): void
|
||||
public function testAccessoryMustBeAvailableWhenCheckingOut()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkoutAccessories()->create())
|
||||
->postJson(route('api.accessories.checkout', Accessory::factory()->withoutItemsRemaining()->create()), [
|
||||
|
@ -58,7 +58,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedOutWithoutQty(): void
|
||||
public function testAccessoryCanBeCheckedOutWithoutQty()
|
||||
{
|
||||
$accessory = Accessory::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]);
|
||||
$user = User::factory()->create();
|
||||
|
@ -124,7 +124,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testAccessoryCannotBeCheckedOutToInvalidUser(): void
|
||||
public function testAccessoryCannotBeCheckedOutToInvalidUser()
|
||||
{
|
||||
$accessory = Accessory::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);
|
||||
}
|
||||
|
||||
public function testUserSentNotificationUponCheckout(): void
|
||||
public function testUserSentNotificationUponCheckout()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
@ -159,7 +159,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
Notification::assertSentTo($user, CheckoutAccessoryNotification::class);
|
||||
}
|
||||
|
||||
public function testActionLogCreatedUponCheckout(): void
|
||||
public function testActionLogCreatedUponCheckout()
|
||||
{
|
||||
$accessory = Accessory::factory()->create();
|
||||
$actor = User::factory()->checkoutAccessories()->create();
|
||||
|
|
|
@ -21,7 +21,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
Event::fake([CheckoutableCheckedOut::class]);
|
||||
}
|
||||
|
||||
public function testCheckingOutAssetRequiresCorrectPermission(): void
|
||||
public function testCheckingOutAssetRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.asset.checkout', Asset::factory()->create()), [
|
||||
|
@ -31,7 +31,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testNonExistentAssetCannotBeCheckedOut(): void
|
||||
public function testNonExistentAssetCannotBeCheckedOut()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkoutAssets()->create())
|
||||
->postJson(route('api.asset.checkout', 1000), [
|
||||
|
@ -41,7 +41,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testAssetNotAvailableForCheckoutCannotBeCheckedOut(): void
|
||||
public function testAssetNotAvailableForCheckoutCannotBeCheckedOut()
|
||||
{
|
||||
$assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create();
|
||||
|
||||
|
@ -53,7 +53,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testAssetCannotBeCheckedOutToItself(): void
|
||||
public function testAssetCannotBeCheckedOutToItself()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
|
||||
|
@ -65,7 +65,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testValidationWhenCheckingOutAsset(): void
|
||||
public function testValidationWhenCheckingOutAsset()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkoutAssets()->create())
|
||||
->postJson(route('api.asset.checkout', Asset::factory()->create()), [])
|
||||
|
@ -74,7 +74,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
Event::assertNotDispatched(CheckoutableCheckedOut::class);
|
||||
}
|
||||
|
||||
public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled(): void
|
||||
public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled()
|
||||
{
|
||||
$this->markTestIncomplete('This is not implemented');
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('checkoutTargets')]
|
||||
public function testAssetCanBeCheckedOut($data): void
|
||||
public function testAssetCanBeCheckedOut($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');
|
||||
}
|
||||
|
||||
public function testLastCheckoutUsesCurrentDateIfNotProvided(): void
|
||||
public function testLastCheckoutUsesCurrentDateIfNotProvided()
|
||||
{
|
||||
$asset = Asset::factory()->create(['last_checkout' => now()->subMonth()]);
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ use Tests\TestCase;
|
|||
|
||||
final class ConsumableCheckoutTest extends TestCase
|
||||
{
|
||||
public function testCheckingOutConsumableRequiresCorrectPermission(): void
|
||||
public function testCheckingOutConsumableRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.consumables.checkout', Consumable::factory()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testValidationWhenCheckingOutConsumable(): void
|
||||
public function testValidationWhenCheckingOutConsumable()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkoutConsumables()->create())
|
||||
->postJson(route('api.consumables.checkout', Consumable::factory()->create()), [
|
||||
|
@ -27,7 +27,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testConsumableMustBeAvailableWhenCheckingOut(): void
|
||||
public function testConsumableMustBeAvailableWhenCheckingOut()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->checkoutConsumables()->create())
|
||||
->postJson(route('api.consumables.checkout', Consumable::factory()->withoutItemsRemaining()->create()), [
|
||||
|
@ -36,7 +36,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
->assertStatusMessageIs('error');
|
||||
}
|
||||
|
||||
public function testConsumableCanBeCheckedOut(): void
|
||||
public function testConsumableCanBeCheckedOut()
|
||||
{
|
||||
$consumable = Consumable::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
@ -49,7 +49,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
$this->assertTrue($user->consumables->contains($consumable));
|
||||
}
|
||||
|
||||
public function testUserSentNotificationUponCheckout(): void
|
||||
public function testUserSentNotificationUponCheckout()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
@ -65,7 +65,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
Notification::assertSentTo($user, CheckoutConsumableNotification::class);
|
||||
}
|
||||
|
||||
public function testActionLogCreatedUponCheckout(): void
|
||||
public function testActionLogCreatedUponCheckout()
|
||||
{$consumable = Consumable::factory()->create();
|
||||
$actor = User::factory()->checkoutConsumables()->create();
|
||||
$user = User::factory()->create();
|
||||
|
|
|
@ -13,14 +13,14 @@ use Tests\TestCase;
|
|||
|
||||
final class AccessoryCheckoutTest extends TestCase
|
||||
{
|
||||
public function testCheckingOutAccessoryRequiresCorrectPermission(): void
|
||||
public function testCheckingOutAccessoryRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('accessories.checkout.store', Accessory::factory()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testValidationWhenCheckingOutAccessory(): void
|
||||
public function testValidationWhenCheckingOutAccessory()
|
||||
{
|
||||
$accessory = Accessory::factory()->create();
|
||||
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||
|
@ -35,7 +35,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee(trans('general.error'));
|
||||
}
|
||||
|
||||
public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut(): void
|
||||
public function testAccessoryMustHaveAvailableItemsForCheckoutWhenCheckingOut()
|
||||
{
|
||||
|
||||
$accessory = Accessory::factory()->withoutItemsRemaining()->create();
|
||||
|
@ -52,7 +52,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee(trans('general.error'));
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedOutWithoutQuantity(): void
|
||||
public function testAccessoryCanBeCheckedOutWithoutQuantity()
|
||||
{
|
||||
$accessory = Accessory::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]);
|
||||
$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]);
|
||||
$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]);
|
||||
$asset = Asset::factory()->create();
|
||||
|
@ -154,7 +154,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
public function testUserSentNotificationUponCheckout(): void
|
||||
public function testUserSentNotificationUponCheckout()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
@ -171,7 +171,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
Notification::assertSentTo($user, CheckoutAccessoryNotification::class);
|
||||
}
|
||||
|
||||
public function testActionLogCreatedUponCheckout(): void
|
||||
public function testActionLogCreatedUponCheckout()
|
||||
{
|
||||
$accessory = Accessory::factory()->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();
|
||||
|
||||
|
@ -216,7 +216,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
->assertRedirect(route('accessories.index'));
|
||||
}
|
||||
|
||||
public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$accessory = Accessory::factory()->create();
|
||||
|
||||
|
@ -233,7 +233,7 @@ final class AccessoryCheckoutTest extends TestCase
|
|||
->assertRedirect(route('accessories.show', ['accessory' => $accessory->id]));
|
||||
}
|
||||
|
||||
public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void
|
||||
public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$accessory = Accessory::factory()->create();
|
||||
|
|
|
@ -24,7 +24,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
Event::fake([CheckoutableCheckedOut::class]);
|
||||
}
|
||||
|
||||
public function testCheckingOutAssetRequiresCorrectPermission(): void
|
||||
public function testCheckingOutAssetRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('hardware.checkout.store', Asset::factory()->create()), [
|
||||
|
@ -34,7 +34,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testNonExistentAssetCannotBeCheckedOut(): void
|
||||
public function testNonExistentAssetCannotBeCheckedOut()
|
||||
{
|
||||
$this->actingAs(User::factory()->checkoutAssets()->create())
|
||||
->post(route('hardware.checkout.store', 1000), [
|
||||
|
@ -48,7 +48,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
Event::assertNotDispatched(CheckoutableCheckedOut::class);
|
||||
}
|
||||
|
||||
public function testAssetNotAvailableForCheckoutCannotBeCheckedOut(): void
|
||||
public function testAssetNotAvailableForCheckoutCannotBeCheckedOut()
|
||||
{
|
||||
$assetAlreadyCheckedOut = Asset::factory()->assignedToUser()->create();
|
||||
|
||||
|
@ -63,7 +63,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
Event::assertNotDispatched(CheckoutableCheckedOut::class);
|
||||
}
|
||||
|
||||
public function testAssetCannotBeCheckedOutToItself(): void
|
||||
public function testAssetCannotBeCheckedOutToItself()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
|
||||
|
@ -77,7 +77,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
Event::assertNotDispatched(CheckoutableCheckedOut::class);
|
||||
}
|
||||
|
||||
public function testValidationWhenCheckingOutAsset(): void
|
||||
public function testValidationWhenCheckingOutAsset()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('hardware.checkout.store', Asset::factory()->create()), [
|
||||
|
@ -98,7 +98,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
Event::assertNotDispatched(CheckoutableCheckedOut::class);
|
||||
}
|
||||
|
||||
public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled(): void
|
||||
public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -169,7 +169,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('checkoutTargets')]
|
||||
public function testAssetCanBeCheckedOut($data): void
|
||||
public function testAssetCanBeCheckedOut($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();
|
||||
$seat = LicenseSeat::factory()->assignedToAsset($asset)->create();
|
||||
|
@ -224,7 +224,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
$this->assertTrue($user->fresh()->licenses->contains($seat->license));
|
||||
}
|
||||
|
||||
public function testLastCheckoutUsesCurrentDateIfNotProvided(): void
|
||||
public function testLastCheckoutUsesCurrentDateIfNotProvided()
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
public function testAssetCheckoutPageIsRedirectedIfModelIsInvalid(): void
|
||||
public function testAssetCheckoutPageIsRedirectedIfModelIsInvalid()
|
||||
{
|
||||
|
||||
$asset = Asset::factory()->create();
|
||||
|
@ -253,7 +253,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertRedirect(route('hardware.show',['hardware' => $asset->id]));
|
||||
}
|
||||
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
|
||||
|
@ -268,7 +268,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertRedirect(route('hardware.index'));
|
||||
}
|
||||
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
|
||||
|
@ -284,7 +284,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertRedirect(route('hardware.show', ['hardware' => $asset->id]));
|
||||
}
|
||||
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget(): void
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$asset = Asset::factory()->create();
|
||||
|
@ -301,7 +301,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertRedirect(route('users.show', ['user' => $user]));
|
||||
}
|
||||
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget(): void
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget()
|
||||
{
|
||||
$target = Asset::factory()->create();
|
||||
$asset = Asset::factory()->create();
|
||||
|
@ -318,7 +318,7 @@ final class AssetCheckoutTest extends TestCase
|
|||
->assertRedirect(route('hardware.show', ['hardware' => $target]));
|
||||
}
|
||||
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget(): void
|
||||
public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget()
|
||||
{
|
||||
$target = Location::factory()->create();
|
||||
$asset = Asset::factory()->create();
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ComponentsCheckoutTest extends TestCase
|
||||
{
|
||||
public function testCheckingOutComponentRequiresCorrectPermission(): void
|
||||
public function testCheckingOutComponentRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('components.checkout.store', [
|
||||
|
@ -18,7 +18,7 @@ final class ComponentsCheckoutTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void
|
||||
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
|
||||
{
|
||||
$component = Component::factory()->create();
|
||||
|
||||
|
@ -33,7 +33,7 @@ final class ComponentsCheckoutTest extends TestCase
|
|||
->assertRedirect(route('components.index'));
|
||||
}
|
||||
|
||||
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$component = Component::factory()->create();
|
||||
|
||||
|
@ -48,7 +48,7 @@ final class ComponentsCheckoutTest extends TestCase
|
|||
->assertRedirect(route('components.show', ['component' => $component->id]));
|
||||
}
|
||||
|
||||
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void
|
||||
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$component = Component::factory()->create();
|
||||
|
|
|
@ -13,14 +13,14 @@ use Tests\TestCase;
|
|||
|
||||
final class ConsumableCheckoutTest extends TestCase
|
||||
{
|
||||
public function testCheckingOutConsumableRequiresCorrectPermission(): void
|
||||
public function testCheckingOutConsumableRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('consumables.checkout.store', Consumable::factory()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testValidationWhenCheckingOutConsumable(): void
|
||||
public function testValidationWhenCheckingOutConsumable()
|
||||
{
|
||||
$this->actingAs(User::factory()->checkoutConsumables()->create())
|
||||
->post(route('consumables.checkout.store', Consumable::factory()->create()), [
|
||||
|
@ -29,7 +29,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
->assertSessionHas('error');
|
||||
}
|
||||
|
||||
public function testConsumableMustBeAvailableWhenCheckingOut(): void
|
||||
public function testConsumableMustBeAvailableWhenCheckingOut()
|
||||
{
|
||||
$this->actingAs(User::factory()->checkoutConsumables()->create())
|
||||
->post(route('consumables.checkout.store', Consumable::factory()->withoutItemsRemaining()->create()), [
|
||||
|
@ -38,7 +38,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
->assertSessionHas('error');
|
||||
}
|
||||
|
||||
public function testConsumableCanBeCheckedOut(): void
|
||||
public function testConsumableCanBeCheckedOut()
|
||||
{
|
||||
$consumable = Consumable::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
@ -51,7 +51,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
$this->assertTrue($user->consumables->contains($consumable));
|
||||
}
|
||||
|
||||
public function testUserSentNotificationUponCheckout(): void
|
||||
public function testUserSentNotificationUponCheckout()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
|
@ -66,7 +66,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
Notification::assertSentTo($user, CheckoutConsumableNotification::class);
|
||||
}
|
||||
|
||||
public function testActionLogCreatedUponCheckout(): void
|
||||
public function testActionLogCreatedUponCheckout()
|
||||
{
|
||||
$consumable = Consumable::factory()->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();
|
||||
|
||||
|
@ -108,7 +108,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
->assertRedirect(route('consumables.index'));
|
||||
}
|
||||
|
||||
public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$consumable = Consumable::factory()->create();
|
||||
|
||||
|
@ -123,7 +123,7 @@ final class ConsumableCheckoutTest extends TestCase
|
|||
->assertRedirect(route('consumables.show', ['consumable' => $consumable->id]));
|
||||
}
|
||||
|
||||
public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget(): void
|
||||
public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$consumable = Consumable::factory()->create();
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
|
||||
final class LicenseCheckoutTest extends TestCase
|
||||
{
|
||||
public function testNotesAreStoredInActionLogOnCheckoutToAsset(): void
|
||||
public function testNotesAreStoredInActionLogOnCheckoutToAsset()
|
||||
{
|
||||
$admin = User::factory()->superuser()->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();
|
||||
$licenseSeat = LicenseSeat::factory()->create();
|
||||
|
@ -57,7 +57,7 @@ final class LicenseCheckoutTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex(): void
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
|
||||
{
|
||||
$license = License::factory()->create();
|
||||
|
||||
|
@ -72,7 +72,7 @@ final class LicenseCheckoutTest extends TestCase
|
|||
->assertRedirect(route('licenses.index'));
|
||||
}
|
||||
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem(): void
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsItem()
|
||||
{
|
||||
$license = License::factory()->create();
|
||||
|
||||
|
@ -86,7 +86,7 @@ final class LicenseCheckoutTest extends TestCase
|
|||
->assertRedirect(route('licenses.show', ['license' => $license->id]));
|
||||
}
|
||||
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget(): void
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$license = License::factory()->create();
|
||||
|
@ -100,7 +100,7 @@ final class LicenseCheckoutTest extends TestCase
|
|||
->assertStatus(302)
|
||||
->assertRedirect(route('users.show', ['user' => $user->id]));
|
||||
}
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget(): void
|
||||
public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$license = License::factory()->create();
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ComponentIndexTest extends TestCase
|
||||
{
|
||||
public function testComponentIndexAdheresToCompanyScoping(): void
|
||||
public function testComponentIndexAdheresToCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ use Tests\TestCase;
|
|||
|
||||
final class ComponentIndexTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewComponentsList(): void
|
||||
public function testPermissionRequiredToViewComponentsList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('components.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListComponents(): void
|
||||
public function testUserCanListComponents()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('components.index'))
|
||||
|
|
|
@ -13,7 +13,7 @@ use Tests\TestCase;
|
|||
|
||||
final class MergeUsersTest extends TestCase
|
||||
{
|
||||
public function testAssetsAreTransferredOnUserMerge(): void
|
||||
public function testAssetsAreTransferredOnUserMerge()
|
||||
{
|
||||
$user1 = User::factory()->create(['username' => 'user1']);
|
||||
$user_to_merge_into = User::factory()->create(['username' => 'user1@example.com']);
|
||||
|
|
|
@ -6,7 +6,7 @@ use Tests\TestCase;
|
|||
|
||||
final class OptimizeTest extends TestCase
|
||||
{
|
||||
public function testOptimizeSucceeds(): void
|
||||
public function testOptimizeSucceeds()
|
||||
{
|
||||
$this->beforeApplicationDestroyed(function () {
|
||||
$this->artisan('config:clear');
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ConsumableIndexTest extends TestCase
|
||||
{
|
||||
public function testConsumableIndexAdheresToCompanyScoping(): void
|
||||
public function testConsumableIndexAdheresToCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
@ -55,7 +55,7 @@ final class ConsumableIndexTest extends TestCase
|
|||
->assertResponseContainsInRows($consumableB);
|
||||
}
|
||||
|
||||
public function testConsumableIndexReturnsExpectedSearchResults(): void
|
||||
public function testConsumableIndexReturnsExpectedSearchResults()
|
||||
{
|
||||
Consumable::factory()->count(10)->create();
|
||||
Consumable::factory()->count(1)->create(['name' => 'My Test Consumable']);
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
final class ConsumableUpdateTest extends TestCase
|
||||
{
|
||||
|
||||
public function testCanUpdateConsumableViaPatchWithoutCategoryType(): void
|
||||
public function testCanUpdateConsumableViaPatchWithoutCategoryType()
|
||||
{
|
||||
$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']);
|
||||
$consumable = Consumable::factory()->create();
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ConsumableViewTest extends TestCase
|
||||
{
|
||||
public function testConsumableViewAdheresToCompanyScoping(): void
|
||||
public function testConsumableViewAdheresToCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ use Tests\TestCase;
|
|||
|
||||
final class ConsumableIndexTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewConsumablesList(): void
|
||||
public function testPermissionRequiredToViewConsumablesList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('consumables.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListConsumables(): void
|
||||
public function testUserCanListConsumables()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('consumables.index'))
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ConsumableViewTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewConsumable(): void
|
||||
public function testPermissionRequiredToViewConsumable()
|
||||
{
|
||||
$consumable = Consumable::factory()->create();
|
||||
$this->actingAs(User::factory()->create())
|
||||
|
@ -16,7 +16,7 @@ final class ConsumableViewTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListConsumables(): void
|
||||
public function testUserCanListConsumables()
|
||||
{
|
||||
$consumable = Consumable::factory()->create();
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
|
|
|
@ -7,7 +7,7 @@ use Tests\TestCase;
|
|||
|
||||
final class DashboardTest extends TestCase
|
||||
{
|
||||
public function testUsersWithoutAdminAccessAreRedirected(): void
|
||||
public function testUsersWithoutAdminAccessAreRedirected()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('home'))
|
||||
|
|
|
@ -13,7 +13,7 @@ final class CreateDepartmentsTest extends TestCase
|
|||
{
|
||||
|
||||
|
||||
public function testRequiresPermissionToCreateDepartment(): void
|
||||
public function testRequiresPermissionToCreateDepartment()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.departments.store'))
|
||||
|
|
|
@ -10,19 +10,19 @@ use Tests\TestCase;
|
|||
|
||||
final class DepartmentsIndexTest extends TestCase
|
||||
{
|
||||
public function testViewingDepartmentIndexRequiresAuthentication(): void
|
||||
public function testViewingDepartmentIndexRequiresAuthentication()
|
||||
{
|
||||
$this->getJson(route('api.departments.index'))->assertRedirect();
|
||||
}
|
||||
|
||||
public function testViewingDepartmentIndexRequiresPermission(): void
|
||||
public function testViewingDepartmentIndexRequiresPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->getJson(route('api.departments.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testDepartmentIndexReturnsExpectedDepartments(): void
|
||||
public function testDepartmentIndexReturnsExpectedDepartments()
|
||||
{
|
||||
Department::factory()->count(3)->create();
|
||||
|
||||
|
@ -42,7 +42,7 @@ final class DepartmentsIndexTest extends TestCase
|
|||
->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());
|
||||
}
|
||||
|
||||
public function testDepartmentIndexAdheresToCompanyScoping(): void
|
||||
public function testDepartmentIndexAdheresToCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
final class UpdateDepartmentsTest extends TestCase
|
||||
{
|
||||
|
||||
public function testRequiresPermissionToEditDepartment(): void
|
||||
public function testRequiresPermissionToEditDepartment()
|
||||
{
|
||||
$department = Department::factory()->create();
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
|
@ -18,7 +18,7 @@ final class UpdateDepartmentsTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCanUpdateDepartmentViaPatch(): void
|
||||
public function testCanUpdateDepartmentViaPatch()
|
||||
{
|
||||
$department = Department::factory()->create();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CreateDepartmentsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToCreateDepartment(): void
|
||||
public function testPermissionRequiredToCreateDepartment()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('departments.store'), [
|
||||
|
@ -19,7 +19,7 @@ final class CreateDepartmentsTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanCreateDepartments(): void
|
||||
public function testUserCanCreateDepartments()
|
||||
{
|
||||
$this->assertFalse(Department::where('name', 'Test Department')->exists());
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ use Tests\TestCase;
|
|||
|
||||
final class IndexDepartmentsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewDepartmentsList(): void
|
||||
public function testPermissionRequiredToViewDepartmentsList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('departments.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListDepartments(): void
|
||||
public function testUserCanListDepartments()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('departments.index'))
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class UpdateDepartmentsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToStoreDepartment(): void
|
||||
public function testPermissionRequiredToStoreDepartment()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->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']);
|
||||
$this->assertTrue(Department::where('name', 'Test Department')->exists());
|
||||
|
|
|
@ -9,14 +9,14 @@ use Tests\TestCase;
|
|||
|
||||
final class StoreGroupTest extends TestCase
|
||||
{
|
||||
public function testStoringGroupRequiresSuperAdminPermission(): void
|
||||
public function testStoringGroupRequiresSuperAdminPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.groups.store'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCanStoreGroupWithPermissionsPassed(): void
|
||||
public function testCanStoreGroupWithPermissionsPassed()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->postJson(route('api.groups.store'), [
|
||||
|
@ -37,7 +37,7 @@ final class StoreGroupTest extends TestCase
|
|||
$this->assertEquals('0', $group->decodePermissions()['reports.view']);
|
||||
}
|
||||
|
||||
public function testStoringGroupWithoutPermissionPassed(): void
|
||||
public function testStoringGroupWithoutPermissionPassed()
|
||||
{
|
||||
$superuser = User::factory()->superuser()->create();
|
||||
$this->actingAsForApi($superuser)
|
||||
|
@ -61,7 +61,7 @@ final class StoreGroupTest extends TestCase
|
|||
->assertOk();
|
||||
}
|
||||
|
||||
public function testStoringGroupWithInvalidPermissionDropsBadPermission(): void
|
||||
public function testStoringGroupWithInvalidPermissionDropsBadPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->postJson(route('api.groups.store'), [
|
||||
|
|
|
@ -7,7 +7,7 @@ use Tests\TestCase;
|
|||
|
||||
final class IndexGroupTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewGroupList(): void
|
||||
public function testPermissionRequiredToViewGroupList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('groups.index'))
|
||||
|
@ -16,7 +16,7 @@ final class IndexGroupTest extends TestCase
|
|||
//$this->followRedirects($response)->assertSee('sad-panda.png');
|
||||
}
|
||||
|
||||
public function testUserCanListGroups(): void
|
||||
public function testUserCanListGroups()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('groups.index'))
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class LicenseIndexTest extends TestCase
|
||||
{
|
||||
public function testLicensesIndexAdheresToCompanyScoping(): void
|
||||
public function testLicensesIndexAdheresToCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CreateLicenseTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewLicense(): void
|
||||
public function testPermissionRequiredToViewLicense()
|
||||
{
|
||||
$license = License::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())
|
||||
->from(route('licenses.create'))
|
||||
|
|
|
@ -7,14 +7,14 @@ use Tests\TestCase;
|
|||
|
||||
final class LicenseIndexTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewLicenseList(): void
|
||||
public function testPermissionRequiredToViewLicenseList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('licenses.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListLicenses(): void
|
||||
public function testUserCanListLicenses()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('licenses.index'))
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class LicenseViewTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewLicense(): void
|
||||
public function testPermissionRequiredToViewLicense()
|
||||
{
|
||||
$license = License::factory()->create();
|
||||
$this->actingAs(User::factory()->create())
|
||||
|
@ -17,7 +17,7 @@ final class LicenseViewTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testLicenseWithPurchaseDateDepreciatesCorrectly(): void
|
||||
public function testLicenseWithPurchaseDateDepreciatesCorrectly()
|
||||
{
|
||||
$depreciation = Depreciation::factory()->create(['months' => 12]);
|
||||
$license = License::factory()->create(['depreciation_id' => $depreciation->id, 'purchase_date' => '2020-01-01']);
|
||||
|
|
|
@ -8,12 +8,12 @@ use Tests\TestCase;
|
|||
|
||||
final class CategoryEditFormTest extends TestCase
|
||||
{
|
||||
public function testTheComponentCanRender(): void
|
||||
public function testTheComponentCanRender()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class)->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting(): void
|
||||
public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'sendCheckInEmail' => true,
|
||||
|
@ -22,7 +22,7 @@ final class CategoryEditFormTest extends TestCase
|
|||
])->assertSet('sendCheckInEmail', true);
|
||||
}
|
||||
|
||||
public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet(): void
|
||||
public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'sendCheckInEmail' => false,
|
||||
|
@ -31,7 +31,7 @@ final class CategoryEditFormTest extends TestCase
|
|||
])->assertSet('sendCheckInEmail', true);
|
||||
}
|
||||
|
||||
public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula(): void
|
||||
public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'sendCheckInEmail' => false,
|
||||
|
@ -40,7 +40,7 @@ final class CategoryEditFormTest extends TestCase
|
|||
])->assertSet('sendCheckInEmail', true);
|
||||
}
|
||||
|
||||
public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula(): void
|
||||
public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'sendCheckInEmail' => false,
|
||||
|
@ -49,7 +49,7 @@ final class CategoryEditFormTest extends TestCase
|
|||
])->assertSet('sendCheckInEmail', false);
|
||||
}
|
||||
|
||||
public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered(): void
|
||||
public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'sendCheckInEmail' => false,
|
||||
|
@ -59,7 +59,7 @@ final class CategoryEditFormTest extends TestCase
|
|||
->assertSet('sendCheckInEmail', true);
|
||||
}
|
||||
|
||||
public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected(): void
|
||||
public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'sendCheckInEmail' => false,
|
||||
|
@ -71,7 +71,7 @@ final class CategoryEditFormTest extends TestCase
|
|||
->assertSet('sendCheckInEmailDisabled', true);
|
||||
}
|
||||
|
||||
public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula(): void
|
||||
public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'eulaText' => 'Some Content',
|
||||
|
@ -94,7 +94,7 @@ final class CategoryEditFormTest extends TestCase
|
|||
->assertSet('sendCheckInEmailDisabled', false);
|
||||
}
|
||||
|
||||
public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula(): void
|
||||
public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula()
|
||||
{
|
||||
Livewire::test(CategoryEditForm::class, [
|
||||
'sendCheckInEmail' => false,
|
||||
|
|
|
@ -9,14 +9,14 @@ use Tests\TestCase;
|
|||
final class CreateLocationsTest extends TestCase
|
||||
{
|
||||
|
||||
public function testRequiresPermissionToCreateLocation(): void
|
||||
public function testRequiresPermissionToCreateLocation()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.departments.store'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCannotCreateNewLocationsWithTheSameName(): void
|
||||
public function testCannotCreateNewLocationsWithTheSameName()
|
||||
{
|
||||
$location = 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();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
final class DeleteLocationsTest extends TestCase
|
||||
{
|
||||
|
||||
public function testErrorReturnedViaApiIfLocationDoesNotExist(): void
|
||||
public function testErrorReturnedViaApiIfLocationDoesNotExist()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->superuser()->create())
|
||||
->deleteJson(route('api.users.destroy', 'invalid-id'))
|
||||
|
@ -20,7 +20,7 @@ final class DeleteLocationsTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testErrorReturnedViaApiIfLocationIsAlreadyDeleted(): void
|
||||
public function testErrorReturnedViaApiIfLocationIsAlreadyDeleted()
|
||||
{
|
||||
$location = Location::factory()->deletedLocation()->create();
|
||||
$this->actingAsForApi(User::factory()->superuser()->create())
|
||||
|
@ -31,7 +31,7 @@ final class DeleteLocationsTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testDisallowLocationDeletionViaApiIfStillHasPeople(): void
|
||||
public function testDisallowLocationDeletionViaApiIfStillHasPeople()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
User::factory()->count(5)->create(['location_id' => $location->id]);
|
||||
|
@ -46,7 +46,7 @@ final class DeleteLocationsTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionViaApiIfStillHasChildLocations(): void
|
||||
public function testDisallowUserDeletionViaApiIfStillHasChildLocations()
|
||||
{
|
||||
$parent = Location::factory()->create();
|
||||
Location::factory()->count(5)->create(['parent_id' => $parent->id]);
|
||||
|
@ -60,7 +60,7 @@ final class DeleteLocationsTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionViaApiIfStillHasAssetsAssigned(): void
|
||||
public function testDisallowUserDeletionViaApiIfStillHasAssetsAssigned()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
Asset::factory()->count(5)->assignedToLocation($location)->create();
|
||||
|
@ -75,7 +75,7 @@ final class DeleteLocationsTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionViaApiIfStillHasAssetsAsLocation(): void
|
||||
public function testDisallowUserDeletionViaApiIfStillHasAssetsAsLocation()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
Asset::factory()->count(5)->create(['location_id' => $location->id]);
|
||||
|
|
|
@ -10,19 +10,19 @@ use Tests\TestCase;
|
|||
|
||||
final class IndexLocationsTest extends TestCase
|
||||
{
|
||||
public function testViewingLocationIndexRequiresAuthentication(): void
|
||||
public function testViewingLocationIndexRequiresAuthentication()
|
||||
{
|
||||
$this->getJson(route('api.locations.index'))->assertRedirect();
|
||||
}
|
||||
|
||||
public function testViewingLocationIndexRequiresPermission(): void
|
||||
public function testViewingLocationIndexRequiresPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->getJson(route('api.locations.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testLocationIndexReturnsExpectedLocations(): void
|
||||
public function testLocationIndexReturnsExpectedLocations()
|
||||
{
|
||||
Location::factory()->count(3)->create();
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ use Tests\TestCase;
|
|||
|
||||
final class LocationsForSelectListTest extends TestCase
|
||||
{
|
||||
public function testGettingLocationListRequiresProperPermission(): void
|
||||
public function testGettingLocationListRequiresProperPermission()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->getJson(route('api.locations.selectlist'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testLocationsReturned(): void
|
||||
public function testLocationsReturned()
|
||||
{
|
||||
Location::factory()->create();
|
||||
|
||||
|
@ -35,7 +35,7 @@ final class LocationsForSelectListTest extends TestCase
|
|||
->assertJson(fn(AssertableJson $json) => $json->has('results', 1)->etc());
|
||||
}
|
||||
|
||||
public function testLocationsAreReturnedWhenUserIsUpdatingTheirProfileAndHasPermissionToUpdateLocation(): void
|
||||
public function testLocationsAreReturnedWhenUserIsUpdatingTheirProfileAndHasPermissionToUpdateLocation()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->canEditOwnLocation()->create())
|
||||
->withHeader('referer', route('profile'))
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class LocationsViewTest extends TestCase
|
||||
{
|
||||
public function testViewingLocationRequiresPermission(): void
|
||||
public function testViewingLocationRequiresPermission()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
|
@ -17,7 +17,7 @@ final class LocationsViewTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testViewingLocationAssetIndexRequiresPermission(): void
|
||||
public function testViewingLocationAssetIndexRequiresPermission()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
|
@ -25,7 +25,7 @@ final class LocationsViewTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testViewingLocationAssetIndex(): void
|
||||
public function testViewingLocationAssetIndex()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
Asset::factory()->count(3)->assignedToLocation($location)->create();
|
||||
|
|
|
@ -9,14 +9,14 @@ use Tests\TestCase;
|
|||
final class UpdateLocationsTest extends TestCase
|
||||
{
|
||||
|
||||
public function testRequiresPermissionToEditLocation(): void
|
||||
public function testRequiresPermissionToEditLocation()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->postJson(route('api.locations.store', Location::factory()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCanUpdateLocationViaPatch(): void
|
||||
public function testCanUpdateLocationViaPatch()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CreateLocationsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToCreateLocation(): void
|
||||
public function testPermissionRequiredToCreateLocation()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('locations.store'), [
|
||||
|
@ -19,7 +19,7 @@ final class CreateLocationsTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanCreateLocations(): void
|
||||
public function testUserCanCreateLocations()
|
||||
{
|
||||
$this->assertFalse(Location::where('name', 'Test Location')->exists());
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ use Tests\TestCase;
|
|||
|
||||
final class IndexLocationsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToViewLocationsList(): void
|
||||
public function testPermissionRequiredToViewLocationsList()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('locations.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListLocations(): void
|
||||
public function testUserCanListLocations()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('locations.index'))
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class UpdateLocationsTest extends TestCase
|
||||
{
|
||||
public function testPermissionRequiredToStoreLocation(): void
|
||||
public function testPermissionRequiredToStoreLocation()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->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']);
|
||||
$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());
|
||||
}
|
||||
|
||||
public function testUserCannotEditLocationsToMakeThemTheirOwnParent(): void
|
||||
public function testUserCannotEditLocationsToMakeThemTheirOwnParent()
|
||||
{
|
||||
$location = Location::factory()->create();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ final class EmailNotificationsUponCheckinTest extends TestCase
|
|||
Notification::fake();
|
||||
}
|
||||
|
||||
public function testCheckInEmailSentToUserIfSettingEnabled(): void
|
||||
public function testCheckInEmailSentToUserIfSettingEnabled()
|
||||
{
|
||||
$user = User::factory()->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();
|
||||
$asset = Asset::factory()->assignedToUser($user)->create();
|
||||
|
|
|
@ -45,7 +45,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
|
|||
];
|
||||
}
|
||||
|
||||
public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled(): void
|
||||
public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled()
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -57,7 +57,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
|
|||
$this->assertSlackNotificationSent(CheckinAccessoryNotification::class);
|
||||
}
|
||||
|
||||
public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled(): void
|
||||
public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled()
|
||||
{
|
||||
$this->settings->disableSlackWebhook();
|
||||
|
||||
|
@ -70,7 +70,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('assetCheckInTargets')]
|
||||
public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void
|
||||
public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -83,7 +83,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('assetCheckInTargets')]
|
||||
public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void
|
||||
public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->disableSlackWebhook();
|
||||
|
||||
|
@ -95,7 +95,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
|
|||
$this->assertNoSlackNotificationSent(CheckinAssetNotification::class);
|
||||
}
|
||||
|
||||
public function testComponentCheckinDoesNotSendSlackNotification(): void
|
||||
public function testComponentCheckinDoesNotSendSlackNotification()
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -108,7 +108,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('licenseCheckInTargets')]
|
||||
public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void
|
||||
public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -121,7 +121,7 @@ final class SlackNotificationsUponCheckinTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('licenseCheckInTargets')]
|
||||
public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void
|
||||
public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->disableSlackWebhook();
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
];
|
||||
}
|
||||
|
||||
public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled(): void
|
||||
public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled()
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -59,7 +59,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
$this->assertSlackNotificationSent(CheckoutAccessoryNotification::class);
|
||||
}
|
||||
|
||||
public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled(): void
|
||||
public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()
|
||||
{
|
||||
$this->settings->disableSlackWebhook();
|
||||
|
||||
|
@ -72,7 +72,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('assetCheckoutTargets')]
|
||||
public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void
|
||||
public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -85,7 +85,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('assetCheckoutTargets')]
|
||||
public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void
|
||||
public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->disableSlackWebhook();
|
||||
|
||||
|
@ -97,7 +97,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
$this->assertNoSlackNotificationSent(CheckoutAssetNotification::class);
|
||||
}
|
||||
|
||||
public function testComponentCheckoutDoesNotSendSlackNotification(): void
|
||||
public function testComponentCheckoutDoesNotSendSlackNotification()
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -109,7 +109,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
Notification::assertNothingSent();
|
||||
}
|
||||
|
||||
public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled(): void
|
||||
public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled()
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -121,7 +121,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
$this->assertSlackNotificationSent(CheckoutConsumableNotification::class);
|
||||
}
|
||||
|
||||
public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled(): void
|
||||
public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()
|
||||
{
|
||||
$this->settings->disableSlackWebhook();
|
||||
|
||||
|
@ -134,7 +134,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('licenseCheckoutTargets')]
|
||||
public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget): void
|
||||
public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->enableSlackWebhook();
|
||||
|
||||
|
@ -147,7 +147,7 @@ final class SlackNotificationsUponCheckoutTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('licenseCheckoutTargets')]
|
||||
public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget): void
|
||||
public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
|
||||
{
|
||||
$this->settings->disableSlackWebhook();
|
||||
|
||||
|
|
|
@ -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 B']);
|
||||
|
@ -59,7 +59,7 @@ final class CustomReportTest extends TestCase
|
|||
->assertSeeTextInStreamedResponse('Asset B');
|
||||
}
|
||||
|
||||
public function testCustomAssetReportAdheresToCompanyScoping(): void
|
||||
public function testCustomAssetReportAdheresToCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
@ -105,7 +105,7 @@ final class CustomReportTest extends TestCase
|
|||
->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 B', 'last_checkin' => '2023-08-02']);
|
||||
|
|
|
@ -44,14 +44,14 @@ final class UnacceptedAssetReportTest extends TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testPermissionRequiredToViewUnacceptedAssetReport(): void
|
||||
public function testPermissionRequiredToViewUnacceptedAssetReport()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('reports/unaccepted_assets'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testUserCanListUnacceptedAssets(): void
|
||||
public function testUserCanListUnacceptedAssets()
|
||||
{
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->get(route('reports/unaccepted_assets'))
|
||||
|
|
|
@ -12,7 +12,7 @@ use App\Models\Setting;
|
|||
|
||||
final class BrandingSettingsTest extends TestCase
|
||||
{
|
||||
public function testSiteNameIsRequired(): void
|
||||
public function testSiteNameIsRequired()
|
||||
{
|
||||
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||
->from(route('settings.branding.index'))
|
||||
|
@ -25,7 +25,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee(trans('general.error'));
|
||||
}
|
||||
|
||||
public function testSiteNameCanBeSaved(): void
|
||||
public function testSiteNameCanBeSaved()
|
||||
{
|
||||
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||
->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');
|
||||
$setting = Setting::factory()->create(['logo' => null]);
|
||||
|
@ -58,7 +58,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
Storage::disk('public')->assertExists($setting->logo);
|
||||
}
|
||||
|
||||
public function testLogoCanBeDeleted(): void
|
||||
public function testLogoCanBeDeleted()
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
||||
|
@ -82,7 +82,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
//Storage::disk('public')->assertMissing($original_file);
|
||||
}
|
||||
|
||||
public function testEmailLogoCanBeUploaded(): void
|
||||
public function testEmailLogoCanBeUploaded()
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
||||
|
@ -108,7 +108,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
// Storage::disk('public')->assertMissing($original_file);
|
||||
}
|
||||
|
||||
public function testEmailLogoCanBeDeleted(): void
|
||||
public function testEmailLogoCanBeDeleted()
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
||||
|
@ -135,7 +135,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testLabelLogoCanBeUploaded(): void
|
||||
public function testLabelLogoCanBeUploaded()
|
||||
{
|
||||
|
||||
Storage::fake('public');
|
||||
|
@ -164,7 +164,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testLabelLogoCanBeDeleted(): void
|
||||
public function testLabelLogoCanBeDeleted()
|
||||
{
|
||||
|
||||
Storage::fake('public');
|
||||
|
@ -191,7 +191,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testDefaultAvatarCanBeUploaded(): void
|
||||
public function testDefaultAvatarCanBeUploaded()
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
||||
|
@ -213,7 +213,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
// Storage::disk('public')->assertMissing($original_file);
|
||||
}
|
||||
|
||||
public function testDefaultAvatarCanBeDeleted(): void
|
||||
public function testDefaultAvatarCanBeDeleted()
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
||||
|
@ -238,7 +238,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
// Storage::disk('public')->assertMissing($original_file);
|
||||
}
|
||||
|
||||
public function testSnipeDefaultAvatarCanBeDeleted(): void
|
||||
public function testSnipeDefaultAvatarCanBeDeleted()
|
||||
{
|
||||
|
||||
$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');
|
||||
Storage::fake('public');
|
||||
|
@ -284,7 +284,7 @@ final class BrandingSettingsTest extends TestCase
|
|||
Storage::disk('public')->assertExists('favicon.png');
|
||||
}
|
||||
|
||||
public function testFaviconCanBeDeleted(): void
|
||||
public function testFaviconCanBeDeleted()
|
||||
{
|
||||
$this->markTestIncomplete('This fails mimetype validation on the mock');
|
||||
Storage::fake('public');
|
||||
|
|
|
@ -302,7 +302,7 @@ final class ShowSetUpPageTest extends TestCase
|
|||
$this->assertSeeDirectoryPermissionError(false);
|
||||
}
|
||||
|
||||
public function testInvalidTLSCertsOkWhenCheckingForEnvFile(): void
|
||||
public function testInvalidTLSCertsOkWhenCheckingForEnvFile()
|
||||
{
|
||||
//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 ...");
|
||||
|
|
|
@ -12,7 +12,7 @@ final class DeleteUserTest extends TestCase
|
|||
{
|
||||
|
||||
|
||||
public function testErrorReturnedViaApiIfUserDoesNotExist(): void
|
||||
public function testErrorReturnedViaApiIfUserDoesNotExist()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->deleteUsers()->create())
|
||||
->deleteJson(route('api.users.destroy', 'invalid-id'))
|
||||
|
@ -22,7 +22,7 @@ final class DeleteUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testErrorReturnedViaApiIfUserIsAlreadyDeleted(): void
|
||||
public function testErrorReturnedViaApiIfUserIsAlreadyDeleted()
|
||||
{
|
||||
$user = User::factory()->deletedUser()->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();
|
||||
User::factory()->count(5)->create(['manager_id' => $manager->id]);
|
||||
|
@ -48,7 +48,7 @@ final class DeleteUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionViaApiIfStillManagingLocations(): void
|
||||
public function testDisallowUserDeletionViaApiIfStillManagingLocations()
|
||||
{
|
||||
$manager = User::factory()->create();
|
||||
Location::factory()->count(5)->create(['manager_id' => $manager->id]);
|
||||
|
@ -63,7 +63,7 @@ final class DeleteUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionViaApiIfStillHasLicenses(): void
|
||||
public function testDisallowUserDeletionViaApiIfStillHasLicenses()
|
||||
{
|
||||
$manager = User::factory()->create();
|
||||
LicenseSeat::factory()->count(5)->create(['assigned_to' => $manager->id]);
|
||||
|
@ -78,7 +78,7 @@ final class DeleteUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testDeniedPermissionsForDeletingUserViaApi(): void
|
||||
public function testDeniedPermissionsForDeletingUserViaApi()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->create())
|
||||
->deleteJson(route('api.users.destroy', User::factory()->create()))
|
||||
|
@ -86,7 +86,7 @@ final class DeleteUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testSuccessPermissionsForDeletingUserViaApi(): void
|
||||
public function testSuccessPermissionsForDeletingUserViaApi()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->deleteUsers()->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();
|
||||
|
||||
|
@ -139,7 +139,7 @@ final class DeleteUserTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testUsersCannotDeleteThemselves(): void
|
||||
public function testUsersCannotDeleteThemselves()
|
||||
{
|
||||
$user = User::factory()->deleteUsers()->create();
|
||||
$this->actingAsForApi($user)
|
||||
|
|
|
@ -12,7 +12,7 @@ final class RestoreUserTest extends TestCase
|
|||
{
|
||||
|
||||
|
||||
public function testErrorReturnedViaApiIfUserDoesNotExist(): void
|
||||
public function testErrorReturnedViaApiIfUserDoesNotExist()
|
||||
{
|
||||
$this->actingAsForApi(User::factory()->deleteUsers()->create())
|
||||
->postJson(route('api.users.restore', 'invalid-id'))
|
||||
|
@ -22,7 +22,7 @@ final class RestoreUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testErrorReturnedViaApiIfUserIsNotDeleted(): void
|
||||
public function testErrorReturnedViaApiIfUserIsNotDeleted()
|
||||
{
|
||||
$user = User::factory()->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())
|
||||
->postJson(route('api.users.restore', User::factory()->deletedUser()->create()))
|
||||
|
@ -42,7 +42,7 @@ final class RestoreUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testSuccessPermissionsForRestoringUserViaApi(): void
|
||||
public function testSuccessPermissionsForRestoringUserViaApi()
|
||||
{
|
||||
$deleted_user = User::factory()->deletedUser()->create();
|
||||
|
||||
|
@ -57,7 +57,7 @@ final class RestoreUserTest extends TestCase
|
|||
$this->assertNull($deleted_user->deleted_at);
|
||||
}
|
||||
|
||||
public function testPermissionsForRestoringIfNotInSameCompanyAndNotSuperadmin(): void
|
||||
public function testPermissionsForRestoringIfNotInSameCompanyAndNotSuperadmin()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use Tests\TestCase;
|
|||
|
||||
final class UpdateUserTest extends TestCase
|
||||
{
|
||||
public function testCanUpdateUserViaPatch(): void
|
||||
public function testCanUpdateUserViaPatch()
|
||||
{
|
||||
$admin = User::factory()->superuser()->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');
|
||||
}
|
||||
|
||||
public function testApiUsersCanBeActivatedWithNumber(): void
|
||||
public function testApiUsersCanBeActivatedWithNumber()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => 0]);
|
||||
|
@ -95,7 +95,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(1, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testApiUsersCanBeActivatedWithBooleanTrue(): void
|
||||
public function testApiUsersCanBeActivatedWithBooleanTrue()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => false]);
|
||||
|
@ -108,7 +108,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(1, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testApiUsersCanBeDeactivatedWithNumber(): void
|
||||
public function testApiUsersCanBeDeactivatedWithNumber()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => true]);
|
||||
|
@ -121,7 +121,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(0, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testApiUsersCanBeDeactivatedWithBooleanFalse(): void
|
||||
public function testApiUsersCanBeDeactivatedWithBooleanFalse()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => true]);
|
||||
|
@ -134,7 +134,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(0, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testUsersScopedToCompanyDuringUpdateWhenMultipleFullCompanySupportEnabled(): void
|
||||
public function testUsersScopedToCompanyDuringUpdateWhenMultipleFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -223,7 +223,7 @@ final class UpdateUserTest extends TestCase
|
|||
->json();
|
||||
}
|
||||
|
||||
public function testUserGroupsAreOnlyUpdatedIfAuthenticatedUserIsSuperUser(): void
|
||||
public function testUserGroupsAreOnlyUpdatedIfAuthenticatedUserIsSuperUser()
|
||||
{
|
||||
$groupToJoin = Group::factory()->create();
|
||||
|
||||
|
@ -250,7 +250,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertTrue($userToUpdateByToUserBySuperuser->refresh()->groups->contains($groupToJoin));
|
||||
}
|
||||
|
||||
public function testUserGroupsCanBeClearedBySuperUser(): void
|
||||
public function testUserGroupsCanBeClearedBySuperUser()
|
||||
{
|
||||
$normalUser = User::factory()->editUsers()->create();
|
||||
$superUser = User::factory()->superuser()->create();
|
||||
|
@ -276,7 +276,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertFalse($anotherUserToUpdate->refresh()->groups->contains($joinedGroup));
|
||||
}
|
||||
|
||||
public function testNonSuperuserCannotUpdateOwnGroups(): void
|
||||
public function testNonSuperuserCannotUpdateOwnGroups()
|
||||
{
|
||||
$groupToJoin = Group::factory()->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();
|
||||
$group = Group::factory()->create();
|
||||
|
@ -313,7 +313,7 @@ final class UpdateUserTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testUsersGroupsAreNotClearedIfNoGroupPassedBySuperUser(): void
|
||||
public function testUsersGroupsAreNotClearedIfNoGroupPassedBySuperUser()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$superUser = User::factory()->superuser()->create();
|
||||
|
@ -327,7 +327,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertTrue($user->refresh()->groups->contains($group));
|
||||
}
|
||||
|
||||
public function testMultipleGroupsUpdateBySuperUser(): void
|
||||
public function testMultipleGroupsUpdateBySuperUser()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$superUser = User::factory()->superuser()->create();
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\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' => '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')));
|
||||
}
|
||||
|
||||
public function testResultsWhenSearchingForActiveUsers(): void
|
||||
public function testResultsWhenSearchingForActiveUsers()
|
||||
{
|
||||
User::factory()->create(['first_name' => 'Active', 'last_name' => 'User']);
|
||||
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' => 'Deleted', 'last_name' => 'User'])->delete();
|
||||
|
@ -82,7 +82,7 @@ final class UserSearchTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled(): void
|
||||
public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -110,7 +110,7 @@ final class UserSearchTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled(): void
|
||||
public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled()
|
||||
{
|
||||
$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');
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
|
||||
final class UsersForSelectListTest extends TestCase
|
||||
{
|
||||
public function testUsersAreReturned(): void
|
||||
public function testUsersAreReturned()
|
||||
{
|
||||
$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());
|
||||
}
|
||||
|
||||
public function testUsersCanBeSearchedByFirstAndLastName(): void
|
||||
public function testUsersCanBeSearchedByFirstAndLastName()
|
||||
{
|
||||
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')));
|
||||
}
|
||||
|
||||
public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled(): void
|
||||
public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -68,7 +68,7 @@ final class UsersForSelectListTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled(): void
|
||||
public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use Tests\TestCase;
|
|||
final class ViewUserTest extends TestCase
|
||||
{
|
||||
|
||||
public function testCanReturnUser(): void
|
||||
public function testCanReturnUser()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use App\Models\Asset;
|
|||
final class DeleteUserTest extends TestCase
|
||||
{
|
||||
|
||||
public function testUserCanDeleteAnotherUser(): void
|
||||
public function testUserCanDeleteAnotherUser()
|
||||
{
|
||||
$user = User::factory()->deleteUsers()->viewUsers()->create();
|
||||
$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())
|
||||
->delete(route('users.destroy', ['user' => '40596803548609346']))
|
||||
|
@ -37,7 +37,7 @@ final class DeleteUserTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee(trans('alert-danger'));
|
||||
}
|
||||
|
||||
public function testErrorReturnedIfUserIsAlreadyDeleted(): void
|
||||
public function testErrorReturnedIfUserIsAlreadyDeleted()
|
||||
{
|
||||
$user = User::factory()->deletedUser()->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();
|
||||
|
@ -90,7 +90,7 @@ final class DeleteUserTest extends TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testDisallowUserDeletionIfStillManagingPeople(): void
|
||||
public function testDisallowUserDeletionIfStillManagingPeople()
|
||||
{
|
||||
$manager = User::factory()->create();
|
||||
User::factory()->count(1)->create(['manager_id' => $manager->id]);
|
||||
|
@ -105,7 +105,7 @@ final class DeleteUserTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee('Error');
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionIfStillManagingLocations(): void
|
||||
public function testDisallowUserDeletionIfStillManagingLocations()
|
||||
{
|
||||
$manager = User::factory()->create();
|
||||
Location::factory()->count(2)->create(['manager_id' => $manager->id]);
|
||||
|
@ -120,7 +120,7 @@ final class DeleteUserTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee('Error');
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionIfStillHaveAccessories(): void
|
||||
public function testDisallowUserDeletionIfStillHaveAccessories()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
Accessory::factory()->count(3)->checkedOutToUser($user)->create();
|
||||
|
@ -135,7 +135,7 @@ final class DeleteUserTest extends TestCase
|
|||
$this->followRedirects($response)->assertSee('Error');
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionIfStillHaveLicenses(): void
|
||||
public function testDisallowUserDeletionIfStillHaveLicenses()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
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();
|
||||
$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();
|
||||
Location::factory()->create(['manager_id' => $manager->id]);
|
||||
$this->actingAs(User::factory()->editUsers()->viewUsers()->create())->assertFalse($manager->isDeletable());
|
||||
}
|
||||
|
||||
public function testDisallowUserDeletionIfTheyStillHaveAssets(): void
|
||||
public function testDisallowUserDeletionIfTheyStillHaveAssets()
|
||||
{
|
||||
$user = User::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();
|
||||
$this->actingAs(User::factory()->deleteUsers()->viewUsers()->create())->assertTrue($manager->isDeletable());
|
||||
|
|
|
@ -13,7 +13,7 @@ use Tests\TestCase;
|
|||
|
||||
final class MergeUsersTest extends TestCase
|
||||
{
|
||||
public function testAssetsAreTransferredOnUserMerge(): void
|
||||
public function testAssetsAreTransferredOnUserMerge()
|
||||
{
|
||||
$user1 = 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();
|
||||
$user2 = User::factory()->create();
|
||||
|
@ -67,7 +67,7 @@ final class MergeUsersTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testAccessoriesTransferredOnUserMerge(): void
|
||||
public function testAccessoriesTransferredOnUserMerge()
|
||||
{
|
||||
$user1 = 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();
|
||||
$user2 = User::factory()->create();
|
||||
|
@ -123,7 +123,7 @@ final class MergeUsersTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testFilesAreTransferredOnUserMerge(): void
|
||||
public function testFilesAreTransferredOnUserMerge()
|
||||
{
|
||||
$user1 = 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();
|
||||
$user2 = User::factory()->create();
|
||||
|
@ -179,7 +179,7 @@ final class MergeUsersTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testUserUpdateHistoryIsTransferredOnUserMerge(): void
|
||||
public function testUserUpdateHistoryIsTransferredOnUserMerge()
|
||||
{
|
||||
$user1 = User::factory()->create();
|
||||
$user2 = User::factory()->create();
|
||||
|
|
|
@ -7,7 +7,7 @@ use Tests\TestCase;
|
|||
|
||||
final class UpdateUserTest extends TestCase
|
||||
{
|
||||
public function testUsersCanBeActivatedWithNumber(): void
|
||||
public function testUsersCanBeActivatedWithNumber()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => 0]);
|
||||
|
@ -22,7 +22,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(1, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testUsersCanBeActivatedWithBooleanTrue(): void
|
||||
public function testUsersCanBeActivatedWithBooleanTrue()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => false]);
|
||||
|
@ -37,7 +37,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(1, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testUsersCanBeDeactivatedWithNumber(): void
|
||||
public function testUsersCanBeDeactivatedWithNumber()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => true]);
|
||||
|
@ -52,7 +52,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(0, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testUsersCanBeDeactivatedWithBooleanFalse(): void
|
||||
public function testUsersCanBeDeactivatedWithBooleanFalse()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->create(['activated' => true]);
|
||||
|
@ -67,7 +67,7 @@ final class UpdateUserTest extends TestCase
|
|||
$this->assertEquals(0, $user->refresh()->activated);
|
||||
}
|
||||
|
||||
public function testUsersUpdatingThemselvesDoNotDeactivateTheirAccount(): void
|
||||
public function testUsersUpdatingThemselvesDoNotDeactivateTheirAccount()
|
||||
{
|
||||
$admin = User::factory()->superuser()->create(['activated' => true]);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ViewUserTest extends TestCase
|
||||
{
|
||||
public function testPermissionsForUserDetailPage(): void
|
||||
public function testPermissionsForUserDetailPage()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -29,7 +29,7 @@ final class ViewUserTest extends TestCase
|
|||
->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testPermissionsForPrintAllInventoryPage(): void
|
||||
public function testPermissionsForPrintAllInventoryPage()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -52,7 +52,7 @@ final class ViewUserTest extends TestCase
|
|||
->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testUserWithoutCompanyPermissionsCannotSendInventory(): void
|
||||
public function testUserWithoutCompanyPermissionsCannotSendInventory()
|
||||
{
|
||||
|
||||
Notification::fake();
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AccessoryTest extends TestCase
|
||||
{
|
||||
public function testAnAccessoryBelongsToACompany(): void
|
||||
public function testAnAccessoryBelongsToACompany()
|
||||
{
|
||||
$accessory = Accessory::factory()
|
||||
->create(
|
||||
|
@ -20,7 +20,7 @@ final class AccessoryTest extends TestCase
|
|||
$this->assertInstanceOf(Company::class, $accessory->company);
|
||||
}
|
||||
|
||||
public function testAnAccessoryHasALocation(): void
|
||||
public function testAnAccessoryHasALocation()
|
||||
{
|
||||
$accessory = Accessory::factory()
|
||||
->create(
|
||||
|
@ -30,7 +30,7 @@ final class AccessoryTest extends TestCase
|
|||
$this->assertInstanceOf(Location::class, $accessory->location);
|
||||
}
|
||||
|
||||
public function testAnAccessoryBelongsToACategory(): void
|
||||
public function testAnAccessoryBelongsToACategory()
|
||||
{
|
||||
$accessory = Accessory::factory()->appleBtKeyboard()
|
||||
->create(
|
||||
|
@ -45,7 +45,7 @@ final class AccessoryTest extends TestCase
|
|||
$this->assertEquals('accessory', $accessory->category->category_type);
|
||||
}
|
||||
|
||||
public function testAnAccessoryHasAManufacturer(): void
|
||||
public function testAnAccessoryHasAManufacturer()
|
||||
{
|
||||
$accessory = Accessory::factory()->appleBtKeyboard()->create(
|
||||
[
|
||||
|
|
|
@ -6,7 +6,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AssetMaintenanceTest extends TestCase
|
||||
{
|
||||
public function testZerosOutWarrantyIfBlank(): void
|
||||
public function testZerosOutWarrantyIfBlank()
|
||||
{
|
||||
$c = new AssetMaintenance;
|
||||
$c->is_warranty = '';
|
||||
|
@ -15,7 +15,7 @@ final class AssetMaintenanceTest extends TestCase
|
|||
$this->assertTrue($c->is_warranty == 4);
|
||||
}
|
||||
|
||||
public function testSetsCostsAppropriately(): void
|
||||
public function testSetsCostsAppropriately()
|
||||
{
|
||||
$c = new AssetMaintenance();
|
||||
$c->cost = '0.00';
|
||||
|
@ -26,7 +26,7 @@ final class AssetMaintenanceTest extends TestCase
|
|||
$this->assertTrue($c->cost === 9.5);
|
||||
}
|
||||
|
||||
public function testNullsOutNotesIfBlank(): void
|
||||
public function testNullsOutNotesIfBlank()
|
||||
{
|
||||
$c = new AssetMaintenance;
|
||||
$c->notes = '';
|
||||
|
@ -35,7 +35,7 @@ final class AssetMaintenanceTest extends TestCase
|
|||
$this->assertTrue($c->notes === 'This is a long note');
|
||||
}
|
||||
|
||||
public function testNullsOutCompletionDateIfBlankOrInvalid(): void
|
||||
public function testNullsOutCompletionDateIfBlankOrInvalid()
|
||||
{
|
||||
$c = new AssetMaintenance;
|
||||
$c->completion_date = '';
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class AssetModelTest extends TestCase
|
||||
{
|
||||
public function testAnAssetModelContainsAssets(): void
|
||||
public function testAnAssetModelContainsAssets()
|
||||
{
|
||||
$category = Category::factory()->create([
|
||||
'category_type' => 'asset'
|
||||
|
|
|
@ -10,7 +10,7 @@ use App\Models\Setting;
|
|||
|
||||
final class AssetTest extends TestCase
|
||||
{
|
||||
public function testAutoIncrement(): void
|
||||
public function testAutoIncrement()
|
||||
{
|
||||
$this->settings->enableAutoIncrement();
|
||||
|
||||
|
@ -22,7 +22,7 @@ final class AssetTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testAutoIncrementCollision(): void
|
||||
public function testAutoIncrementCollision()
|
||||
{
|
||||
$this->settings->enableAutoIncrement();
|
||||
|
||||
|
@ -34,7 +34,7 @@ final class AssetTest extends TestCase
|
|||
$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 sure you can then still make another
|
||||
|
@ -53,7 +53,7 @@ final class AssetTest extends TestCase
|
|||
$this->assertEquals($c->asset_tag, $final_number);
|
||||
}
|
||||
|
||||
public function testAutoIncrementGapAndBackfill(): void
|
||||
public function testAutoIncrementGapAndBackfill()
|
||||
{
|
||||
// make one asset 3 higher than the next auto-increment
|
||||
// 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);
|
||||
}
|
||||
|
||||
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?
|
||||
$this->settings->enableAutoIncrement()->set(['auto_increment_prefix' => '']);
|
||||
|
@ -109,7 +109,7 @@ final class AssetTest extends TestCase
|
|||
$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?
|
||||
$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);
|
||||
}
|
||||
|
||||
public function testAutoIncrementBIG(): void
|
||||
public function testAutoIncrementBIG()
|
||||
{
|
||||
$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");
|
||||
}
|
||||
|
||||
public function testAutoIncrementAlmostBIG(): void
|
||||
public function testAutoIncrementAlmostBIG()
|
||||
{
|
||||
// TODO: this looks pretty close to the one above, could we maybe squish them together?
|
||||
$this->settings->enableAutoIncrement();
|
||||
|
@ -170,7 +170,7 @@ final class AssetTest extends TestCase
|
|||
}
|
||||
|
||||
|
||||
public function testWarrantyExpiresAttribute(): void
|
||||
public function testWarrantyExpiresAttribute()
|
||||
{
|
||||
|
||||
$asset = Asset::factory()
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CategoryTest extends TestCase
|
||||
{
|
||||
public function testFailsEmptyValidation(): void
|
||||
public function testFailsEmptyValidation()
|
||||
{
|
||||
// An Asset requires a name, a qty, and a category_id.
|
||||
$a = Category::create();
|
||||
|
@ -24,7 +24,7 @@ final class CategoryTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testACategoryCanHaveAssets(): void
|
||||
public function testACategoryCanHaveAssets()
|
||||
{
|
||||
$category = Category::factory()->assetDesktopCategory()->create();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ final class CompanyScopingTest extends TestCase
|
|||
}
|
||||
|
||||
#[DataProvider('models')]
|
||||
public function testCompanyScoping($model): void
|
||||
public function testCompanyScoping($model)
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
@ -69,7 +69,7 @@ final class CompanyScopingTest extends TestCase
|
|||
$this->assertCanSee($modelB);
|
||||
}
|
||||
|
||||
public function testAssetMaintenanceCompanyScoping(): void
|
||||
public function testAssetMaintenanceCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
@ -109,7 +109,7 @@ final class CompanyScopingTest extends TestCase
|
|||
$this->assertCanSee($assetMaintenanceForCompanyB);
|
||||
}
|
||||
|
||||
public function testLicenseSeatCompanyScoping(): void
|
||||
public function testLicenseSeatCompanyScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class ComponentTest extends TestCase
|
||||
{
|
||||
public function testAComponentBelongsToACompany(): void
|
||||
public function testAComponentBelongsToACompany()
|
||||
{
|
||||
$component = Component::factory()
|
||||
->create(
|
||||
|
@ -20,14 +20,14 @@ final class ComponentTest extends TestCase
|
|||
$this->assertInstanceOf(Company::class, $component->company);
|
||||
}
|
||||
|
||||
public function testAComponentHasALocation(): void
|
||||
public function testAComponentHasALocation()
|
||||
{
|
||||
$component = Component::factory()
|
||||
->create(['location_id' => Location::factory()->create()->id]);
|
||||
$this->assertInstanceOf(Location::class, $component->location);
|
||||
}
|
||||
|
||||
public function testAComponentBelongsToACategory(): void
|
||||
public function testAComponentBelongsToACategory()
|
||||
{
|
||||
$component = Component::factory()->ramCrucial4()
|
||||
->create(
|
||||
|
|
|
@ -10,14 +10,14 @@ use Tests\TestCase;
|
|||
*/
|
||||
final class CustomFieldTest extends TestCase
|
||||
{
|
||||
public function testFormat(): void
|
||||
public function testFormat()
|
||||
{
|
||||
$customfield = CustomField::factory()->make(['format' => 'IP']);
|
||||
$this->assertEquals($customfield->getAttributes()['format'], CustomField::PREDEFINED_FORMATS['IP']); //this seems undocumented...
|
||||
$this->assertEquals($customfield->format, 'IP');
|
||||
}
|
||||
|
||||
public function testDbNameAscii(): void
|
||||
public function testDbNameAscii()
|
||||
{
|
||||
$customfield = new CustomField();
|
||||
$customfield->name = 'My hovercraft is full of eels';
|
||||
|
@ -26,7 +26,7 @@ final class CustomFieldTest extends TestCase
|
|||
}
|
||||
|
||||
// Western Europe
|
||||
public function testDbNameLatin(): void
|
||||
public function testDbNameLatin()
|
||||
{
|
||||
$customfield = new CustomField();
|
||||
$customfield->name = 'My hovercraft is full of eels';
|
||||
|
@ -35,7 +35,7 @@ final class CustomFieldTest extends TestCase
|
|||
}
|
||||
|
||||
// Asian
|
||||
public function testDbNameChinese(): void
|
||||
public function testDbNameChinese()
|
||||
{
|
||||
$customfield = new CustomField();
|
||||
$customfield->name = '我的氣墊船裝滿了鱔魚';
|
||||
|
@ -47,7 +47,7 @@ final class CustomFieldTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testDbNameJapanese(): void
|
||||
public function testDbNameJapanese()
|
||||
{
|
||||
$customfield = new CustomField();
|
||||
$customfield->name = '私のホバークラフトは鰻でいっぱいです';
|
||||
|
@ -59,7 +59,7 @@ final class CustomFieldTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testDbNameKorean(): void
|
||||
public function testDbNameKorean()
|
||||
{
|
||||
$customfield = new CustomField();
|
||||
$customfield->name = '내 호버크라프트는 장어로 가득 차 있어요';
|
||||
|
@ -72,7 +72,7 @@ final class CustomFieldTest extends TestCase
|
|||
}
|
||||
|
||||
// Nordic languages
|
||||
public function testDbNameNonLatinEuro(): void
|
||||
public function testDbNameNonLatinEuro()
|
||||
{
|
||||
$customfield = new CustomField();
|
||||
$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->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->name = 'حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون';
|
||||
|
|
|
@ -9,7 +9,7 @@ use Tests\TestCase;
|
|||
|
||||
final class DepreciationTest extends TestCase
|
||||
{
|
||||
public function testADepreciationHasModels(): void
|
||||
public function testADepreciationHasModels()
|
||||
{
|
||||
$depreciation = Depreciation::factory()->create();
|
||||
|
||||
|
@ -26,7 +26,7 @@ final class DepreciationTest extends TestCase
|
|||
$this->assertEquals(5, $depreciation->models->count());
|
||||
}
|
||||
|
||||
public function testADepreciationHasLicenses(): void
|
||||
public function testADepreciationHasLicenses()
|
||||
{
|
||||
|
||||
$depreciation = Depreciation::factory()->create();
|
||||
|
|
|
@ -10,17 +10,17 @@ use Tests\TestCase;
|
|||
|
||||
final class HelperTest extends TestCase
|
||||
{
|
||||
public function testDefaultChartColorsMethodHandlesHighValues(): void
|
||||
public function testDefaultChartColorsMethodHandlesHighValues()
|
||||
{
|
||||
$this->assertIsString(Helper::defaultChartColors(1000));
|
||||
}
|
||||
|
||||
public function testDefaultChartColorsMethodHandlesNegativeNumbers(): void
|
||||
public function testDefaultChartColorsMethodHandlesNegativeNumbers()
|
||||
{
|
||||
$this->assertIsString(Helper::defaultChartColors(-1));
|
||||
}
|
||||
|
||||
public function testParseCurrencyMethod(): void
|
||||
public function testParseCurrencyMethod()
|
||||
{
|
||||
$this->settings->set(['default_currency' => 'USD']);
|
||||
$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->assertSame(12.34, Helper::ParseCurrency('12,34'));
|
||||
}
|
||||
public function testGetRedirectOptionMethod(): void
|
||||
public function testGetRedirectOptionMethod()
|
||||
{
|
||||
$test_data = [
|
||||
'Option target: redirect for user assigned to ' => [
|
||||
|
|
|
@ -11,7 +11,7 @@ final class LdapTest extends TestCase
|
|||
{
|
||||
use \phpmock\phpunit\PHPMock;
|
||||
|
||||
public function testConnect(): void
|
||||
public function testConnect()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
|
||||
|
@ -31,14 +31,14 @@ final class LdapTest extends TestCase
|
|||
// with/without ignore cert validation?
|
||||
// test (and mock) ldap_start_tls() ?
|
||||
|
||||
public function testBindAdmin(): void
|
||||
public function testBindAdmin()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
$this->getFunctionMock("App\\Models", "ldap_bind")->expects($this->once())->willReturn(true);
|
||||
$this->assertNull(Ldap::bindAdminToLdap("dummy"));
|
||||
}
|
||||
|
||||
public function testBindBad(): void
|
||||
public function testBindBad()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
$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?
|
||||
|
||||
public function testAnonymousBind(): void
|
||||
public function testAnonymousBind()
|
||||
{
|
||||
//todo - would be nice to introspect somehow to make sure the right parameters were passed?
|
||||
$this->settings->enableAnonymousLdap();
|
||||
|
@ -57,7 +57,7 @@ final class LdapTest extends TestCase
|
|||
$this->assertNull(Ldap::bindAdminToLdap("dummy"));
|
||||
}
|
||||
|
||||
public function testBadAnonymousBind(): void
|
||||
public function testBadAnonymousBind()
|
||||
{
|
||||
$this->settings->enableAnonymousLdap();
|
||||
$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"));
|
||||
}
|
||||
|
||||
public function testBadEncryptedPassword(): void
|
||||
public function testBadEncryptedPassword()
|
||||
{
|
||||
$this->settings->enableBadPasswordLdap();
|
||||
|
||||
|
@ -75,7 +75,7 @@ final class LdapTest extends TestCase
|
|||
$this->assertNull(Ldap::bindAdminToLdap("dummy"));
|
||||
}
|
||||
|
||||
public function testFindAndBind(): void
|
||||
public function testFindAndBind()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
|
||||
|
@ -105,7 +105,7 @@ final class LdapTest extends TestCase
|
|||
$this->assertEqualsCanonicalizing(["count" =>1,0 =>['sn' => 'Surname','firstname' => 'FirstName']],$results);
|
||||
}
|
||||
|
||||
public function testFindAndBindBadPassword(): void
|
||||
public function testFindAndBindBadPassword()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
|
||||
|
@ -126,7 +126,7 @@ final class LdapTest extends TestCase
|
|||
$this->assertFalse($results);
|
||||
}
|
||||
|
||||
public function testFindAndBindCannotFindSelf(): void
|
||||
public function testFindAndBindCannotFindSelf()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
|
||||
|
@ -147,7 +147,7 @@ final class LdapTest extends TestCase
|
|||
|
||||
//maybe should do an AD test as well?
|
||||
|
||||
public function testFindLdapUsers(): void
|
||||
public function testFindLdapUsers()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
|
||||
|
@ -170,7 +170,7 @@ final class LdapTest extends TestCase
|
|||
$this->assertEqualsCanonicalizing(["count" => 1], $results);
|
||||
}
|
||||
|
||||
public function testFindLdapUsersPaginated(): void
|
||||
public function testFindLdapUsersPaginated()
|
||||
{
|
||||
$this->settings->enableLdap();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use Tests\TestCase;
|
|||
|
||||
final class LogListenerTest extends TestCase
|
||||
{
|
||||
public function testLogsEntryOnCheckoutableCheckedOut(): void
|
||||
public function testLogsEntryOnCheckoutableCheckedOut()
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$checkedOutTo = User::factory()->create();
|
||||
|
|
|
@ -6,7 +6,7 @@ use Tests\TestCase;
|
|||
|
||||
final class LocationTest extends TestCase
|
||||
{
|
||||
public function testPassesIfNotSelfParent(): void
|
||||
public function testPassesIfNotSelfParent()
|
||||
{
|
||||
$a = Location::factory()->make([
|
||||
'name' => 'Test Location',
|
||||
|
@ -17,7 +17,7 @@ final class LocationTest extends TestCase
|
|||
$this->assertTrue($a->isValid());
|
||||
}
|
||||
|
||||
public function testFailsIfSelfParent(): void
|
||||
public function testFailsIfSelfParent()
|
||||
{
|
||||
$a = Location::factory()->make([
|
||||
'name' => 'Test Location',
|
||||
|
|
|
@ -7,7 +7,7 @@ use Tests\TestCase;
|
|||
|
||||
final class CompanyTest extends TestCase
|
||||
{
|
||||
public function testACompanyCanHaveUsers(): void
|
||||
public function testACompanyCanHaveUsers()
|
||||
{
|
||||
$company = Company::factory()->create();
|
||||
$user = User::factory()
|
||||
|
|
|
@ -8,7 +8,7 @@ use Tests\TestCase;
|
|||
|
||||
final class GetIdForCurrentUserTest extends TestCase
|
||||
{
|
||||
public function testReturnsProvidedValueWhenFullCompanySupportDisabled(): void
|
||||
public function testReturnsProvidedValueWhenFullCompanySupportDisabled()
|
||||
{
|
||||
$this->settings->disableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -16,7 +16,7 @@ final class GetIdForCurrentUserTest extends TestCase
|
|||
$this->assertEquals(1000, Company::getIdForCurrentUser(1000));
|
||||
}
|
||||
|
||||
public function testReturnsProvidedValueForSuperUsersWhenFullCompanySupportEnabled(): void
|
||||
public function testReturnsProvidedValueForSuperUsersWhenFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -24,7 +24,7 @@ final class GetIdForCurrentUserTest extends TestCase
|
|||
$this->assertEquals(2000, Company::getIdForCurrentUser(2000));
|
||||
}
|
||||
|
||||
public function testReturnsNonSuperUsersCompanyIdWhenFullCompanySupportEnabled(): void
|
||||
public function testReturnsNonSuperUsersCompanyIdWhenFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
@ -32,7 +32,7 @@ final class GetIdForCurrentUserTest extends TestCase
|
|||
$this->assertEquals(2000, Company::getIdForCurrentUser(1000));
|
||||
}
|
||||
|
||||
public function testReturnsProvidedValueForNonSuperUserWithoutCompanyIdWhenFullCompanySupportEnabled(): void
|
||||
public function testReturnsProvidedValueForNonSuperUserWithoutCompanyIdWhenFullCompanySupportEnabled()
|
||||
{
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue