42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Phase6;
|
|
|
|
use App\Filament\Widgets\CriticalStock;
|
|
use App\Models\User;
|
|
use Livewire\Livewire;
|
|
use Tests\Support\InsForgeFake;
|
|
use Tests\TestCase;
|
|
|
|
class WidProbe extends TestCase
|
|
{
|
|
public function test_probe(): void
|
|
{
|
|
InsForgeFake::reset();
|
|
InsForgeFake::fakeRest();
|
|
|
|
InsForgeFake::seed('products', [
|
|
'id' => 'p-1', 'code' => 'BERAS-001', 'name' => 'Beras Premium',
|
|
'cost_price' => 13000, 'stock_minimum' => 50, 'is_active' => true,
|
|
]);
|
|
|
|
$user = new User;
|
|
$user->forceFill(['id' => 'u1', 'role' => 'operator', 'is_active' => true]);
|
|
$this->actingAs($user);
|
|
|
|
InsForgeFake::seed('stocks', [
|
|
'id' => 's1',
|
|
'product_id' => 'p-1',
|
|
'quantity' => 5,
|
|
'products' => ['code' => 'BERAS-001', 'name' => 'Beras Premium', 'stock_minimum' => 50, 'cost_price' => 13000],
|
|
]);
|
|
|
|
$html = Livewire::test(CriticalStock::class)->html();
|
|
echo 'len=', strlen($html), "\n";
|
|
echo 'Beras: ', str_contains($html, 'Beras Premium') ? 'Y' : 'N', "\n";
|
|
echo 'kritis: ', str_contains($html, 'kritis') ? 'Y' : 'N', "\n";
|
|
echo 'no-data: ', str_contains($html, 'tidak ada data') || str_contains($html, 'empty') ? 'Y' : 'N', "\n";
|
|
$this->assertTrue(true);
|
|
}
|
|
}
|