JuliangAccountControllerTest.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace Tests\Callback\Http\Controllers;
  3. use Modules\Callback\Http\Controllers\JuliangAccountController;
  4. use PHPUnit\Framework\TestCase;
  5. use Tests\UsedTestCase;
  6. class JuliangAccountControllerTest extends UsedTestCase
  7. {
  8. public function testAddAccount()
  9. {
  10. $res = $this->withHeaders([
  11. 'Authorization' => 'Bearer '. $this->token,
  12. ])->json('post','http://localhost/api/callback/juliangAccount/addAccount', [
  13. 'account_id' => 123456810,
  14. 'account_name' => 'jkljlkj-10',
  15. 'state' => 1,
  16. 'protect_num' => 3,
  17. 'default_rate' => 50,
  18. 'rate_time_config' => [
  19. ['start_time' => '00:35', 'end_time' => '12:34', 'config_per' => 20],
  20. ['start_time' => '13:39', 'end_time' => '19:34', 'config_per' => 30],
  21. ],
  22. 'min_money' => 20,
  23. 'max_money' => 50,
  24. 'callback_state' => 1
  25. ]);
  26. $res->dump();
  27. }
  28. public function testupdateCallbackConfig() {
  29. $res = $this->withHeaders([
  30. 'Authorization' => 'Bearer '. $this->token,
  31. ])->json('post','http://localhost/api/callback/juliangAccount/updateCallbackConfig', [
  32. 'ids' => [4],
  33. 'state' => 1,
  34. 'protect_num' => 3,
  35. 'default_rate' => 30,
  36. 'rate_time_config' => [
  37. ['start_time' => '15:00', 'end_time' => '16:10', 'config_per' => 20],
  38. ['start_time' => '16:20', 'end_time' => '17:30', 'config_per' => 50],
  39. ['start_time' => '17:55', 'end_time' => '18:30', 'config_per' => 20],
  40. ],
  41. 'min_money' => 30,
  42. 'max_money' => 80,
  43. ]);
  44. $res->dump();
  45. }
  46. public function testList() {
  47. $res = $this->withHeaders([
  48. 'Authorization' => 'Bearer '. $this->token,
  49. ])->json('get','http://localhost/api/callback/juliangAccount/list');
  50. $res->dump();
  51. $this->dumpJson($res);
  52. }
  53. public function testturnCallbackState() {
  54. $res = $this->withHeaders([
  55. 'Authorization' => 'Bearer '. $this->token,
  56. ])->json('post','http://localhost/api/callback/juliangAccount/turnCallbackState', [
  57. 'id' => 5,
  58. 'state' => 1
  59. ]);
  60. $res->dump();
  61. }
  62. public function testunbindPromotion() {
  63. $res = $this->withHeaders([
  64. 'Authorization' => 'Bearer '. $this->token,
  65. ])->json('post','http://localhost/api/callback/juliangAccount/unbindPromotion', [
  66. 'id' => 5,
  67. ]);
  68. $res->dump();
  69. }
  70. }