CpSubscribeStatisticDataControllerTest.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Tests\ContentManage\Http\Controllers;
  3. use Modules\ContentManage\Http\Controllers\CpSubscribeStatisticDataController;
  4. use PHPUnit\Framework\TestCase;
  5. class CpSubscribeStatisticDataControllerTest extends \Tests\UsedTestCase
  6. {
  7. public function testList()
  8. {
  9. $res = $this->withHeaders([
  10. 'Authorization' => 'Bearer '. $this->token,
  11. ])->json('get','http://localhost/api/contentManage/cp/subscribeStatisticData/list?'.http_build_query([
  12. 'limit' => 15, 'page' => 1, 'book_name' => '小溪村的诱惑',
  13. 'cp_name' => 'quyuewang'
  14. ]));
  15. dump(\json_encode($res->json()));
  16. $res->dump();
  17. }
  18. public function testlistStatistic()
  19. {
  20. $res = $this->withHeaders([
  21. 'Authorization' => 'Bearer '. $this->token,
  22. ])->json('get','http://localhost/api/contentManage/cp/subscribeStatisticData/listStatistic?');
  23. dump(\json_encode($res->json()));
  24. $res->dump();
  25. }
  26. public function testMonthList()
  27. {
  28. $res = $this->withHeaders([
  29. 'Authorization' => 'Bearer '. $this->token,
  30. ])->json('get','http://localhost/api/contentManage/cp/subscribeStatisticData/monthList?'.http_build_query([
  31. 'limit' => 15, 'page' => 1 , 'month' => '2022-07', 'cp_name' => 'Testcp01111'
  32. ]));
  33. dump(\json_encode($res->json()));
  34. $res->dump();
  35. }
  36. public function testSaveFinalState() {
  37. $res = $this->withHeaders([
  38. 'Authorization' => 'Bearer '. $this->token,
  39. ])->json('post','http://localhost/api/contentManage/cp/subscribeStatisticData/saveFinalState', [
  40. 'id' => 1, 'final_state' => 'done'
  41. ]);
  42. dump(\json_encode($res->json()));
  43. $res->dump();
  44. }
  45. public function testlistCpBooksMonthFinalAmount() {
  46. $res = $this->withHeaders([
  47. 'Authorization' => 'Bearer '. $this->token,
  48. ])->json('get','http://localhost/api/contentManage/cp/subscribeStatisticData/listCpMonthFinalAmount?'.http_build_query([
  49. 'cp_name' => '1221', 'month' => '2023-03'
  50. ]));
  51. $this->dumpJson($res);
  52. }
  53. }