You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
topnotch_website/tests/Unit/OrderTests.php

39 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature;
use App\Filament\Resources\OrderResource\Pages\ListOrders;
use App\Models\Customer;
use App\Models\Order;
use App\Models\OrderProduct;
use App\Models\ProductService;
use App\Models\ServiceFile;
use function Pest\Livewire\livewire;
it('can list posts', function () {
$customer = Customer::factory()->create();
$orders = Order::factory()->for($customer)->count(2)->create();
livewire(ListOrders::class)
->assertCanSeeTableRecords($orders);
});
it('can create a post', function () {
$customer = Customer::factory()->create();
$formData = Order::factory()->for($customer)->create();
$formData['order_products'] = OrderProduct::factory()->count(2)->create();
$formData['order_products'][0]['xs'] = 4;
$formData['order_products'][1]['s'] = 3;
$serviceFile1 = ServiceFile::factory()->create();
$serviceFile2 = ServiceFile::factory()->create();
$formData['services'][0] = ProductService::factory()->for($serviceFile1)->create();
$formData['services'][1] = ProductService::factory()->for($serviceFile2)->create();
dd($formData);
});