FirstPageControllerTest.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace Tests\Operation\Http\Controllers;
  3. use Modules\Operation\Http\Controllers\FirstPageController;
  4. use PHPUnit\Framework\TestCase;
  5. use Tests\UsedTestCase;
  6. class FirstPageControllerTest extends UsedTestCase
  7. {
  8. public function testAdd()
  9. {
  10. $res = $this->withHeaders([
  11. 'Authorization' => 'Bearer '. $this->token,
  12. ])->json('post','http://localhost/api/operationManage/firstPage/add', [
  13. 'type' => 1,
  14. 'status' => 0,
  15. ]);
  16. $this->dumpJson($res);
  17. }
  18. public function testList()
  19. {
  20. $res = $this->withHeaders([
  21. 'Authorization' => 'Bearer '. $this->token,
  22. ])->json('get','http://localhost/api/operationManage/firstPage/list');
  23. $res->dump();
  24. $this->dumpJson($res);
  25. }
  26. public function testEnableStatus()
  27. {
  28. $res = $this->withHeaders([
  29. 'Authorization' => 'Bearer '. $this->token,
  30. ])->json('post','http://localhost/api/operationManage/firstPage/enableStatus', [
  31. 'id' => 4,
  32. ]);
  33. $res->dump();
  34. $this->dumpJson($res);
  35. }
  36. public function testsetConfig()
  37. {
  38. $res = $this->withHeaders([
  39. 'Authorization' => 'Bearer '. $this->token,
  40. ])->json('post','http://localhost/api/operationManage/firstPage/setConfig', [
  41. 'id' => 4,
  42. 'duanjus' => [
  43. [
  44. 'sort' => 5,
  45. 'id' => 9,
  46. 'name' => 'xxx1',
  47. ],
  48. [
  49. 'sort' => 1,
  50. 'id' =>10,
  51. 'name' => 'xxx2',
  52. ],[
  53. 'sort' => 3,
  54. 'id' =>11,
  55. 'name' => 'xxx3',
  56. ],[
  57. 'sort' => 4,
  58. 'id' =>12,
  59. 'name' => 'xxx4',
  60. ],
  61. ]
  62. ]);
  63. $res->dump();
  64. $this->dumpJson($res);
  65. }
  66. }