PluginProbe
Billingo Official for WooCommerce / trunk
Billingo Official for WooCommerce vtrunk
4.3.3 4.3.2 trunk 0.0.2 1.0.0 2.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 All 82 releases
billingo / src / Factories / ProductFactory.php

ProductFactory.php in Billingo Official for WooCommerce trunk, at src/Factories/ProductFactory.php

35 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace App\Billingo\Factories;
4
5 use App\Billingo\Enums\CurrencyEnum;
6 use App\Billingo\Enums\EntitlementEnum;
7 use App\Billingo\Enums\VatEnum;
8
9 class ProductFactory extends BaseFactory
10 {
11
12 public function definition(): array
13 {
14 $netUnitPrice = $this->faker->randomFloat(2, 1, 1000);
15
16 return [
17 'id' => $this->faker->optional()->randomNumber(),
18 'name' => $this->faker->word(),
19 'comment' => $this->faker->optional()->sentence(),
20 'currency' => $this->faker->randomElement(getEnumValues(CurrencyEnum::class)),
21 'vat' => $this->faker->randomElement(getEnumValues(VatEnum::class)),
22 'net_unit_price' => $netUnitPrice,
23 'gross_unit_price' => $this->faker->optional(0.1)->randomFloat(2, 1, 1000),
24 'unit' => $this->faker->word(),
25 'general_ledger_number' => $this->faker->optional()->regexify('[A-Z]{4}-[0-9]{6}'),
26 'general_ledger_taxcode' => $this->faker->optional()->regexify('[A-Z]{4}-[0-9]{6}'),
27 'entitlement' => $this->faker->optional()->randomElement(getEnumValues(EntitlementEnum::class)),
28 'ean' => $this->faker->optional()->ean13(),
29 'sku' => $this->faker->optional()->regexify('[A-Z]{5}-[0-9]{5}'),
30 'is_manage' => $this->faker->optional()->boolean(),
31 'purchase_price' => $this->faker->optional()->randomFloat(2, 1, 1000),
32 ];
33 }
34 }
35