add inventory and supply logic

This commit is contained in:
root
2026-03-10 18:21:08 -04:00
parent 17d73e2f92
commit 25e7b3c67c
62 changed files with 3846 additions and 2781 deletions
@@ -0,0 +1,40 @@
<?php
namespace Tests\Unit\Services\Inventory;
use App\Services\Inventory\SupplierService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class SupplierServiceTest extends TestCase
{
use RefreshDatabase;
public function test_create_supplier(): void
{
$service = new SupplierService();
$result = $service->create([
'name' => 'Supplier A',
'email' => 'a@example.com',
]);
$this->assertTrue($result['ok']);
$this->assertDatabaseHas('suppliers', ['name' => 'Supplier A']);
}
public function test_update_supplier(): void
{
$id = DB::table('suppliers')->insertGetId([
'name' => 'Supplier B',
'created_at' => now(),
'updated_at' => now(),
]);
$service = new SupplierService();
$result = $service->update($id, ['name' => 'Supplier Updated']);
$this->assertTrue($result['ok']);
$this->assertDatabaseHas('suppliers', ['id' => $id, 'name' => 'Supplier Updated']);
}
}