72 lines
2.2 KiB
PHP
72 lines
2.2 KiB
PHP
<?php
|
|
|
|
use App\Models\Country;
|
|
use App\Models\Product;
|
|
use App\Models\Shipping;
|
|
use App\Models\ShippingCountry;
|
|
use App\Models\UserAbo;
|
|
use App\User;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
uses(Tests\TestCase::class)->in('Feature/Incentive');
|
|
uses(Tests\TestCase::class)->in('Feature/Sys');
|
|
uses(Tests\TestCase::class)->in('Unit/Incentive');
|
|
uses(Tests\TestCase::class)->in('Unit/Dhl');
|
|
uses(Tests\TestCase::class)->in('Feature/PaymentDashboard');
|
|
|
|
if (! function_exists('makeShopEnv')) {
|
|
function makeShopEnv(): void
|
|
{
|
|
$country = Country::create([
|
|
'code' => 'DE', 'phone' => '49', 'en' => 'Germany', 'de' => 'Deutschland',
|
|
'es' => 'Alemania', 'fr' => 'Allemagne', 'it' => 'Germania', 'ru' => 'Германия',
|
|
]);
|
|
$shipping = Shipping::create(['name' => 'Standard', 'active' => true]);
|
|
ShippingCountry::create(['shipping_id' => $shipping->id, 'country_id' => $country->id]);
|
|
}
|
|
}
|
|
|
|
if (! function_exists('makeMeAbo')) {
|
|
function makeMeAbo(): UserAbo
|
|
{
|
|
$consultant = User::forceCreate([
|
|
'email' => 'c-'.uniqid('', true).'@example.com',
|
|
'password' => bcrypt('secret'),
|
|
'lang' => 'de',
|
|
]);
|
|
|
|
return UserAbo::create([
|
|
'user_id' => $consultant->id,
|
|
'shopping_user_id' => 1,
|
|
'is_for' => 'me',
|
|
'email' => $consultant->email,
|
|
'payone_userid' => 900100,
|
|
'clearingtype' => 'cc',
|
|
'active' => true,
|
|
'status' => 2,
|
|
'abo_interval' => 5,
|
|
'next_date' => now()->addDays(3),
|
|
]);
|
|
}
|
|
}
|
|
|
|
if (! function_exists('makeProduct')) {
|
|
function makeProduct(array $showOn, float $price = 119, float $tax = 19): Product
|
|
{
|
|
$now = now();
|
|
$id = (int) DB::table('products')->insertGetId([
|
|
'name' => 'P-'.uniqid('', true),
|
|
'title' => 'Produkt',
|
|
'active' => true,
|
|
'price' => $price,
|
|
'tax' => $tax,
|
|
'weight' => 500,
|
|
'points' => 7,
|
|
'show_on' => json_encode($showOn),
|
|
'created_at' => $now,
|
|
'updated_at' => $now,
|
|
]);
|
|
|
|
return Product::findOrFail($id);
|
|
}
|
|
}
|