From 347eb2bdee8753f2658fb83869e7b121a32dc3df Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 19 Feb 2025 05:03:56 +0000 Subject: [PATCH] Fixed route parameters and tests to match Signed-off-by: snipe --- .../Accessories/AccessoriesController.php | 2 +- app/Http/Controllers/CompaniesController.php | 2 +- .../Components/ComponentsController.php | 4 +++- tests/Feature/Accessories/Ui/ShowAccessoryTest.php | 8 ++++---- .../Feature/Accessories/Ui/UpdateAccessoryTest.php | 2 +- .../Feature/AssetModels/Ui/ShowAssetModelsTest.php | 2 +- .../AssetModels/Ui/UpdateAssetModelsTest.php | 8 ++++---- tests/Feature/Assets/Ui/EditAssetTest.php | 8 ++++---- tests/Feature/Categories/Ui/ShowCategoryTest.php | 2 +- .../Feature/Categories/Ui/UpdateCategoriesTest.php | 14 +++++++------- tests/Feature/Checkins/Ui/AssetCheckinTest.php | 6 +++--- tests/Feature/Checkins/Ui/ComponentCheckinTest.php | 6 ++---- .../Feature/Checkouts/Ui/AccessoryCheckoutTest.php | 6 +++--- tests/Feature/Checkouts/Ui/AssetCheckoutTest.php | 6 +++--- .../Checkouts/Ui/ComponentsCheckoutTest.php | 4 ++-- .../Checkouts/Ui/ConsumableCheckoutTest.php | 4 ++-- tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php | 6 +++--- tests/Feature/Companies/Ui/EditCompanyTest.php | 2 +- tests/Feature/Companies/Ui/ShowCompanyTest.php | 2 +- tests/Feature/Components/Ui/EditComponentTest.php | 2 +- tests/Feature/Components/Ui/ShowComponentTest.php | 2 +- .../Feature/Consumables/Ui/EditConsumableTest.php | 2 +- .../Consumables/Ui/UpdateConsumableTest.php | 6 +++--- .../Feature/Departments/Ui/ShowDepartmentTest.php | 2 +- .../Departments/Ui/UpdateDepartmentsTest.php | 4 ++-- tests/Feature/Locations/Ui/ShowLocationTest.php | 2 +- tests/Feature/Locations/Ui/UpdateLocationsTest.php | 8 ++++---- .../Manufacturers/Ui/ShowManufacturerTest.php | 2 +- .../Manufacturers/Ui/UpdateManufacturerTest.php | 4 ++-- .../StatusLabels/Ui/ShowStatusLabelTest.php | 2 +- 30 files changed, 65 insertions(+), 65 deletions(-) diff --git a/app/Http/Controllers/Accessories/AccessoriesController.php b/app/Http/Controllers/Accessories/AccessoriesController.php index 6bf5ddd3d..4a82c0803 100755 --- a/app/Http/Controllers/Accessories/AccessoriesController.php +++ b/app/Http/Controllers/Accessories/AccessoriesController.php @@ -97,7 +97,7 @@ class AccessoriesController extends Controller */ public function edit(Accessory $accessory) : View | RedirectResponse { - return view('accessories.edit')->with('category_type', 'accessory'); + return view('accessories.edit')->with('item', $accessory)->with('category_type', 'accessory'); } /** diff --git a/app/Http/Controllers/CompaniesController.php b/app/Http/Controllers/CompaniesController.php index ccacbc58d..96a80e87e 100644 --- a/app/Http/Controllers/CompaniesController.php +++ b/app/Http/Controllers/CompaniesController.php @@ -83,7 +83,7 @@ final class CompaniesController extends Controller public function edit(Company $company) : View | RedirectResponse { $this->authorize('update', $company); - return view('companies/edit'); + return view('companies/edit')->with('item', $company); } /** diff --git a/app/Http/Controllers/Components/ComponentsController.php b/app/Http/Controllers/Components/ComponentsController.php index 78e9aa500..d5883c05f 100644 --- a/app/Http/Controllers/Components/ComponentsController.php +++ b/app/Http/Controllers/Components/ComponentsController.php @@ -111,7 +111,9 @@ class ComponentsController extends Controller { $this->authorize('update', $component); - return view('components/edit')->with('category_type', 'component'); + return view('components/edit') + ->with('item', $component) + ->with('category_type', 'component'); } diff --git a/tests/Feature/Accessories/Ui/ShowAccessoryTest.php b/tests/Feature/Accessories/Ui/ShowAccessoryTest.php index f9f2e566c..56d8fb42c 100644 --- a/tests/Feature/Accessories/Ui/ShowAccessoryTest.php +++ b/tests/Feature/Accessories/Ui/ShowAccessoryTest.php @@ -12,7 +12,7 @@ class ShowAccessoryTest extends TestCase public function testRequiresPermissionToViewAccessory() { $this->actingAs(User::factory()->create()) - ->get(route('accessories.show', Accessory::factory()->create()->id)) + ->get(route('accessories.show', Accessory::factory()->create())) ->assertForbidden(); } @@ -25,7 +25,7 @@ class ShowAccessoryTest extends TestCase $userForCompanyB = User::factory()->for($companyB)->viewAccessories()->create(); $this->actingAs($userForCompanyB) - ->get(route('accessories.show', $accessoryForCompanyA->id)) + ->get(route('accessories.show', $accessoryForCompanyA)) ->assertForbidden(); } @@ -34,7 +34,7 @@ class ShowAccessoryTest extends TestCase $accessory = Accessory::factory()->create(); $this->actingAs(User::factory()->viewAccessories()->create()) - ->get(route('accessories.show', $accessory->id)) + ->get(route('accessories.show', $accessory)) ->assertOk() ->assertViewIs('accessories.view') ->assertViewHas(['accessory' => $accessory]); @@ -43,7 +43,7 @@ class ShowAccessoryTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('accessories.show', Accessory::factory()->create()->id)) + ->get(route('accessories.show', Accessory::factory()->create())) ->assertOk(); } diff --git a/tests/Feature/Accessories/Ui/UpdateAccessoryTest.php b/tests/Feature/Accessories/Ui/UpdateAccessoryTest.php index 1c6fe8a49..8c482b4f1 100644 --- a/tests/Feature/Accessories/Ui/UpdateAccessoryTest.php +++ b/tests/Feature/Accessories/Ui/UpdateAccessoryTest.php @@ -16,7 +16,7 @@ class UpdateAccessoryTest extends TestCase public function testRequiresPermissionToSeeEditAccessoryPage() { $this->actingAs(User::factory()->create()) - ->get(route('accessories.edit', Accessory::factory()->create()->id)) + ->get(route('accessories.edit', Accessory::factory()->create())) ->assertForbidden(); } diff --git a/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.php b/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.php index 8b4104adc..739112f59 100644 --- a/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.php +++ b/tests/Feature/AssetModels/Ui/ShowAssetModelsTest.php @@ -11,7 +11,7 @@ class ShowAssetModelsTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('models.show', AssetModel::factory()->create()->id)) + ->get(route('models.show', AssetModel::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php index d0dbb2ffc..6fdd1bbcf 100644 --- a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php +++ b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php @@ -24,7 +24,7 @@ class UpdateAssetModelsTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('models.edit', AssetModel::factory()->create()->id)) + ->get(route('models.edit', AssetModel::factory()->create())) ->assertOk(); } @@ -55,15 +55,15 @@ class UpdateAssetModelsTest extends TestCase $this->assertTrue(AssetModel::where('name', 'Test Model')->exists()); $response = $this->actingAs(User::factory()->superuser()->create()) - ->from(route('models.edit', ['model' => $model->id])) - ->put(route('models.update', ['model' => $model]), [ + ->from(route('models.edit', $model)) + ->put(route('models.update', $model), [ 'name' => 'Test Model Edited', 'category_id' => Category::factory()->forAccessories()->create()->id, ]) ->assertSessionHasErrors(['category_type']) ->assertInvalid(['category_type']) ->assertStatus(302) - ->assertRedirect(route('models.edit', ['model' => $model->id])); + ->assertRedirect(route('models.edit', $model)); $this->followRedirects($response)->assertSee(trans('general.error')); $this->assertFalse(AssetModel::where('name', 'Test Model Edited')->exists()); diff --git a/tests/Feature/Assets/Ui/EditAssetTest.php b/tests/Feature/Assets/Ui/EditAssetTest.php index 27f00b531..328067e89 100644 --- a/tests/Feature/Assets/Ui/EditAssetTest.php +++ b/tests/Feature/Assets/Ui/EditAssetTest.php @@ -27,7 +27,7 @@ class EditAssetTest extends TestCase { $asset = Asset::factory()->create(); $user = User::factory()->editAssets()->create(); - $response = $this->actingAs($user)->get(route('hardware.edit', $asset->id)); + $response = $this->actingAs($user)->get(route('hardware.edit', $asset)); $response->assertStatus(200); } @@ -63,7 +63,7 @@ class EditAssetTest extends TestCase 'model_id' => AssetModel::factory()->create()->id, ]) ->assertStatus(302) - ->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); + ->assertRedirect(route('hardware.show', $asset)); $this->assertDatabaseHas('assets', ['asset_tag' => 'New Asset Tag']); } @@ -81,8 +81,8 @@ class EditAssetTest extends TestCase $currentTimestamp = now(); $this->actingAs(User::factory()->viewAssets()->editAssets()->create()) - ->from(route('hardware.edit', $asset->id)) - ->put(route('hardware.update', $asset->id), [ + ->from(route('hardware.edit', $asset)) + ->put(route('hardware.update', $asset), [ 'status_id' => $achived_status->id, 'model_id' => $asset->model_id, 'asset_tags' => $asset->asset_tag, diff --git a/tests/Feature/Categories/Ui/ShowCategoryTest.php b/tests/Feature/Categories/Ui/ShowCategoryTest.php index dd22b1d75..93a9cc0af 100644 --- a/tests/Feature/Categories/Ui/ShowCategoryTest.php +++ b/tests/Feature/Categories/Ui/ShowCategoryTest.php @@ -11,7 +11,7 @@ class ShowCategoryTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('categories.show', Category::factory()->create()->id)) + ->get(route('categories.show', Category::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Categories/Ui/UpdateCategoriesTest.php b/tests/Feature/Categories/Ui/UpdateCategoriesTest.php index 7e6109779..ea5cc6338 100644 --- a/tests/Feature/Categories/Ui/UpdateCategoriesTest.php +++ b/tests/Feature/Categories/Ui/UpdateCategoriesTest.php @@ -23,7 +23,7 @@ class UpdateCategoriesTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('categories.edit', Category::factory()->create()->id)) + ->get(route('categories.edit', Category::factory()->create())) ->assertOk(); } @@ -47,7 +47,7 @@ class UpdateCategoriesTest extends TestCase $this->assertTrue(Category::where('name', 'Test Category')->exists()); $response = $this->actingAs(User::factory()->superuser()->create()) - ->put(route('categories.update', ['category' => $category]), [ + ->put(route('categories.update', $category), [ 'name' => 'Test Category Edited', 'notes' => 'Test Note Edited', ]) @@ -66,8 +66,8 @@ class UpdateCategoriesTest extends TestCase $this->assertTrue(Category::where('name', 'Test Category')->exists()); $response = $this->actingAs(User::factory()->superuser()->create()) - ->from(route('categories.edit', ['category' => $category->id])) - ->put(route('categories.update', ['category' => $category]), [ + ->from(route('categories.edit', $category->id)) + ->put(route('categories.update', $category), [ 'name' => 'Test Category Edited', 'category_type' => 'accessory', 'notes' => 'Test Note Edited', @@ -87,8 +87,8 @@ class UpdateCategoriesTest extends TestCase $category = Category::where('name', 'Laptops')->first(); $response = $this->actingAs(User::factory()->superuser()->create()) - ->from(route('categories.edit', ['category' => $category->id])) - ->put(route('categories.update', ['category' => $category]), [ + ->from(route('categories.edit', $category)) + ->put(route('categories.update', $category), [ 'name' => 'Test Category Edited', 'category_type' => 'accessory', 'notes' => 'Test Note Edited', @@ -96,7 +96,7 @@ class UpdateCategoriesTest extends TestCase ->assertSessionHasErrors(['category_type']) ->assertInvalid(['category_type']) ->assertStatus(302) - ->assertRedirect(route('categories.edit', ['category' => $category->id])); + ->assertRedirect(route('categories.edit', $category)); $this->followRedirects($response)->assertSee(trans('general.error')); $this->assertFalse(Category::where('name', 'Test Category Edited')->where('notes', 'Test Note Edited')->exists()); diff --git a/tests/Feature/Checkins/Ui/AssetCheckinTest.php b/tests/Feature/Checkins/Ui/AssetCheckinTest.php index 7428b7ab7..58194dbfc 100644 --- a/tests/Feature/Checkins/Ui/AssetCheckinTest.php +++ b/tests/Feature/Checkins/Ui/AssetCheckinTest.php @@ -188,7 +188,7 @@ class AssetCheckinTest extends TestCase ->get(route('hardware.checkin.create', ['assetId' => $asset->id])) ->assertStatus(302) ->assertSessionHas('error') - ->assertRedirect(route('hardware.show',['hardware' => $asset->id])); + ->assertRedirect(route('hardware.show', $asset->id)); } public function testAssetCheckinPagePostIsRedirectedIfModelIsInvalid() @@ -201,7 +201,7 @@ class AssetCheckinTest extends TestCase ->post(route('hardware.checkin.store', ['assetId' => $asset->id])) ->assertStatus(302) ->assertSessionHas('error') - ->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); + ->assertRedirect(route('hardware.show', $asset)); } public function testAssetCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex() @@ -228,6 +228,6 @@ class AssetCheckinTest extends TestCase ]) ->assertStatus(302) ->assertSessionHasNoErrors() - ->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); + ->assertRedirect(route('hardware.show', $asset)); } } diff --git a/tests/Feature/Checkins/Ui/ComponentCheckinTest.php b/tests/Feature/Checkins/Ui/ComponentCheckinTest.php index 6c2ef084f..7da3879ea 100644 --- a/tests/Feature/Checkins/Ui/ComponentCheckinTest.php +++ b/tests/Feature/Checkins/Ui/ComponentCheckinTest.php @@ -16,9 +16,7 @@ class ComponentCheckinTest extends TestCase $componentAsset = DB::table('components_assets')->where('component_id', $component->id)->first(); $this->actingAs(User::factory()->create()) - ->post(route('components.checkin.store', [ - 'componentID' => $componentAsset->id, - ])) + ->post(route('components.checkin.store', $componentAsset->id)) ->assertForbidden(); } @@ -67,6 +65,6 @@ class ComponentCheckinTest extends TestCase ]) ->assertStatus(302) ->assertSessionHasNoErrors() - ->assertRedirect(route('components.show', ['component' => $component->id])); + ->assertRedirect(route('components.show', $component)); } } diff --git a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php index ff121bc4d..19b0d1ce7 100644 --- a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php @@ -25,7 +25,7 @@ class AccessoryCheckoutTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('accessories.checkout.show', Accessory::factory()->create()->id)) + ->get(route('accessories.checkout.show', Accessory::factory()->create())) ->assertOk(); } @@ -241,7 +241,7 @@ class AccessoryCheckoutTest extends TestCase ]) ->assertStatus(302) ->assertSessionHasNoErrors() - ->assertRedirect(route('accessories.show', ['accessory' => $accessory->id])); + ->assertRedirect(route('accessories.show', $accessory)); } public function testAccessoryCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget() @@ -258,6 +258,6 @@ class AccessoryCheckoutTest extends TestCase 'assigned_qty' => 1, ]) ->assertStatus(302) - ->assertRedirect(route('users.show', ['user' => $user])); + ->assertRedirect(route('users.show', $user)); } } diff --git a/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php b/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php index 74658a6fa..c92baa2fe 100644 --- a/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/AssetCheckoutTest.php @@ -263,7 +263,7 @@ class AssetCheckoutTest extends TestCase ->get(route('hardware.checkout.create', ['assetId' => $asset->id])) ->assertStatus(302) ->assertSessionHas('error') - ->assertRedirect(route('hardware.show',['hardware' => $asset->id])); + ->assertRedirect(route('hardware.show', $asset)); } public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex() @@ -294,7 +294,7 @@ class AssetCheckoutTest extends TestCase ]) ->assertStatus(302) ->assertSessionHasNoErrors() - ->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); + ->assertRedirect(route('hardware.show', $asset)); } public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget() @@ -328,7 +328,7 @@ class AssetCheckoutTest extends TestCase 'assigned_qty' => 1, ]) ->assertStatus(302) - ->assertRedirect(route('hardware.show', ['hardware' => $target])); + ->assertRedirect(route('hardware.show', $target)); } public function testAssetCheckoutPagePostIsRedirectedIfRedirectSelectionIsLocationTarget() diff --git a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php index 507b26243..18568d198 100644 --- a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php @@ -76,7 +76,7 @@ class ComponentsCheckoutTest extends TestCase 'assigned_qty' => 1, ]) ->assertStatus(302) - ->assertRedirect(route('components.show', ['component' => $component->id])); + ->assertRedirect(route('components.show', $component)); } public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget() @@ -92,6 +92,6 @@ class ComponentsCheckoutTest extends TestCase 'assigned_qty' => 1, ]) ->assertStatus(302) - ->assertRedirect(route('hardware.show', ['hardware' => $asset])); + ->assertRedirect(route('hardware.show', $asset)); } } diff --git a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php index dd77e19c5..2c74e4d0c 100644 --- a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php @@ -130,7 +130,7 @@ class ConsumableCheckoutTest extends TestCase 'assigned_qty' => 1, ]) ->assertStatus(302) - ->assertRedirect(route('consumables.show', ['consumable' => $consumable->id])); + ->assertRedirect(route('consumables.show', $consumable)); } public function testConsumableCheckoutPagePostIsRedirectedIfRedirectSelectionIsTarget() @@ -146,7 +146,7 @@ class ConsumableCheckoutTest extends TestCase 'assigned_qty' => 1, ]) ->assertStatus(302) - ->assertRedirect(route('users.show', ['user' => $user])); + ->assertRedirect(route('users.show', $user)); } } diff --git a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php index 22bdb6b5d..f322bee1b 100644 --- a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php @@ -90,7 +90,7 @@ class LicenseCheckoutTest extends TestCase 'redirect_option' => 'item', ]) ->assertStatus(302) - ->assertRedirect(route('licenses.show', ['license' => $license->id])); + ->assertRedirect(route('licenses.show', $license)); } public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsUserTarget() @@ -105,7 +105,7 @@ class LicenseCheckoutTest extends TestCase 'redirect_option' => 'target', ]) ->assertStatus(302) - ->assertRedirect(route('users.show', ['user' => $user->id])); + ->assertRedirect(route('users.show', $user)); } public function testLicenseCheckoutPagePostIsRedirectedIfRedirectSelectionIsAssetTarget() { @@ -119,6 +119,6 @@ class LicenseCheckoutTest extends TestCase 'redirect_option' => 'target', ]) ->assertStatus(302) - ->assertRedirect(route('hardware.show', ['hardware' => $asset->id])); + ->assertRedirect(route('hardware.show', $asset)); } } diff --git a/tests/Feature/Companies/Ui/EditCompanyTest.php b/tests/Feature/Companies/Ui/EditCompanyTest.php index 7dcbc7908..febc71704 100644 --- a/tests/Feature/Companies/Ui/EditCompanyTest.php +++ b/tests/Feature/Companies/Ui/EditCompanyTest.php @@ -11,7 +11,7 @@ class EditCompanyTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('companies.edit', Company::factory()->create()->id)) + ->get(route('companies.edit', Company::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Companies/Ui/ShowCompanyTest.php b/tests/Feature/Companies/Ui/ShowCompanyTest.php index 1c41f6ab2..de7429d40 100644 --- a/tests/Feature/Companies/Ui/ShowCompanyTest.php +++ b/tests/Feature/Companies/Ui/ShowCompanyTest.php @@ -11,7 +11,7 @@ class ShowCompanyTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('companies.show', Company::factory()->create()->id)) + ->get(route('companies.show', Company::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Components/Ui/EditComponentTest.php b/tests/Feature/Components/Ui/EditComponentTest.php index 257034390..4e4b99233 100644 --- a/tests/Feature/Components/Ui/EditComponentTest.php +++ b/tests/Feature/Components/Ui/EditComponentTest.php @@ -11,7 +11,7 @@ class EditComponentTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('components.edit', Component::factory()->create()->id)) + ->get(route('components.edit', Component::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Components/Ui/ShowComponentTest.php b/tests/Feature/Components/Ui/ShowComponentTest.php index 50a17ee05..6ee2ca286 100644 --- a/tests/Feature/Components/Ui/ShowComponentTest.php +++ b/tests/Feature/Components/Ui/ShowComponentTest.php @@ -11,7 +11,7 @@ class ShowComponentTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('components.show', Component::factory()->create()->id)) + ->get(route('components.show', Component::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Consumables/Ui/EditConsumableTest.php b/tests/Feature/Consumables/Ui/EditConsumableTest.php index 6b75db127..308b7647b 100644 --- a/tests/Feature/Consumables/Ui/EditConsumableTest.php +++ b/tests/Feature/Consumables/Ui/EditConsumableTest.php @@ -11,7 +11,7 @@ class EditConsumableTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('consumables.show', Consumable::factory()->create()->id)) + ->get(route('consumables.show', Consumable::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Consumables/Ui/UpdateConsumableTest.php b/tests/Feature/Consumables/Ui/UpdateConsumableTest.php index 66fc9a11f..e885daa59 100644 --- a/tests/Feature/Consumables/Ui/UpdateConsumableTest.php +++ b/tests/Feature/Consumables/Ui/UpdateConsumableTest.php @@ -29,7 +29,7 @@ class UpdateConsumableTest extends TestCase $userForCompanyB = User::factory()->editConsumables()->for($companyB)->create(); $this->actingAs($userForCompanyB) - ->get(route('consumables.edit', $consumableForCompanyA->id)) + ->get(route('consumables.edit', $consumableForCompanyA)) ->assertRedirect(route('consumables.index')); } @@ -51,7 +51,7 @@ class UpdateConsumableTest extends TestCase $userForCompanyB = User::factory()->editConsumables()->for($companyB)->create(); $this->actingAs($userForCompanyB) - ->put(route('consumables.update', $consumableForCompanyA->id), [ + ->put(route('consumables.update', $consumableForCompanyA), [ // ]) ->assertForbidden(); @@ -99,7 +99,7 @@ class UpdateConsumableTest extends TestCase ]; $this->actingAs(User::factory()->createConsumables()->editConsumables()->create()) - ->put(route('consumables.update', $consumable->id), $data + [ + ->put(route('consumables.update', $consumable), $data + [ 'redirect_option' => 'index', 'category_type' => 'consumable', ]) diff --git a/tests/Feature/Departments/Ui/ShowDepartmentTest.php b/tests/Feature/Departments/Ui/ShowDepartmentTest.php index d8a007bde..f1373ccc2 100644 --- a/tests/Feature/Departments/Ui/ShowDepartmentTest.php +++ b/tests/Feature/Departments/Ui/ShowDepartmentTest.php @@ -11,7 +11,7 @@ class ShowDepartmentTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('departments.show', Department::factory()->create()->id)) + ->get(route('departments.show', Department::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php b/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php index bb5fc27e1..83e52bf7c 100644 --- a/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php +++ b/tests/Feature/Departments/Ui/UpdateDepartmentsTest.php @@ -22,7 +22,7 @@ class UpdateDepartmentsTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('departments.edit', Department::factory()->create()->id)) + ->get(route('departments.edit', Department::factory()->create())) ->assertOk(); } @@ -32,7 +32,7 @@ class UpdateDepartmentsTest extends TestCase $this->assertTrue(Department::where('name', 'Test Department')->exists()); $response = $this->actingAs(User::factory()->superuser()->create()) - ->put(route('departments.update', ['department' => $department]), [ + ->put(route('departments.update', $department), [ 'name' => 'Test Department Edited', 'notes' => 'Test Note Edited', ]) diff --git a/tests/Feature/Locations/Ui/ShowLocationTest.php b/tests/Feature/Locations/Ui/ShowLocationTest.php index 6afb7dfe5..394ed73f4 100644 --- a/tests/Feature/Locations/Ui/ShowLocationTest.php +++ b/tests/Feature/Locations/Ui/ShowLocationTest.php @@ -11,7 +11,7 @@ class ShowLocationTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('locations.show', Location::factory()->create()->id)) + ->get(route('locations.show', Location::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Locations/Ui/UpdateLocationsTest.php b/tests/Feature/Locations/Ui/UpdateLocationsTest.php index c38ee25f8..3135e9bcf 100644 --- a/tests/Feature/Locations/Ui/UpdateLocationsTest.php +++ b/tests/Feature/Locations/Ui/UpdateLocationsTest.php @@ -21,7 +21,7 @@ class UpdateLocationsTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('locations.update', Location::factory()->create()->id)) + ->get(route('locations.update', Location::factory()->create())) ->assertOk(); } @@ -48,8 +48,8 @@ class UpdateLocationsTest extends TestCase $location = Location::factory()->create(); $response = $this->actingAs(User::factory()->superuser()->create()) - ->from(route('locations.edit', ['location' => $location->id])) - ->put(route('locations.update', ['location' => $location]), [ + ->from(route('locations.edit', $location)) + ->put(route('locations.update', $location), [ 'name' => 'Test Location', 'parent_id' => $location->id, ]) @@ -63,7 +63,7 @@ class UpdateLocationsTest extends TestCase { $location = Location::factory()->create(); $response = $this->actingAs(User::factory()->superuser()->create()) - ->from(route('locations.edit', ['location' => $location->id])) + ->from(route('locations.edit', $location)) ->put(route('locations.update', ['location' => $location]), [ 'name' => 'Test Location', 'parent_id' => '100000000' diff --git a/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.php b/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.php index 890feb123..9a40819a1 100644 --- a/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.php +++ b/tests/Feature/Manufacturers/Ui/ShowManufacturerTest.php @@ -11,7 +11,7 @@ class ShowManufacturerTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('manufacturers.show', Manufacturer::factory()->create()->id)) + ->get(route('manufacturers.show', Manufacturer::factory()->create())) ->assertOk(); } } diff --git a/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.php b/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.php index 398b7fe23..9d5861300 100644 --- a/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.php +++ b/tests/Feature/Manufacturers/Ui/UpdateManufacturerTest.php @@ -11,7 +11,7 @@ class UpdateManufacturerTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('manufacturers.edit', Manufacturer::factory()->create()->id)) + ->get(route('manufacturers.edit', Manufacturer::factory()->create())) ->assertOk(); } @@ -21,7 +21,7 @@ class UpdateManufacturerTest extends TestCase $this->assertTrue(Manufacturer::where('name', 'Test Manufacturer')->exists()); $response = $this->actingAs(User::factory()->superuser()->create()) - ->put(route('manufacturers.update', ['manufacturer' => $manufacturer]), [ + ->put(route('manufacturers.update', $manufacturer), [ 'name' => 'Test Manufacturer Edited', 'notes' => 'Test Note Edited', ]) diff --git a/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.php b/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.php index 0b7389603..96e8d7552 100644 --- a/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.php +++ b/tests/Feature/StatusLabels/Ui/ShowStatusLabelTest.php @@ -11,7 +11,7 @@ class ShowStatusLabelTest extends TestCase public function testPageRenders() { $this->actingAs(User::factory()->superuser()->create()) - ->get(route('statuslabels.show', Statuslabel::factory()->create()->id)) + ->get(route('statuslabels.show', Statuslabel::factory()->create())) ->assertOk(); } }