Merge pull request #2444 from Haendlerbund/add-data-to-factories

Added fields to order related factories
This commit is contained in:
Jitendra Singh 2020-02-13 17:11:17 +05:30 committed by GitHub
commit 3fb2b8a5c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View File

@ -49,6 +49,8 @@ $factory->define(Order::class, function (Faker $faker) {
'channel_id' => 1,
'channel_type' => Channel::class,
'cart_id' => 0,
'shipping_method' => 'free_free',
'shipping_title' => 'Free Shipping',
];
});

View File

@ -31,6 +31,7 @@ $factory->define(OrderItem::class, function (Faker $faker) {
},
'created_at' => $now,
'updated_at' => $now,
'product_type' => Product::class,
];
});

View File

@ -6,12 +6,14 @@ use Faker\Generator as Faker;
use Illuminate\Support\Facades\DB;
use Webkul\Sales\Models\OrderPayment;
$factory->define(OrderPayment::class, function (Faker $faker) {
$now = date("Y-m-d H:i:s");
$factory->define(OrderPayment::class, function (Faker $faker, array $attributes) {
if (!array_key_exists('order_id', $attributes)) {
throw new InvalidArgumentException('order_id must be provided.');
}
return [
'created_at' => $now,
'updated_at' => $now,
'method' => 'cashondelivery',
];
});

View File

@ -19,7 +19,7 @@ class GuestCheckoutCest
$this->faker = Factory::create();
$pConfigDefault = [
'productInventory' => ['qty' => $this->faker->randomNumber(2)],
'productInventory' => ['qty' => $this->faker->numberBetween(1, 1000)],
'attributeValues' => [
'status' => true,
'new' => 1,
@ -27,7 +27,7 @@ class GuestCheckoutCest
],
];
$pConfigGuestCheckout = [
'productInventory' => ['qty' => $this->faker->randomNumber(2)],
'productInventory' => ['qty' => $this->faker->numberBetween(1, 1000)],
'attributeValues' => [
'status' => true,
'new' => 1,