SimpleResponseTest.php 837 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Dilab\Network;
  3. use Dilab\Network\Response;
  4. /**
  5. * Class SimpleResponseTest
  6. * @package Dilab\Network
  7. * @property $response Response
  8. */
  9. class SimpleResponseTest extends \PHPUnit_Framework_TestCase
  10. {
  11. protected function setUp()
  12. {
  13. $this->response = new SimpleResponse();
  14. }
  15. public function tearDown()
  16. {
  17. unset($this->response);
  18. parent::tearDown();
  19. }
  20. public function headerProvider()
  21. {
  22. return array(
  23. array(404,404),
  24. array(200,200),
  25. array(500,404),
  26. );
  27. }
  28. /**
  29. * @runInSeparateProcess
  30. * @dataProvider headerProvider
  31. */
  32. public function testHeader($statusCode, $expectd)
  33. {
  34. $this->response->header($statusCode);
  35. $this->assertEquals($expectd, http_response_code());
  36. }
  37. }