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.
39 lines
935 B
39 lines
935 B
1 year ago
|
<?php
|
||
|
|
||
|
namespace OSS\Tests;
|
||
|
|
||
|
|
||
|
use OSS\Result\ExistResult;
|
||
|
use OSS\Http\ResponseCore;
|
||
|
use OSS\Core\OssException;
|
||
|
|
||
|
class ExistResultTest extends \PHPUnit_Framework_TestCase
|
||
|
{
|
||
|
public function testParseValid200()
|
||
|
{
|
||
|
$response = new ResponseCore(array(), "", 200);
|
||
|
$result = new ExistResult($response);
|
||
|
$this->assertTrue($result->isOK());
|
||
|
$this->assertEquals($result->getData(), true);
|
||
|
}
|
||
|
|
||
|
public function testParseInvalid404()
|
||
|
{
|
||
|
$response = new ResponseCore(array(), "", 404);
|
||
|
$result = new ExistResult($response);
|
||
|
$this->assertTrue($result->isOK());
|
||
|
$this->assertEquals($result->getData(), false);
|
||
|
}
|
||
|
|
||
|
public function testInvalidResponse()
|
||
|
{
|
||
|
$response = new ResponseCore(array(), "", 300);
|
||
|
try {
|
||
|
new ExistResult($response);
|
||
|
$this->assertTrue(false);
|
||
|
} catch (OssException $e) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|