You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
961 B

5 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://doc.hyperf.io
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace HyperfTest;
  12. use Hyperf\Testing\Client;
  13. use PHPUnit\Framework\TestCase;
  14. /**
  15. * Class HttpTestCase.
  16. * @method get($uri, $data = [], $headers = [])
  17. * @method post($uri, $data = [], $headers = [])
  18. * @method json($uri, $data = [], $headers = [])
  19. * @method file($uri, $data = [], $headers = [])
  20. */
  21. abstract class HttpTestCase extends TestCase
  22. {
  23. /**
  24. * @var Client
  25. */
  26. protected $client;
  27. public function __construct($name = null, array $data = [], $dataName = '')
  28. {
  29. parent::__construct($name, $data, $dataName);
  30. $this->client = make(Client::class);
  31. }
  32. public function __call($name, $arguments)
  33. {
  34. return $this->client->{$name}(...$arguments);
  35. }
  36. }