JuliangAccountControllerTest.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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' => 1234568,
  14. 'account_name' => 'jkljlkj',
  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. ]);
  25. $res->dump();
  26. }
  27. public function testupdateCallbackConfig() {
  28. $res = $this->withHeaders([
  29. 'Authorization' => 'Bearer '. $this->token,
  30. ])->json('post','http://localhost/api/callback/juliangAccount/updateCallbackConfig', [
  31. 'ids' => [4],
  32. 'state' => 0,
  33. 'protect_num' => 2,
  34. 'default_rate' => 30,
  35. 'rate_time_config' => [
  36. ['start_time' => '15:00', 'end_time' => '16:10', 'config_per' => 20],
  37. ['start_time' => '16:20', 'end_time' => '19:30', 'config_per' => 50],
  38. ],
  39. 'min_money' => 40,
  40. 'max_money' => 60,
  41. ]);
  42. $res->dump();
  43. }
  44. public function testList() {
  45. $res = $this->withHeaders([
  46. 'Authorization' => 'Bearer '. $this->token,
  47. ])->json('get','http://localhost/api/callback/juliangAccount/list');
  48. $this->dumpJson($res);
  49. }
  50. }