Fixed tests, updated CSV

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-11-13 16:21:40 +00:00
parent 220902a8b4
commit 4afe873f24
3 changed files with 35 additions and 27 deletions

View file

@ -108,8 +108,9 @@ class AssetModelImporter extends ItemImporter
return $assetmodel; return $assetmodel;
} else { } else {
Log::debug($assetmodel->getErrors()); $this->log($assetmodel->getErrors()->first());
return $assetmodel->errors; $this->addErrorToBag($assetmodel, '', $assetmodel->getErrors()->first());
return $assetmodel->getErrors();
} }
} }

View file

@ -1,23 +1,27 @@
Name,Category,Manufacturer,Notes,Model Number,Fieldset,Requestable Name,Category,Manufacturer,Notes,Model Number,Fieldset,Requestable,EOL,Min Qty
Changed Test Model,Laptops,Berge Inc,"Sphinx of black quartz, judge my vow",1786VM80X07,Laptops and Desktops,Y Changed Test Model,Laptops,Blargh,"Sphinx of black quartz, judge my vow",1786VM80X07,Laptops and Desktops,Y,36,100
Test Model 2,Laptops,"Botsford, Boyle and Herzog",ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae mauris viverra diam vitae quam suspendisse potenti nullam,9351IS25A51,Laptops and Desktops,Y Test Model 2,Laptops,"Botsford, Boyle and Herzog",ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae mauris viverra diam vitae quam suspendisse potenti nullam,9351IS25A51,Laptops and Desktops,Y,36,50
Test Model 3,Laptops,Pollich LLC,,9929FR08W85,Laptops and Desktops,Y Test Model 3,Laptops,Pollich LLC,,9929FR08W85,Laptops and Desktops,Y,36,30
Test Model 4,Laptops,Walker-Towne,neque vestibulum eget vulputate ut ultrices vel augue vestibulum ante ipsum primis in faucibus orci luctus,9139KQ78G81,Laptops and Desktops,Y ,Laptops,Walker-Towne,neque vestibulum eget vulputate ut ultrices vel augue vestibulum ante ipsum primis in faucibus orci luctus,9139KQ78G81,Laptops and Desktops,Y,36,
Test Model 5,Laptops,Berge Inc,turpis adipiscing lorem vitae mattis nibh ligula nec sem duis aliquam convallis nunc proin at turpis a pede,0910VB28Q61,Laptops and Desktops,Y Test Model 5,Laptops,Berge Inc,turpis adipiscing lorem vitae mattis nibh ligula nec sem duis aliquam convallis nunc proin at turpis a pede,0910VB28Q61,Laptops and Desktops,Y,36,0
Test Model 6,Laptops,"Heaney, Altenwerth and Emmerich",,7375EM02N97,Laptops and Desktops,Y Test Model 6,Laptops,"Heaney, Altenwerth and Emmerich",,7375EM02N97,Laptops and Desktops,Y,36,100
Test Model 7,Desktops,"Romaguera, Goldner and Crooks",Test Updated Text,,Laptops and Desktops,Y Test Model 7,Desktops,"Romaguera, Goldner and Crooks",Test Updated Text,,Laptops and Desktops,Y,36,100
Test Model 8,Laptops,Watsica LLC,sapien urna pretium nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in,,Laptops and Desktops,Y Test Model 8,Laptops,Watsica LLC,sapien urna pretium nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in,,Laptops and Desktops,Y,36,100
Test Model 9,Laptops,"Fritsch, Sauer and Conn",orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio curabitur,,Laptops and Desktops,Y Test Model 9,Laptops,"Fritsch, Sauer and Conn",orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio curabitur,,Laptops and Desktops,Y,36,100
Test Model 10,Laptops,"Upton, Feil and Jast",velit vivamus vel nulla eget eros elementum pellentesque quisque porta volutpat,,Laptops and Desktops,Y Test Model 10,Laptops,"Upton, Feil and Jast",velit vivamus vel nulla eget eros elementum pellentesque quisque porta volutpat,,Laptops and Desktops,Y,36,100
Test Model 11,Laptops,Berge Inc,sed nisl nunc rhoncus dui vel sem sed sagittis nam congue risus semper porta volutpat quam pede lobortis ligula sit,,Laptops and Desktops,Y Test Model 11,Laptops,Berge Inc,sed nisl nunc rhoncus dui vel sem sed sagittis nam congue risus semper porta volutpat quam pede lobortis ligula sit,,Laptops and Desktops,Y,36,100
Test Model 12,Laptops,"Kutch, Johnson and Olson",curae mauris viverra diam vitae quam suspendisse potenti nullam porttitor lacus at turpis donec posuere metus vitae ipsum aliquam non,,Laptops and Desktops,Y Test Model 12,Laptops,"Kutch, Johnson and Olson",curae mauris viverra diam vitae quam suspendisse potenti nullam porttitor lacus at turpis donec posuere metus vitae ipsum aliquam non,,Laptops and Desktops,Y,36,100
Test Model 13,Laptops,Mosciski Inc,molestie hendrerit at vulputate vitae nisl aenean lectus pellentesque eget nunc donec quis orci,,Laptops and Desktops,Y Test Model 13,Laptops,Mosciski Inc,molestie hendrerit at vulputate vitae nisl aenean lectus pellentesque eget nunc donec quis orci,,Laptops and Desktops,Y,36,100
Test Model 14,Laptops,Mosciski Inc,egestas metus aenean fermentum donec ut mauris eget massa tempor convallis nulla neque libero convallis eget eleifend,,Laptops and Desktops,N Test Model 14,Laptops,Mosciski Inc,egestas metus aenean fermentum donec ut mauris eget massa tempor convallis nulla neque libero convallis eget eleifend,,Laptops and Desktops,N,36,100
Test Model 15,Laptops,"Upton, Feil and Jast",,,Laptops and Desktops,N Test Model 15,Laptops,"Upton, Feil and Jast",,,Laptops and Desktops,N,36,100
Test Model 16,Laptops,"Romaguera, Goldner and Crooks",dui luctus rutrum nulla tellus in sagittis dui vel nisl duis ac nibh fusce,2315CN41G71,Laptops and Desktops,N Test Model 16,Laptops,"Romaguera, Goldner and Crooks",dui luctus rutrum nulla tellus in sagittis dui vel nisl duis ac nibh fusce,2315CN41G71,Laptops and Desktops,N,36,100
Test Model 17,Laptops,Abernathy-Stamm,maecenas pulvinar lobortis est phasellus sit amet erat nulla tempus,6080UE59E09,Laptops and Desktops,N Test Model 17,Laptops,Abernathy-Stamm,maecenas pulvinar lobortis est phasellus sit amet erat nulla tempus,6080UE59E09,Laptops and Desktops,N,36,100
Test Model 18,Laptops,Mosciski Inc,,5505YF23M46,Laptops and Desktops,N Test Model 18,Laptops,Mosciski Inc,,5505YF23M46,Laptops and Desktops,N,36,100
Test Model 19,Laptops,Walker-Towne,,8673QP30R80,Laptops and Desktops,Y Test Model 19,Laptops,Walker-Towne,,8673QP30R80,Laptops and Desktops,Y,36,100
Test Model 20,Mobile Phones,"Heaney, Altenwerth and Emmerich",nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in congue etiam justo etiam pretium,9088XV67Q94,Mobile Devices,Y Test Model 20,Mobile Phones,"Heaney, Altenwerth and Emmerich",nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in congue etiam justo etiam pretium,9088XV67Q94,Mobile Devices,Y,12,100
Test One,Mobile Phones,Okuneva Group,quis libero nullam sit amet turpis elementum ligula vehicula consequat morbi a ipsum integer a nibh in quis,,Mobile Devices,Y Test One,Mobile Phones,Okuneva Group,quis libero nullam sit amet turpis elementum ligula vehicula consequat morbi a ipsum integer a nibh in quis,,Mobile Devices,Y,12,100
Test Missing Category,,,orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio curabitur,,, Test Missing Category,,,orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio curabitur,,,Y,30,100
One more category,Mobile Phones News,Walker-Towne,"Sphinx of black quartz, judge my vow",,New Fieldset from Improt,Y,30,100
Aaaand one more yes,Mobile Phones,Walker-Towne,"Sphinx of black quartz, judge my vow",,New Fieldset from Improt,Y,30,100
One more no,Mobile Phones,Walker-Towne,"Sphinx of black quartz, judge my vow",,New Fieldset from Improt,N,30,100
Aaaand one more yes yes,Mobile Phones,Walker-Towne,sdfgsdgsdfg,dsfgsdfgsdfgsdg,New Fieldset from Improt,Y,30,100
1 Name Category Manufacturer Notes Model Number Fieldset Requestable EOL Min Qty
2 Changed Test Model Laptops Berge Inc Blargh Sphinx of black quartz, judge my vow 1786VM80X07 Laptops and Desktops Y 36 100
3 Test Model 2 Laptops Botsford, Boyle and Herzog ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae mauris viverra diam vitae quam suspendisse potenti nullam 9351IS25A51 Laptops and Desktops Y 36 50
4 Test Model 3 Laptops Pollich LLC 9929FR08W85 Laptops and Desktops Y 36 30
5 Test Model 4 Laptops Walker-Towne neque vestibulum eget vulputate ut ultrices vel augue vestibulum ante ipsum primis in faucibus orci luctus 9139KQ78G81 Laptops and Desktops Y 36
6 Test Model 5 Laptops Berge Inc turpis adipiscing lorem vitae mattis nibh ligula nec sem duis aliquam convallis nunc proin at turpis a pede 0910VB28Q61 Laptops and Desktops Y 36 0
7 Test Model 6 Laptops Heaney, Altenwerth and Emmerich 7375EM02N97 Laptops and Desktops Y 36 100
8 Test Model 7 Desktops Romaguera, Goldner and Crooks Test Updated Text Laptops and Desktops Y 36 100
9 Test Model 8 Laptops Watsica LLC sapien urna pretium nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in Laptops and Desktops Y 36 100
10 Test Model 9 Laptops Fritsch, Sauer and Conn orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio curabitur Laptops and Desktops Y 36 100
11 Test Model 10 Laptops Upton, Feil and Jast velit vivamus vel nulla eget eros elementum pellentesque quisque porta volutpat Laptops and Desktops Y 36 100
12 Test Model 11 Laptops Berge Inc sed nisl nunc rhoncus dui vel sem sed sagittis nam congue risus semper porta volutpat quam pede lobortis ligula sit Laptops and Desktops Y 36 100
13 Test Model 12 Laptops Kutch, Johnson and Olson curae mauris viverra diam vitae quam suspendisse potenti nullam porttitor lacus at turpis donec posuere metus vitae ipsum aliquam non Laptops and Desktops Y 36 100
14 Test Model 13 Laptops Mosciski Inc molestie hendrerit at vulputate vitae nisl aenean lectus pellentesque eget nunc donec quis orci Laptops and Desktops Y 36 100
15 Test Model 14 Laptops Mosciski Inc egestas metus aenean fermentum donec ut mauris eget massa tempor convallis nulla neque libero convallis eget eleifend Laptops and Desktops N 36 100
16 Test Model 15 Laptops Upton, Feil and Jast Laptops and Desktops N 36 100
17 Test Model 16 Laptops Romaguera, Goldner and Crooks dui luctus rutrum nulla tellus in sagittis dui vel nisl duis ac nibh fusce 2315CN41G71 Laptops and Desktops N 36 100
18 Test Model 17 Laptops Abernathy-Stamm maecenas pulvinar lobortis est phasellus sit amet erat nulla tempus 6080UE59E09 Laptops and Desktops N 36 100
19 Test Model 18 Laptops Mosciski Inc 5505YF23M46 Laptops and Desktops N 36 100
20 Test Model 19 Laptops Walker-Towne 8673QP30R80 Laptops and Desktops Y 36 100
21 Test Model 20 Mobile Phones Heaney, Altenwerth and Emmerich nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in congue etiam justo etiam pretium 9088XV67Q94 Mobile Devices Y 12 100
22 Test One Mobile Phones Okuneva Group quis libero nullam sit amet turpis elementum ligula vehicula consequat morbi a ipsum integer a nibh in quis Mobile Devices Y 12 100
23 Test Missing Category orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio curabitur Y 30 100
24 One more category Mobile Phones News Walker-Towne Sphinx of black quartz, judge my vow New Fieldset from Improt Y 30 100
25 Aaaand one more yes Mobile Phones Walker-Towne Sphinx of black quartz, judge my vow New Fieldset from Improt Y 30 100
26 One more no Mobile Phones Walker-Towne Sphinx of black quartz, judge my vow New Fieldset from Improt N 30 100
27 Aaaand one more yes yes Mobile Phones Walker-Towne sdfgsdgsdfg dsfgsdfgsdfgsdg New Fieldset from Improt Y 30 100

View file

@ -92,7 +92,7 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio
#[Test] #[Test]
public function whenRequiredColumnsAreMissingInImportFile(): void public function whenRequiredColumnsAreMissingInImportFile(): void
{ {
$importFileBuilder = ImportFileBuilder::new()->forget(['category']); $importFileBuilder = ImportFileBuilder::new(['name' => '']);
$import = Import::factory()->assetmodel()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]); $import = Import::factory()->assetmodel()->create(['file_path' => $importFileBuilder->saveToImportsDirectory()]);
$this->actingAsForApi(User::factory()->superuser()->create()); $this->actingAsForApi(User::factory()->superuser()->create());
@ -104,7 +104,10 @@ class ImportAssetModelsTest extends ImportDataTestCase implements TestsPermissio
'payload' => null, 'payload' => null,
'messages' => [ 'messages' => [
'' => [ '' => [
'name' => ['The name field is required.'], '' => [
'' =>
['The name field is required.'],
],
] ]
] ]
]); ]);