BodyResultTest.php 655 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace OSS\Tests;
  3. use OSS\Http\ResponseCore;
  4. use OSS\Result\BodyResult;
  5. class BodyResultTest extends \PHPUnit_Framework_TestCase
  6. {
  7. public function testParseValid200()
  8. {
  9. $response = new ResponseCore(array(), "hi", 200);
  10. $result = new BodyResult($response);
  11. $this->assertTrue($result->isOK());
  12. $this->assertEquals($result->getData(), "hi");
  13. }
  14. public function testParseInvalid404()
  15. {
  16. $response = new ResponseCore(array(), null, 200);
  17. $result = new BodyResult($response);
  18. $this->assertTrue($result->isOK());
  19. $this->assertEquals($result->getData(), "");
  20. }
  21. }