Fix method and variable names

This commit is contained in:
Marcus Moore
2026-03-05 15:55:59 -08:00
parent 2ed32612b9
commit 261231c09e
10 changed files with 23 additions and 19 deletions

View File

@@ -11,7 +11,7 @@ use Tests\TestCase;
class UpdateAssetModelsTest extends TestCase
{
public function testPermissionRequiredToStoreAssetModel()
public function testPermissionRequiredToUpdateAssetModel()
{
$this->actingAs(User::factory()->create())
->put(route('models.update', ['model' => AssetModel::factory()->create()]), [

View File

@@ -8,10 +8,10 @@ use Tests\TestCase;
class AuditAssetTest extends TestCase
{
public function testPermissionRequiredToCreateAssetModel()
public function testPermissionRequiredToViewAuditCreatePage()
{
$this->actingAs(User::factory()->create())
->get(route('clone/hardware', Asset::factory()->create()))
->get(route('asset.audit.create', Asset::factory()->create()))
->assertForbidden();
}
@@ -22,6 +22,13 @@ class AuditAssetTest extends TestCase
->assertStatus(200);
}
public function testPermissionRequiredToAuditAsset()
{
$this->actingAs(User::factory()->create())
->post(route('asset.audit.store', Asset::factory()->create()))
->assertForbidden();
}
public function testAssetAuditPostIsRedirectedToAssetIndexIfRedirectSelectionIsIndex()
{
$asset = Asset::factory()->create();

View File

@@ -8,7 +8,7 @@ use Tests\TestCase;
class CloneAssetTest extends TestCase
{
public function testPermissionRequiredToCreateAssetModel()
public function testPermissionRequiredToCloneAsset()
{
$asset = Asset::factory()->create();
$this->actingAs(User::factory()->create())

View File

@@ -25,7 +25,6 @@ class ConsumableUpdateTest extends TestCase
$consumable->refresh();
$this->assertEquals('Test Consumable', $consumable->name, 'Name was not updated');
}
public function testCannotUpdateConsumableViaPatchWithInvalidCategoryType()
@@ -43,10 +42,8 @@ class ConsumableUpdateTest extends TestCase
->assertStatus(200)
->json();
$category->refresh();
$consumable->refresh();
$this->assertNotEquals('Test Consumable', $consumable->name, 'Name was not updated');
$this->assertNotEquals('consumable', $consumable->category_id, 'Category was not updated');
}
}

View File

@@ -11,7 +11,7 @@ class EditConsumableTest extends TestCase
public function testPageRenders()
{
$this->actingAs(User::factory()->superuser()->create())
->get(route('consumables.show', Consumable::factory()->create()))
->get(route('consumables.edit', Consumable::factory()->create()))
->assertOk();
}
}

View File

@@ -18,7 +18,7 @@ class IndexDepartmentsTest extends TestCase
public function testPageRenders()
{
$this->actingAs(User::factory()->superuser()->create())
->get(route('components.index'))
->get(route('departments.index'))
->assertOk();
}

View File

@@ -10,7 +10,7 @@ class DepreciationsIndexTest extends TestCase
public function testViewingDepreciationIndexRequiresPermission()
{
$this->actingAsForApi(User::factory()->create())
->getJson(route('api.departments.index'))
->getJson(route('api.depreciations.index'))
->assertForbidden();
}

View File

@@ -12,7 +12,7 @@ class CreateLocationsTest extends TestCase
public function testRequiresPermissionToCreateLocation()
{
$this->actingAsForApi(User::factory()->create())
->postJson(route('api.departments.store'))
->postJson(route('api.locations.store'))
->assertForbidden();
}
@@ -31,9 +31,9 @@ class CreateLocationsTest extends TestCase
$this->assertTrue(Location::where('name', 'Test Location')->exists());
$department = Location::find($response['payload']['id']);
$this->assertEquals('Test Location', $department->name);
$this->assertEquals('Test Note', $department->notes);
$location = Location::find($response['payload']['id']);
$this->assertEquals('Test Location', $location->name);
$this->assertEquals('Test Note', $location->notes);
}
public function testCannotCreateNewLocationsWithTheSameName()

View File

@@ -10,10 +10,10 @@ class CreateManufacturersTest extends TestCase
{
public function testRequiresPermissionToCreateDepartment()
public function testRequiresPermissionToCreateManufacturer()
{
$this->actingAsForApi(User::factory()->create())
->postJson(route('api.departments.store'))
->postJson(route('api.manufacturers.store'))
->assertForbidden();
}

View File

@@ -28,11 +28,11 @@ class UpdateManufacturersTest extends TestCase
public function testUserCanEditManufacturers()
{
$department = Manufacturer::factory()->create(['name' => 'Test Manufacturer']);
$manufacturer = Manufacturer::factory()->create(['name' => 'Test Manufacturer']);
$this->assertTrue(Manufacturer::where('name', 'Test Manufacturer')->exists());
$response = $this->actingAs(User::factory()->superuser()->create())
->put(route('manufacturers.update', ['manufacturer' => $department]), [
->put(route('manufacturers.update', ['manufacturer' => $manufacturer]), [
'name' => 'Test Manufacturer Edited',
'notes' => 'Test Note Edited',
])