AdvertiserControllerTest.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. 'username' => 'aa'
  30. ]));
  31. dump(\json_encode($res->json()));
  32. }
  33. public function testgetAdvertiser() {
  34. $res = $this->withHeaders([
  35. 'Authorization' => 'Bearer '. $this->token,
  36. ])->json('get','http://localhost/api/channel/advertiser/getAdvertiser?'.http_build_query([
  37. // 'email' => 'aa1@test.com',
  38. // 'miniProgramId' => 3,
  39. 'id' => 6
  40. ]));
  41. $this->dumpJson($res);
  42. }
  43. public function testupdateAdvertiser() {
  44. $res = $this->withHeaders([
  45. 'Authorization' => 'Bearer '. $this->token,
  46. ])->json('post','http://localhost/api/channel/advertiser/updateAdvertiser', [
  47. 'id' => 6,
  48. 'username' => 'change@aa@test',
  49. 'miniProgramIds' => [1,5,6,7],
  50. 'status' => 0,
  51. 'remark' => 'first change'
  52. ]);
  53. }
  54. }