<?php
namespace Tests\Unit;
use App\Application\Services\LedgerService;
use App\Models\Asset;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Validation\ValidationException;
use Tests\TestCase;
final class LedgerServiceTest extends TestCase { use RefreshDatabase; public function test_unbalanced_transaction_is_rejected():void { $asset=Asset::factory()->create();$service=app(LedgerService::class);$a=$service->account(null,$asset->id,'blockchain_clearing');$b=$service->account(null,$asset->id,'platform_fee_revenue');$this->expectException(ValidationException::class);$service->post('test','1','test:1',[['account_id'=>$a->id,'direction'=>'debit','amount_atomic'=>'100'],['account_id'=>$b->id,'direction'=>'credit','amount_atomic'=>'99']]); } }
