mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Remove creation of category within category factory state
This commit is contained in:
parent
6e6a021928
commit
099ec3f550
|
@ -43,7 +43,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->assetLaptopCategory();
|
||||
public function assetLaptopCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Laptops',
|
||||
'category_type' => 'asset',
|
||||
'require_acceptance' => true,
|
||||
|
@ -53,7 +53,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->assetDesktopCategory();
|
||||
public function assetDesktopCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Desktops',
|
||||
'category_type' => 'asset',
|
||||
'require_acceptance' => true,
|
||||
|
@ -63,7 +63,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->assetDisplayCategory();
|
||||
public function assetDisplayCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Displays',
|
||||
'category_type' => 'asset',
|
||||
]);
|
||||
|
@ -72,7 +72,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->assetTabletCategory();
|
||||
public function assetTabletCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Tablets',
|
||||
'category_type' => 'asset',
|
||||
]);
|
||||
|
@ -81,7 +81,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->assetMobileCategory();
|
||||
public function assetMobileCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Mobile Phones',
|
||||
'category_type' => 'asset',
|
||||
]);
|
||||
|
@ -90,7 +90,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->assetConferenceCategory();
|
||||
public function assetConferenceCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Conference Phones',
|
||||
'category_type' => 'asset',
|
||||
]);
|
||||
|
@ -100,7 +100,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->assetVoipCategory();
|
||||
public function assetVoipCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'VOIP Phones',
|
||||
'category_type' => 'asset',
|
||||
]);
|
||||
|
@ -109,7 +109,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->accessoryKeyboardCategory();
|
||||
public function accessoryKeyboardCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Keyboardss',
|
||||
'category_type' => 'accessory',
|
||||
]);
|
||||
|
@ -119,7 +119,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->accessoryMouseCategory();
|
||||
public function accessoryMouseCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Mouse',
|
||||
'category_type' => 'accessory',
|
||||
]);
|
||||
|
@ -128,7 +128,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->componentHddCategory();
|
||||
public function componentHddCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'HDD/SSD',
|
||||
'category_type' => 'component',
|
||||
]);
|
||||
|
@ -137,7 +137,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->componentRamCategory();
|
||||
public function componentRamCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'RAM',
|
||||
'category_type' => 'component',
|
||||
]);
|
||||
|
@ -146,7 +146,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->consumablePaperCategory();
|
||||
public function consumablePaperCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Printer Paper',
|
||||
'category_type' => 'consumable',
|
||||
]);
|
||||
|
@ -155,7 +155,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->consumableInkCategory();
|
||||
public function consumableInkCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Printer Ink',
|
||||
'category_type' => 'consumable',
|
||||
]);
|
||||
|
@ -164,7 +164,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->licenseGraphicsCategory();
|
||||
public function licenseGraphicsCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Graphics Software',
|
||||
'category_type' => 'license',
|
||||
]);
|
||||
|
@ -173,7 +173,7 @@ class CategoryFactory extends Factory
|
|||
// usage: Category::factory()->licenseGraphicsCategory();
|
||||
public function licenseOfficeCategory()
|
||||
{
|
||||
return Category::factory()->create([
|
||||
return $this->state([
|
||||
'name' => 'Office Software',
|
||||
'category_type' => 'license',
|
||||
]);
|
||||
|
|
|
@ -36,7 +36,7 @@ class AssetTest extends TestCase
|
|||
'model_id' => AssetModel::factory()
|
||||
->create(
|
||||
[
|
||||
'category_id' => Category::factory()->assetLaptopCategory()->id
|
||||
'category_id' => Category::factory()->assetLaptopCategory()->create()->id
|
||||
]
|
||||
)->id,
|
||||
'warranty_months' => 24,
|
||||
|
|
|
@ -26,7 +26,7 @@ class CategoryTest extends TestCase
|
|||
|
||||
public function testACategoryCanHaveAssets()
|
||||
{
|
||||
$category = Category::factory()->assetDesktopCategory();
|
||||
$category = Category::factory()->assetDesktopCategory()->create();
|
||||
|
||||
// Generate 5 models via factory
|
||||
$models = AssetModel::factory()
|
||||
|
|
|
@ -18,7 +18,7 @@ class DepreciationTest extends TestCase
|
|||
->count(5)
|
||||
->create(
|
||||
[
|
||||
'category_id' => Category::factory()->assetLaptopCategory(),
|
||||
'category_id' => Category::factory()->assetLaptopCategory()->create(),
|
||||
'depreciation_id' => $depreciation->id
|
||||
]);
|
||||
|
||||
|
@ -35,7 +35,7 @@ class DepreciationTest extends TestCase
|
|||
->photoshop()
|
||||
->create(
|
||||
[
|
||||
'category_id' => Category::factory()->licenseGraphicsCategory(),
|
||||
'category_id' => Category::factory()->licenseGraphicsCategory()->create(),
|
||||
'depreciation_id' => $depreciation->id
|
||||
]);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class NotificationTest extends TestCase
|
|||
'model_id' => AssetModel::factory()
|
||||
->create(
|
||||
[
|
||||
'category_id' => Category::factory()->assetLaptopCategory()->id
|
||||
'category_id' => Category::factory()->assetLaptopCategory()->create()->id
|
||||
]
|
||||
)->id,
|
||||
'warranty_months' => 24,
|
||||
|
|
Loading…
Reference in a new issue