restore createInventory, its necessary...

This commit is contained in:
Herbert Maschke 2020-03-31 14:40:40 +02:00
parent 0f5913fbba
commit 3048ae4a7b
1 changed files with 16 additions and 0 deletions

View File

@ -43,6 +43,9 @@ class Laravel5Helper extends Laravel5
*/
public static function getAttributeFieldName(string $type): ?string
{
$attributes = [];
$possibleTypes = [
'text' => 'text_value',
'select' => 'integer_value',
@ -207,6 +210,8 @@ class Laravel5Helper extends Laravel5
$I->createAttributeValues($product->id, $configs['attributeValues'] ?? []);
$I->createInventory($product->id, $configs['productInventory']);
return $product->refresh();
}
@ -222,6 +227,8 @@ class Laravel5Helper extends Laravel5
$I->createAttributeValues($product->id, $configs['attributeValues'] ?? []);
$I->createInventory($product->id, $configs['productInventory']);
return $product->refresh();
}
@ -247,6 +254,15 @@ class Laravel5Helper extends Laravel5
return factory(Product::class)->states($states)->create($attributes);
}
private function createInventory(int $productId, array $inventoryConfig = []): void
{
$I = $this;
$I->have(ProductInventory::class, array_merge($inventoryConfig, [
'product_id' => $productId,
'inventory_source_id' => 1,
]));
}
private function createDownloadableLink(int $productId): void
{
$I = $this;