mirror of
https://github.com/grokability/snipe-it.git
synced 2026-03-12 17:52:00 +08:00
Fix method and variable names
This commit is contained in:
@@ -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()]), [
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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',
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user