OutputTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Tests\ContentManage\Output;
  3. // use Illuminate\Foundation\Testing\RefreshDatabase;
  4. use Tests\TestCase;
  5. /**
  6. * 输出测试
  7. */
  8. class OutputTest extends TestCase
  9. {
  10. private string $query = 'channel_name=zhuishuyun&channel_key=123456';
  11. private string $prefix = '/api/output/';
  12. /**
  13. *
  14. *书籍列表
  15. * @return void
  16. */
  17. public function test_book_list()
  18. {
  19. $response = $this->getJson($this->prefix.'booklist?'.$this->query);
  20. print_r(json_decode($response->getContent(),1));
  21. $response->assertStatus(200);
  22. }
  23. public function test_book_detail()
  24. {
  25. $response = $this->getJson($this->prefix.'bookdetail/1?'.$this->query);
  26. print_r(json_decode($response->getContent(),1));
  27. $response->assertStatus(200);
  28. }
  29. public function test_chapter_list()
  30. {
  31. $response = $this->getJson($this->prefix.'chapterlist/1?'.$this->query);
  32. //print_r(json_decode($response->getContent(),1));
  33. $response->assertStatus(200);
  34. }
  35. public function test_chapter_content()
  36. {
  37. $response = $this->getJson($this->prefix.'chaptercontent/1/chapterid/1?'.$this->query);
  38. print_r(json_decode($response->getContent(),1));
  39. $response->assertStatus(200)->assertJsonPath('code', 10000);
  40. }
  41. public function test_categories()
  42. {
  43. $response = $this->getJson($this->prefix.'listCategories?'.$this->query);
  44. print_r(json_decode($response->getContent(),1));
  45. $response->assertStatus(200)->assertJsonPath('code', 10000);
  46. }
  47. }