mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Partial fix for license+category tests
This commit is contained in:
parent
05e3e6bda6
commit
aab190423f
|
@ -49,7 +49,7 @@ class License extends Depreciable
|
|||
'license_email' => 'email|nullable|max:120',
|
||||
'license_name' => 'string|nullable|max:100',
|
||||
'notes' => 'string|nullable',
|
||||
'category_id' => 'integer',
|
||||
'category_id' => 'required|exists:categories,id',
|
||||
'company_id' => 'integer|nullable',
|
||||
);
|
||||
|
||||
|
|
|
@ -114,3 +114,18 @@ $factory->state(App\Models\Category::class, 'consumable-ink-category', function
|
|||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->state(App\Models\Category::class, 'license-graphics-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Graphics Software',
|
||||
'category_type' => 'license',
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->state(App\Models\Category::class, 'license-office-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Office Software',
|
||||
'category_type' => 'license',
|
||||
];
|
||||
});
|
||||
|
|
|
@ -34,7 +34,8 @@ $factory->state(App\Models\License::class, 'photoshop', function ($faker) {
|
|||
'purchase_cost' => '299.99',
|
||||
'seats' => 10,
|
||||
'purchase_order' => '13503Q',
|
||||
'maintained' => true
|
||||
'maintained' => true,
|
||||
'category_id' => 14,
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
@ -49,6 +50,7 @@ $factory->state(App\Models\License::class, 'acrobat', function ($faker) {
|
|||
'manufacturer_id' => 9,
|
||||
'purchase_cost' => '29.99',
|
||||
'seats' => 10,
|
||||
'category_id' => 14,
|
||||
];
|
||||
|
||||
|
||||
|
@ -62,6 +64,7 @@ $factory->state(App\Models\License::class, 'indesign', function ($faker) {
|
|||
'manufacturer_id' => 9,
|
||||
'purchase_cost' => '199.99',
|
||||
'seats' => 10,
|
||||
'category_id' => 14,
|
||||
];
|
||||
|
||||
|
||||
|
@ -76,6 +79,7 @@ $factory->state(App\Models\License::class, 'office', function ($faker) {
|
|||
'manufacturer_id' => 2,
|
||||
'purchase_cost' => '49.99',
|
||||
'seats' => 20,
|
||||
'category_id' => 15,
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ class CategorySeeder extends Seeder
|
|||
factory(Category::class, 1)->states('consumable-ink-category')->create(); // 11
|
||||
factory(Category::class, 1)->states('component-hdd-category')->create(); // 12
|
||||
factory(Category::class, 1)->states('component-ram-category')->create(); // 13
|
||||
factory(Category::class, 1)->states('license-graphics-category')->create(); // 14
|
||||
factory(Category::class, 1)->states('license-office-category')->create(); // 15
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ class LicensesCest
|
|||
$I->seeElement('.alert-danger');
|
||||
$I->see('The name field is required.', '.alert-msg');
|
||||
$I->see('The seats field is required.', '.alert-msg');
|
||||
$I->see('The category id field is required.', '.alert-msg');
|
||||
}
|
||||
|
||||
public function failsShortValidation(FunctionalTester $I)
|
||||
|
@ -58,6 +59,7 @@ class LicensesCest
|
|||
'license_name' => $license->license_name,
|
||||
'maintained' => true,
|
||||
'manufacturer_id' => $license->manufacturer_id,
|
||||
'category_id' => $license->category_id,
|
||||
'name' => $license->name,
|
||||
'notes' => $license->notes,
|
||||
'order_number' => $license->order_number,
|
||||
|
|
|
@ -488,8 +488,8 @@ EOT;
|
|||
{
|
||||
$this->signIn();
|
||||
$csv = <<<'EOT'
|
||||
Name,Email,Username,Item name,serial,manufacturer,purchase date,purchase cost,purchase order,order number,Licensed To Name,Licensed to Email,expiration date,maintained,reassignable,seats,company,supplier,notes
|
||||
Helen Anderson,cspencer0@privacy.gov.au,cspencer0,Argentum Malachite Athletes Foot Relief,1aa5b0eb-79c5-40b2-8943-5472a6893c3c,"Beer, Leannon and Lubowitz",07/13/2012,$79.66,53008,386436062-5,Cynthia Spencer,cspencer0@gov.uk,01/27/2016,false,no,80,"Haag, Schmidt and Farrell","Hegmann, Mohr and Cremin",Sed ante. Vivamus tortor. Duis mattis egestas metus.
|
||||
Name,Email,Username,Item name,serial,manufacturer,purchase date,purchase cost,purchase order,order number,Licensed To Name,Licensed to Email,expiration date,maintained,reassignable,seats,company,supplier,category,notes
|
||||
Helen Anderson,cspencer0@privacy.gov.au,cspencer0,Argentum Malachite Athletes Foot Relief,1aa5b0eb-79c5-40b2-8943-5472a6893c3c,"Beer, Leannon and Lubowitz",07/13/2012,$79.66,53008,386436062-5,Cynthia Spencer,cspencer0@gov.uk,01/27/2016,false,no,80,"Haag, Schmidt and Farrell","Hegmann, Mohr and Cremin",Graphics Software,Sed ante. Vivamus tortor. Duis mattis egestas metus.
|
||||
EOT;
|
||||
$this->import(new LicenseImporter($csv));
|
||||
// dd($this->tester->grabRecord('licenses'));
|
||||
|
@ -522,6 +522,10 @@ EOT;
|
|||
'name' => 'Haag, Schmidt and Farrell'
|
||||
]);
|
||||
|
||||
$this->tester->seeRecord('categories', [
|
||||
'name' => 'Graphics Software'
|
||||
]);
|
||||
|
||||
$this->tester->seeNumRecords(80, 'license_seats');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue