AITermServiceTest.php 911 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Tests\Feature;
  3. use Tests\TestCase;
  4. use App\Services\AITermService;
  5. class AITermServiceTest extends TestCase
  6. {
  7. public function test_real_llm_generation()
  8. {
  9. // ===== 创建 Service =====
  10. $service = app(AITermService::class);
  11. $service->setModel('70259783-6053-4a6e-adda-506031b0cc22');
  12. // ===== 执行 =====
  13. $result = $service->create('f3ba16e5-862d-49c4-b5b0-39ab8b8ca4f4');
  14. // ===== 调试输出(建议保留)=====
  15. dump($result);
  16. // ===== 断言(关键)=====
  17. $this->assertNotEmpty($result);
  18. // Markdown 结构
  19. $this->assertStringContainsString('##', $result);
  20. // 引用格式(核心能力)
  21. $this->assertMatchesRegularExpression('/\{\{para\|id=\d+-\d+\|/', $result);
  22. // 脚注
  23. $this->assertMatchesRegularExpression('/\[\d+\]/', $result);
  24. }
  25. }