Skip to content

A free open source IT asset/license management system

Remove helper methods by inlining where needed

Marcus Moore8fad377114ff
diff --git a/tests/Unit/AccessoryTest.php b/tests/Unit/AccessoryTest.php
index 57b91b8f06..a9ed782aea 100644
--- a/tests/Unit/AccessoryTest.php
+++ b/tests/Unit/AccessoryTest.php
@@ -57,8 +57,6 @@ class AccessoryTest extends BaseTest
public function testAnAccessoryHasAManufacturer()
{
- $this->createValidManufacturer('apple');
- $this->createValidCategory('accessory-keyboard-category');
$accessory = Accessory::factory()->appleBtKeyboard()->create(
[
'category_id' => Category::factory()->create(),
diff --git a/tests/Unit/BaseTest.php b/tests/Unit/BaseTest.php
index 2fe6fa76ef..977e8b02eb 100644
--- a/tests/Unit/BaseTest.php
+++ b/tests/Unit/BaseTest.php
@@ -14,89 +14,4 @@ use Artisan;
abstract class BaseTest extends TestCase
{
use LazilyRefreshDatabase;
-
- protected function signIn($user = null)
- {
- if (! $user) {
- $user = User::factory()->superuser()->create([
- 'location_id' => $this->createValidLocation()->id,
- ]);
- }
- Auth::login($user);
- return $user;
- }
-
- protected function createValidAssetModel()
- {
- return \App\Models\AssetModel::factory()->create([
- 'category_id' => $this->createValidCategory(),
- 'manufacturer_id' => $this->createValidManufacturer(),
- 'depreciation_id' => $this->createValidDepreciation(),
- ]);
- }
-
- protected function createValidCategory()
- {
- return \App\Models\Category::factory()->make();
- }
-
- protected function createValidCompany()
- {
- return \App\Models\Company::factory()->create();
- }
-
- protected function createValidDepartment($state = 'engineering', $overrides = [])
- {
- return \App\Models\Department::factory()->create(array_merge([
- 'location_id' => $this->createValidLocation()->id,
- ], $overrides));
- }
-
- protected function createValidDepreciation()
- {
- return \App\Models\Depreciation::factory()->create();
- }
-
- protected function createValidLocation($overrides = [])
- {
- return \App\Models\Location::factory()->create($overrides);
- }
-
- protected function createValidManufacturer()
- {
- return \App\Models\Manufacturer::factory()->create();
- }
-
- protected function createValidSupplier($overrides = [])
- {
- return \App\Models\Supplier::factory()->create($overrides);
- }
-
- protected function createValidStatuslabel($state = 'rtd', $overrides = [])
- {
- return \App\Models\Statuslabel::factory()->state()->create($overrides);
- }
-
- protected function createValidUser($overrides = [])
- {
- return \App\Models\User::factory()->create(
- array_merge([
- 'location_id'=>$this->createValidLocation()->id,
- ], $overrides)
- );
- }
-
- protected function createValidAsset($overrides = [])
- {
- $locId = $this->createValidLocation()->id;
- $this->createValidAssetModel();
-
- return \App\Models\Asset::factory()->laptopMbp()->create(
- array_merge([
- 'rtd_location_id' => $locId,
- 'location_id' => $locId,
- 'supplier_id' => $this->createValidSupplier()->id,
- ], $overrides)
- );
- }
}
diff --git a/tests/Unit/DepreciationTest.php b/tests/Unit/DepreciationTest.php
index abe11d7f85..d8885dcf96 100644
--- a/tests/Unit/DepreciationTest.php
+++ b/tests/Unit/DepreciationTest.php
@@ -18,7 +18,6 @@ class DepreciationTest extends BaseTest
public function testADepreciationHasModels()
{
- $this->createValidAssetModel();
$depreciation = Depreciation::factory()->create();
AssetModel::factory()
diff --git a/tests/Unit/LocationTest.php b/tests/Unit/LocationTest.php
index eda9c6a896..962d441b2b 100644
--- a/tests/Unit/LocationTest.php
+++ b/tests/Unit/LocationTest.php
@@ -14,12 +14,10 @@ class LocationTest extends BaseTest
public function testPassesIfNotSelfParent()
{
- $this->createValidLocation(['id' => 10]);
-
$a = Location::factory()->make([
'name' => 'Test Location',
'id' => 1,
- 'parent_id' => 10,
+ 'parent_id' => Location::factory()->create(['id' => 10])->id,
]);
$this->assertTrue($a->isValid());