| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace App\Module\Fund\Tests\Unit;
- use App\Module\Fund\Dto\TransferDto;
- use App\Module\Fund\Enums\FUND_TYPE;
- use App\Module\Fund\Services\AccountService;
- use App\Module\Fund\Services\DtoService;
- use App\Module\Fund\Services\FundService;
- use App\Module\Fund\Models\FundModel;
- use Illuminate\Support\Facades\DB;
- use Tests\TestCase;
- /**
- * 流转测试
- */
- class TcTest extends TestCase
- {
- protected $fromUserId = 10002;
- public function setUp(): void
- {
- parent::setUp();
- AccountService::check4user($this->fromUserId);
- // 确保测试账户有足够余额
- $fund = new FundService($this->fromUserId, FUND_TYPE::BNB->value);
- if ($fund->balance() < 10000000) {
- $fund->admin_operate(1, FUND_TYPE::BNB, 1000000000, 'TEST');
- }
- }
- /**
- * 测试转账DTO
- */
- public function test_dto()
- {
- DB::beginTransaction();
- $fund = new FundService($this->fromUserId, 401);
- $res = $fund->circulation(FUND_TYPE::BNB, 10000000, 1, 'TEST', 'TEST');
- self::assertTrue($res);
- DB::commit();
- }
- }
|