AdvertiserControllerTest.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Tests\Channel\Http\Controllers;
  3. use Modules\Channel\Http\Controllers\AdvertiserController;
  4. use PHPUnit\Framework\TestCase;
  5. use Tests\UsedTestCase;
  6. class AdvertiserControllerTest extends UsedTestCase
  7. {
  8. public function testAddAdvertiser()
  9. {
  10. $res = $this->withHeaders([
  11. 'Authorization' => 'Bearer '. $this->token,
  12. ])->json('post','http://localhost/api/channel/advertiser/add', [
  13. 'email' => 'aa4@test.com',
  14. 'password' => '123',
  15. 'repassword' => '123',
  16. 'status' => 1,
  17. 'remark' => 'kljlkjkj',
  18. 'miniProgramIds'=> [1,2,3],
  19. 'username' => 'aa1@test'
  20. ]);
  21. $res->dump();
  22. }
  23. public function testlistAdvertiser() {
  24. $res = $this->withHeaders([
  25. 'Authorization' => 'Bearer '. $this->token,
  26. ])->json('get','http://localhost/api/channel/advertiser/listAdvertiser?'.http_build_query([
  27. // 'email' => 'aa1@test.com',
  28. // 'miniProgramId' => 3,
  29. ]));
  30. $this->dumpJson($res);
  31. }
  32. public function testgetAdvertiser() {
  33. $res = $this->withHeaders([
  34. 'Authorization' => 'Bearer '. $this->token,
  35. ])->json('get','http://localhost/api/channel/advertiser/getAdvertiser?'.http_build_query([
  36. // 'email' => 'aa1@test.com',
  37. // 'miniProgramId' => 3,
  38. 'id' => 6
  39. ]));
  40. $this->dumpJson($res);
  41. }
  42. public function testupdateAdvertiser() {
  43. $res = $this->withHeaders([
  44. 'Authorization' => 'Bearer '. $this->token,
  45. ])->json('post','http://localhost/api/channel/advertiser/updateAdvertiser', [
  46. 'id' => 6,
  47. 'username' => 'change@aa@test',
  48. 'miniProgramIds' => [1,5,6,7],
  49. 'status' => 0,
  50. 'remark' => 'first change'
  51. ]);
  52. }
  53. }