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.
crmeb_php/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/UploadPartResultTest.php

34 lines
925 B

1 year ago
<?php
namespace OSS\Tests;
use OSS\Core\OssException;
use OSS\Result\UploadPartResult;
use OSS\Http\ResponseCore;
class UploadPartResultTest extends \PHPUnit_Framework_TestCase
{
private $validHeader = array('etag' => '7265F4D211B56873A381D321F586E4A9');
private $invalidHeader = array();
public function testParseValidHeader()
{
$response = new ResponseCore($this->validHeader, "", 200);
$result = new UploadPartResult($response);
$eTag = $result->getData();
$this->assertEquals('7265F4D211B56873A381D321F586E4A9', $eTag);
}
public function testParseInvalidHeader()
{
$response = new ResponseCore($this->invalidHeader, "", 200);
try {
new UploadPartResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertEquals('cannot get ETag', $e->getMessage());
}
}
}