Upgrade oss sdk
parent
0504b56a0d
commit
dacec255a8
|
@ -8,16 +8,16 @@
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aliyuncs/oss-sdk-php",
|
"name": "aliyuncs/oss-sdk-php",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
||||||
"reference": "492866331b7bafaac09506cf42f351b7e9e63766"
|
"reference": "0c9d902c33847c07efc66c4cdf823deaea8fc2b6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/492866331b7bafaac09506cf42f351b7e9e63766",
|
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/0c9d902c33847c07efc66c4cdf823deaea8fc2b6",
|
||||||
"reference": "492866331b7bafaac09506cf42f351b7e9e63766",
|
"reference": "0c9d902c33847c07efc66c4cdf823deaea8fc2b6",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
|
@ -30,8 +30,8 @@
|
||||||
"php": ">=5.3"
|
"php": ">=5.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "*",
|
||||||
"satooshi/php-coveralls": "~1.0"
|
"satooshi/php-coveralls": "*"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -53,9 +53,9 @@
|
||||||
"homepage": "http://www.aliyun.com/product/oss/",
|
"homepage": "http://www.aliyun.com/product/oss/",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
|
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
|
||||||
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.4.1"
|
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.4.2"
|
||||||
},
|
},
|
||||||
"time": "2020-09-29T06:23:57+00:00"
|
"time": "2021-06-04T06:55:06+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# ChangeLog - Aliyun OSS SDK for PHP
|
# ChangeLog - Aliyun OSS SDK for PHP
|
||||||
|
|
||||||
|
## v2.4.2 / 2021-06-04
|
||||||
|
* Compatible with PHP8.
|
||||||
|
* Fixed: compatible with PHP5.4.
|
||||||
|
* Fixed: the signature is incorrect in some scenarios
|
||||||
|
* Update: change $requestUrl from a member variable to a local variable.
|
||||||
|
|
||||||
## v2.4.1 / 2020-09-29
|
## v2.4.1 / 2020-09-29
|
||||||
* Fixed: the getBucketPolicy bug.
|
* Fixed: the getBucketPolicy bug.
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
"php":">=5.3"
|
"php":">=5.3"
|
||||||
},
|
},
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "*",
|
||||||
"satooshi/php-coveralls": "~1.0"
|
"satooshi/php-coveralls": "*"
|
||||||
},
|
},
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|
|
@ -439,7 +439,8 @@ BBB;
|
||||||
$sub_object = $xml->addChild('Object');
|
$sub_object = $xml->addChild('Object');
|
||||||
$key = OssUtil::sReplace($object->getKey());
|
$key = OssUtil::sReplace($object->getKey());
|
||||||
$sub_object->addChild('Key', $key);
|
$sub_object->addChild('Key', $key);
|
||||||
if (!empty($object->getVersionId())) {
|
$versionId = $object->getVersionId();
|
||||||
|
if (!empty($versionId)) {
|
||||||
$sub_object->addChild('VersionId', $object->getVersionId());
|
$sub_object->addChild('VersionId', $object->getVersionId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -777,7 +777,7 @@ class RequestCore
|
||||||
* data stored in the `curl_handle` and `response` properties unless replacement data is passed in via
|
* data stored in the `curl_handle` and `response` properties unless replacement data is passed in via
|
||||||
* parameters.
|
* parameters.
|
||||||
*
|
*
|
||||||
* @param resource $curl_handle (Optional) The reference to the already executed cURL request.
|
* @param resource|\CurlHandle|null|false $curl_handle (Optional) The reference to the already executed cURL request. Receive CurlHandle instance from PHP8.0
|
||||||
* @param string $response (Optional) The actual response content itself that needs to be parsed.
|
* @param string $response (Optional) The actual response content itself that needs to be parsed.
|
||||||
* @return ResponseCore A <ResponseCore> object containing a parsed HTTP response.
|
* @return ResponseCore A <ResponseCore> object containing a parsed HTTP response.
|
||||||
*/
|
*/
|
||||||
|
@ -788,8 +788,8 @@ class RequestCore
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// As long as this came back as a valid resource...
|
// As long as this came back as a valid resource or CurlHandle instance...
|
||||||
if (is_resource($curl_handle)) {
|
if (is_resource($curl_handle) || (is_object($curl_handle) && get_class($curl_handle) === 'CurlHandle')) {
|
||||||
// Determine what's what.
|
// Determine what's what.
|
||||||
$header_size = curl_getinfo($curl_handle, CURLINFO_HEADER_SIZE);
|
$header_size = curl_getinfo($curl_handle, CURLINFO_HEADER_SIZE);
|
||||||
$this->response_headers = substr($this->response, 0, $header_size);
|
$this->response_headers = substr($this->response, 0, $header_size);
|
||||||
|
@ -844,12 +844,13 @@ class RequestCore
|
||||||
$this->response = curl_exec($curl_handle);
|
$this->response = curl_exec($curl_handle);
|
||||||
|
|
||||||
if ($this->response === false) {
|
if ($this->response === false) {
|
||||||
throw new RequestCore_Exception('cURL resource: ' . (string)$curl_handle . '; cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')');
|
throw new RequestCore_Exception('cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
$parsed_response = $this->process_response($curl_handle, $this->response);
|
$parsed_response = $this->process_response($curl_handle, $this->response);
|
||||||
|
|
||||||
curl_close($curl_handle);
|
curl_close($curl_handle);
|
||||||
|
unset($curl_handle);
|
||||||
|
|
||||||
if ($parse) {
|
if ($parse) {
|
||||||
return $parsed_response;
|
return $parsed_response;
|
||||||
|
|
|
@ -2843,10 +2843,10 @@ class OssClient
|
||||||
$non_signable_resource .= $conjunction . $query_string;
|
$non_signable_resource .= $conjunction . $query_string;
|
||||||
$conjunction = '&';
|
$conjunction = '&';
|
||||||
}
|
}
|
||||||
$this->requestUrl = $scheme . $hostname . $resource_uri . $signable_query_string . $non_signable_resource;
|
$requestUrl = $scheme . $hostname . $resource_uri . $signable_query_string . $non_signable_resource;
|
||||||
|
|
||||||
//Creates the request
|
//Creates the request
|
||||||
$request = new RequestCore($this->requestUrl, $this->requestProxy);
|
$request = new RequestCore($requestUrl, $this->requestProxy);
|
||||||
$request->set_useragent($this->generateUserAgent());
|
$request->set_useragent($this->generateUserAgent());
|
||||||
// Streaming uploads
|
// Streaming uploads
|
||||||
if (isset($options[self::OSS_FILE_UPLOAD])) {
|
if (isset($options[self::OSS_FILE_UPLOAD])) {
|
||||||
|
@ -2943,10 +2943,10 @@ class OssClient
|
||||||
$request->add_header('Authorization', 'OSS ' . $this->accessKeyId . ':' . $signature);
|
$request->add_header('Authorization', 'OSS ' . $this->accessKeyId . ':' . $signature);
|
||||||
|
|
||||||
if (isset($options[self::OSS_PREAUTH]) && (integer)$options[self::OSS_PREAUTH] > 0) {
|
if (isset($options[self::OSS_PREAUTH]) && (integer)$options[self::OSS_PREAUTH] > 0) {
|
||||||
$signed_url = $this->requestUrl . $conjunction . self::OSS_URL_ACCESS_KEY_ID . '=' . rawurlencode($this->accessKeyId) . '&' . self::OSS_URL_EXPIRES . '=' . $options[self::OSS_PREAUTH] . '&' . self::OSS_URL_SIGNATURE . '=' . rawurlencode($signature);
|
$signed_url = $requestUrl . $conjunction . self::OSS_URL_ACCESS_KEY_ID . '=' . rawurlencode($this->accessKeyId) . '&' . self::OSS_URL_EXPIRES . '=' . $options[self::OSS_PREAUTH] . '&' . self::OSS_URL_SIGNATURE . '=' . rawurlencode($signature);
|
||||||
return $signed_url;
|
return $signed_url;
|
||||||
} elseif (isset($options[self::OSS_PREAUTH])) {
|
} elseif (isset($options[self::OSS_PREAUTH])) {
|
||||||
return $this->requestUrl;
|
return $requestUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->timeout !== 0) {
|
if ($this->timeout !== 0) {
|
||||||
|
@ -2962,7 +2962,7 @@ class OssClient
|
||||||
throw(new OssException('RequestCoreException: ' . $e->getMessage()));
|
throw(new OssException('RequestCoreException: ' . $e->getMessage()));
|
||||||
}
|
}
|
||||||
$response_header = $request->get_response_header();
|
$response_header = $request->get_response_header();
|
||||||
$response_header['oss-request-url'] = $this->requestUrl;
|
$response_header['oss-request-url'] = $requestUrl;
|
||||||
$response_header['oss-redirects'] = $this->redirects;
|
$response_header['oss-redirects'] = $this->redirects;
|
||||||
$response_header['oss-stringtosign'] = $string_to_sign;
|
$response_header['oss-stringtosign'] = $string_to_sign;
|
||||||
$response_header['oss-requestheaders'] = $request->request_headers;
|
$response_header['oss-requestheaders'] = $request->request_headers;
|
||||||
|
@ -3257,7 +3257,12 @@ class OssClient
|
||||||
|
|
||||||
$queryStringSorted = substr($queryStringSorted, 0, -1);
|
$queryStringSorted = substr($queryStringSorted, 0, -1);
|
||||||
|
|
||||||
return $explodeResult[0] . '?' . $queryStringSorted;
|
$result = '';
|
||||||
|
for ($i = 0; $i < $index -1; $i++)
|
||||||
|
{
|
||||||
|
$result .= $explodeResult[$i] . '?';
|
||||||
|
}
|
||||||
|
return $result . $queryStringSorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3503,8 +3508,8 @@ class OssClient
|
||||||
);
|
);
|
||||||
// OssClient version information
|
// OssClient version information
|
||||||
const OSS_NAME = "aliyun-sdk-php";
|
const OSS_NAME = "aliyun-sdk-php";
|
||||||
const OSS_VERSION = "2.4.1";
|
const OSS_VERSION = "2.4.2";
|
||||||
const OSS_BUILD = "20200929";
|
const OSS_BUILD = "20210604";
|
||||||
const OSS_AUTHOR = "";
|
const OSS_AUTHOR = "";
|
||||||
const OSS_OPTIONS_ORIGIN = 'Origin';
|
const OSS_OPTIONS_ORIGIN = 'Origin';
|
||||||
const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method';
|
const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method';
|
||||||
|
@ -3517,7 +3522,6 @@ class OssClient
|
||||||
|
|
||||||
// user's domain type. It could be one of the four: OSS_HOST_TYPE_NORMAL, OSS_HOST_TYPE_IP, OSS_HOST_TYPE_SPECIAL, OSS_HOST_TYPE_CNAME
|
// user's domain type. It could be one of the four: OSS_HOST_TYPE_NORMAL, OSS_HOST_TYPE_IP, OSS_HOST_TYPE_SPECIAL, OSS_HOST_TYPE_CNAME
|
||||||
private $hostType = self::OSS_HOST_TYPE_NORMAL;
|
private $hostType = self::OSS_HOST_TYPE_NORMAL;
|
||||||
private $requestUrl;
|
|
||||||
private $requestProxy = null;
|
private $requestProxy = null;
|
||||||
private $accessKeyId;
|
private $accessKeyId;
|
||||||
private $accessKeySecret;
|
private $accessKeySecret;
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\AclResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class AclResultTest extends \PHPUnit_Framework_TestCase
|
class AclResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Http\ResponseCore;
|
||||||
use OSS\Result\BodyResult;
|
use OSS\Result\BodyResult;
|
||||||
|
|
||||||
|
|
||||||
class BodyResultTest extends \PHPUnit_Framework_TestCase
|
class BodyResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testParseValid200()
|
public function testParseValid200()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,19 +6,19 @@ require_once __DIR__ . '/Common.php';
|
||||||
|
|
||||||
use OSS\Model\CnameConfig;
|
use OSS\Model\CnameConfig;
|
||||||
|
|
||||||
class BucketCnameTest extends \PHPUnit_Framework_TestCase
|
class BucketCnameTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $bucketName;
|
private $bucketName;
|
||||||
private $client;
|
private $client;
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->client = Common::getOssClient();
|
$this->client = Common::getOssClient();
|
||||||
$this->bucketName = 'php-sdk-test-bucket-' . strval(rand(0, 10000));
|
$this->bucketName = 'php-sdk-test-bucket-' . strval(rand(0, 10000));
|
||||||
$this->client->createBucket($this->bucketName);
|
$this->client->createBucket($this->bucketName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$this->client->deleteBucket($this->bucketName);
|
$this->client->deleteBucket($this->bucketName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use OSS\Model\BucketInfo;
|
||||||
* Class BucketInfoTest
|
* Class BucketInfoTest
|
||||||
* @package OSS\Tests
|
* @package OSS\Tests
|
||||||
*/
|
*/
|
||||||
class BucketInfoTest extends \PHPUnit_Framework_TestCase
|
class BucketInfoTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testConstruct()
|
public function testConstruct()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,12 +7,12 @@ require_once __DIR__ . '/Common.php';
|
||||||
use OSS\Model\LiveChannelConfig;
|
use OSS\Model\LiveChannelConfig;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
class BucketLiveChannelTest extends \PHPUnit_Framework_TestCase
|
class BucketLiveChannelTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $bucketName;
|
private $bucketName;
|
||||||
private $client;
|
private $client;
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->client = Common::getOssClient();
|
$this->client = Common::getOssClient();
|
||||||
$this->bucketName = 'php-sdk-test-rtmp-bucket-name-' . strval(rand(0, 10000));
|
$this->bucketName = 'php-sdk-test-rtmp-bucket-name-' . strval(rand(0, 10000));
|
||||||
|
@ -20,7 +20,7 @@ class BucketLiveChannelTest extends \PHPUnit_Framework_TestCase
|
||||||
Common::waitMetaSync();
|
Common::waitMetaSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
////to delete created bucket
|
////to delete created bucket
|
||||||
//1. delele live channel
|
//1. delele live channel
|
||||||
|
|
|
@ -289,7 +289,7 @@ class CallbackTest extends TestOssClientBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace OSS\Tests;
|
||||||
use OSS\Model\CnameConfig;
|
use OSS\Model\CnameConfig;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
class CnameConfigTest extends \PHPUnit_Framework_TestCase
|
class CnameConfigTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $xml1 = <<<BBBB
|
private $xml1 = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
use OSS\Result\CopyObjectResult;
|
use OSS\Result\CopyObjectResult;
|
||||||
|
|
||||||
class CopyObjectResultTest extends \PHPUnit_Framework_TestCase
|
class CopyObjectResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $body = <<<BBBB
|
private $body = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
@ -45,7 +45,7 @@ BBBB;
|
||||||
new CopyObjectResult($response);
|
new CopyObjectResult($response);
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Model\CorsConfig;
|
||||||
use OSS\Model\CorsRule;
|
use OSS\Model\CorsRule;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
class CorsConfigTest extends \PHPUnit_Framework_TestCase
|
class CorsConfigTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\DeleteObjectVersionsResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class DeleteObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
|
class DeleteObjectVersionsResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Result\ExistResult;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
class ExistResultTest extends \PHPUnit_Framework_TestCase
|
class ExistResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testParseValid200()
|
public function testParseValid200()
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ class ExistResultTest extends \PHPUnit_Framework_TestCase
|
||||||
new ExistResult($response);
|
new ExistResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\GetBucketEncryptionResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class GetBucketEncryptionResultTest extends \PHPUnit_Framework_TestCase
|
class GetBucketEncryptionResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\GetBucketRequestPaymentResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class GetBucketRequestPaymentResultTest extends \PHPUnit_Framework_TestCase
|
class GetBucketRequestPaymentResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\GetBucketStatResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class GetBucketStatResultTest extends \PHPUnit_Framework_TestCase
|
class GetBucketStatResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\GetBucketTagsResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class GetBucketTagsResultTest extends \PHPUnit_Framework_TestCase
|
class GetBucketTagsResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\GetBucketWormResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class GetBucketWormResultTest extends \PHPUnit_Framework_TestCase
|
class GetBucketWormResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Result\GetCorsResult;
|
use OSS\Result\GetCorsResult;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class GetCorsResultTest extends \PHPUnit_Framework_TestCase
|
class GetCorsResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
@ -58,10 +58,10 @@ BBBB;
|
||||||
{
|
{
|
||||||
$response = new ResponseCore(array(), $this->validXml, 300);
|
$response = new ResponseCore(array(), $this->validXml, 300);
|
||||||
try {
|
try {
|
||||||
new GetCorsResult($response);
|
$result = new GetCorsResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Model\LifecycleConfig;
|
use OSS\Model\LifecycleConfig;
|
||||||
use OSS\Result\GetLifecycleResult;
|
use OSS\Result\GetLifecycleResult;
|
||||||
|
|
||||||
class GetLifecycleResultTest extends \PHPUnit_Framework_TestCase
|
class GetLifecycleResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
@ -49,10 +49,10 @@ BBBB;
|
||||||
{
|
{
|
||||||
$response = new ResponseCore(array(), $this->validXml, 300);
|
$response = new ResponseCore(array(), $this->validXml, 300);
|
||||||
try {
|
try {
|
||||||
new GetLifecycleResult($response);
|
$result = new GetLifecycleResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use OSS\Http\ResponseCore;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
|
||||||
class GetLoggingResultTest extends \PHPUnit_Framework_TestCase
|
class GetLoggingResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
@ -42,10 +42,10 @@ BBBB;
|
||||||
{
|
{
|
||||||
$response = new ResponseCore(array(), $this->validXml, 300);
|
$response = new ResponseCore(array(), $this->validXml, 300);
|
||||||
try {
|
try {
|
||||||
new GetLoggingResult($response);
|
$result = new GetLoggingResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Http\ResponseCore;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
|
||||||
class GetRefererResultTest extends \PHPUnit_Framework_TestCase
|
class GetRefererResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
@ -42,10 +42,10 @@ BBBB;
|
||||||
{
|
{
|
||||||
$response = new ResponseCore(array(), $this->validXml, 300);
|
$response = new ResponseCore(array(), $this->validXml, 300);
|
||||||
try {
|
try {
|
||||||
new GetRefererResult($response);
|
$result = new GetRefererResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Result\GetWebsiteResult;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
class GetWebsiteResultTest extends \PHPUnit_Framework_TestCase
|
class GetWebsiteResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
@ -41,10 +41,10 @@ BBBB;
|
||||||
{
|
{
|
||||||
$response = new ResponseCore(array(), $this->validXml, 300);
|
$response = new ResponseCore(array(), $this->validXml, 300);
|
||||||
try {
|
try {
|
||||||
new GetWebsiteResult($response);
|
$result = new GetWebsiteResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ use OSS\Http\ResponseCore;
|
||||||
* Class HeaderResultTest
|
* Class HeaderResultTest
|
||||||
* @package OSS\Tests
|
* @package OSS\Tests
|
||||||
*/
|
*/
|
||||||
class HeaderResultTest extends \PHPUnit_Framework_TestCase
|
class HeaderResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testGetHeader()
|
public function testGetHeader()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Http\ResponseCore;
|
||||||
use OSS\Http\RequestCore_Exception;
|
use OSS\Http\RequestCore_Exception;
|
||||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||||
|
|
||||||
class HttpTest extends \PHPUnit_Framework_TestCase
|
class HttpTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testResponseCore()
|
public function testResponseCore()
|
||||||
|
@ -33,7 +33,7 @@ class HttpTest extends \PHPUnit_Framework_TestCase
|
||||||
$httpResponse = $httpCore->send_request();
|
$httpResponse = $httpCore->send_request();
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (RequestCore_Exception $e) {
|
} catch (RequestCore_Exception $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Result\InitiateMultipartUploadResult;
|
use OSS\Result\InitiateMultipartUploadResult;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class InitiateMultipartUploadResultTest extends \PHPUnit_Framework_TestCase
|
class InitiateMultipartUploadResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
@ -41,7 +41,7 @@ BBBB;
|
||||||
$result = new InitiateMultipartUploadResult($response);
|
$result = new InitiateMultipartUploadResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Model\LifecycleAction;
|
||||||
use OSS\Model\LifecycleConfig;
|
use OSS\Model\LifecycleConfig;
|
||||||
use OSS\Model\LifecycleRule;
|
use OSS\Model\LifecycleRule;
|
||||||
|
|
||||||
class LifecycleConfigTest extends \PHPUnit_Framework_TestCase
|
class LifecycleConfigTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validLifecycle = <<<BBBB
|
private $validLifecycle = <<<BBBB
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
use OSS\Result\ListBucketsResult;
|
use OSS\Result\ListBucketsResult;
|
||||||
|
|
||||||
class ListBucketsResultTest extends \PHPUnit_Framework_TestCase
|
class ListBucketsResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
|
@ -9,7 +9,7 @@ use OSS\Http\ResponseCore;
|
||||||
* Class ListMultipartUploadResultTest
|
* Class ListMultipartUploadResultTest
|
||||||
* @package OSS\Tests
|
* @package OSS\Tests
|
||||||
*/
|
*/
|
||||||
class ListMultipartUploadResultTest extends \PHPUnit_Framework_TestCase
|
class ListMultipartUploadResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Result\ListObjectVersionsResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class ListObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
|
class ListObjectVersionsResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
@ -202,6 +202,7 @@ class ListObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
|
||||||
$response = new ResponseCore(array(), "", 200);
|
$response = new ResponseCore(array(), "", 200);
|
||||||
$result = new ListObjectVersionsResult($response);
|
$result = new ListObjectVersionsResult($response);
|
||||||
$list = $result->getData();
|
$list = $result->getData();
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParseInvalidXml()
|
public function testParseInvalidXml()
|
||||||
|
@ -209,5 +210,6 @@ class ListObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
|
||||||
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
$result = new ListObjectVersionsResult($response);
|
$result = new ListObjectVersionsResult($response);
|
||||||
$stat = $result->getData();
|
$stat = $result->getData();
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace OSS\Tests;
|
||||||
use OSS\Result\ListObjectsResult;
|
use OSS\Result\ListObjectsResult;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class ListObjectsResultTest extends \PHPUnit_Framework_TestCase
|
class ListObjectsResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml1 = <<<BBBB
|
private $validXml1 = <<<BBBB
|
||||||
|
|
|
@ -9,7 +9,7 @@ use OSS\Http\ResponseCore;
|
||||||
* Class ListPartsResultTest
|
* Class ListPartsResultTest
|
||||||
* @package OSS\Tests
|
* @package OSS\Tests
|
||||||
*/
|
*/
|
||||||
class ListPartsResultTest extends \PHPUnit_Framework_TestCase
|
class ListPartsResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
|
@ -12,7 +12,7 @@ use OSS\Model\GetLiveChannelStatus;
|
||||||
use OSS\Model\GetLiveChannelHistory;
|
use OSS\Model\GetLiveChannelHistory;
|
||||||
use OSS\Model\LiveChannelHistory;
|
use OSS\Model\LiveChannelHistory;
|
||||||
|
|
||||||
class LiveChannelXmlTest extends \PHPUnit_Framework_TestCase
|
class LiveChannelXmlTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $config = <<<BBBB
|
private $config = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
use OSS\Model\LoggingConfig;
|
use OSS\Model\LoggingConfig;
|
||||||
|
|
||||||
class LoggingConfigTest extends \PHPUnit_Framework_TestCase
|
class LoggingConfigTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
use OSS\Core\MimeTypes;
|
use OSS\Core\MimeTypes;
|
||||||
|
|
||||||
class MimeTypesTest extends \PHPUnit_Framework_TestCase
|
class MimeTypesTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testGetMimeType()
|
public function testGetMimeType()
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,7 +98,7 @@ class OssClientBucketTest extends TestOssClientBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class OssClientBucketTest extends TestOssClientBase
|
||||||
$this->ossClient->createBucket($this->standardBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
$this->ossClient->createBucket($this->standardBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class OssClinetImageTest extends TestOssClientBase
|
||||||
private $object;
|
private $object;
|
||||||
private $download_file;
|
private $download_file;
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class OssClinetImageTest extends TestOssClientBase
|
||||||
$this->client->uploadFile($this->bucketName, $this->object, $this->local_file);
|
$this->client->uploadFile($this->bucketName, $this->object, $this->local_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
unlink($this->download_file);
|
unlink($this->download_file);
|
||||||
|
|
|
@ -145,7 +145,7 @@ class OssClientListObjectsTest extends TestOssClientBase
|
||||||
$this->assertEquals("true", $listObjectInfo->getIsTruncated());
|
$this->assertEquals("true", $listObjectInfo->getIsTruncated());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
//folder
|
//folder
|
||||||
|
@ -177,7 +177,7 @@ class OssClientListObjectsTest extends TestOssClientBase
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,6 +330,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
|
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
|
||||||
|
$this->assertFalse(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -343,6 +344,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
|
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
|
||||||
|
$this->assertFalse(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -385,6 +387,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->ossClient->multiuploadFile($this->bucket, $object, $file);
|
$this->ossClient->multiuploadFile($this->bucket, $object, $file);
|
||||||
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
if (strpos($e, "parameter invalid, file is empty") == false)
|
if (strpos($e, "parameter invalid, file is empty") == false)
|
||||||
|
|
|
@ -426,6 +426,7 @@ class OssClientObjectRequestPaymentTest extends TestOssClientBase
|
||||||
$object = 'mpu/multipart-bigfile-test.tmp';
|
$object = 'mpu/multipart-bigfile-test.tmp';
|
||||||
try {
|
try {
|
||||||
$this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, $options);
|
$this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -446,7 +447,7 @@ class OssClientObjectRequestPaymentTest extends TestOssClientBase
|
||||||
unlink($bigFileName);
|
unlink($bigFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->payerClient = new OssClient(
|
$this->payerClient = new OssClient(
|
||||||
|
@ -464,7 +465,7 @@ class OssClientObjectRequestPaymentTest extends TestOssClientBase
|
||||||
$this->ossClient->putSymlink($this->bucket, "default-symlink", "default-object");
|
$this->ossClient->putSymlink($this->bucket, "default-symlink", "default-object");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,7 +664,116 @@ class OssClientObjectTest extends TestOssClientBase
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
public function testObjectKeyWithQuestionMark()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Upload the local variable to bucket
|
||||||
|
*/
|
||||||
|
$object = "oss-php-sdk-test/??/upload-test-object-name???123??123??.txt";
|
||||||
|
$content = file_get_contents(__FILE__);
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_LENGTH => strlen($content),
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
'Expires' => 'Fri, 28 Feb 2020 05:38:42 GMT',
|
||||||
|
'Cache-Control' => 'no-cache',
|
||||||
|
'Content-Disposition' => 'attachment;filename=oss_download.log',
|
||||||
|
'Content-Language' => 'zh-CN',
|
||||||
|
'x-oss-server-side-encryption' => 'AES256',
|
||||||
|
'x-oss-meta-self-define-title' => 'user define meta info',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putObject($this->bucket, $object, $content, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putObject($this->bucket, $object, $content, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetObject to the local variable and check for match
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$content = $this->ossClient->getObject($this->bucket, $object);
|
||||||
|
$this->assertEquals($content, file_get_contents(__FILE__));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetObject first five bytes
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$options = array(OssClient::OSS_RANGE => '0-4');
|
||||||
|
$content = $this->ossClient->getObject($this->bucket, $object, $options);
|
||||||
|
$this->assertEquals($content, '<?php');
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload the local file to object
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$this->ossClient->uploadFile($this->bucket, $object, __FILE__);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download the file to the local variable and check for match.
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$content = $this->ossClient->getObject($this->bucket, $object);
|
||||||
|
$this->assertEquals($content, file_get_contents(__FILE__));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy object
|
||||||
|
*/
|
||||||
|
$to_bucket = $this->bucket;
|
||||||
|
$to_object = $object . '.copy';
|
||||||
|
$options = array();
|
||||||
|
try {
|
||||||
|
$result = $this->ossClient->copyObject($this->bucket, $object, $to_bucket, $to_object, $options);
|
||||||
|
$this->assertFalse(empty($result));
|
||||||
|
$this->assertEquals(strlen("2016-11-21T03:46:58.000Z"), strlen($result[0]));
|
||||||
|
$this->assertEquals(strlen("\"5B3C1A2E053D763E1B002CC607C5A0FE\""), strlen($result[1]));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the replication is the same
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$content = $this->ossClient->getObject($this->bucket, $to_object);
|
||||||
|
$this->assertEquals($content, file_get_contents(__FILE__));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object));
|
||||||
|
$this->ossClient->deleteObject($this->bucket, $object);
|
||||||
|
$this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->ossClient->putObject($this->bucket, 'oss-php-sdk-test/upload-test-object-name.txt', file_get_contents(__FILE__));
|
$this->ossClient->putObject($this->bucket, 'oss-php-sdk-test/upload-test-object-name.txt', file_get_contents(__FILE__));
|
||||||
|
|
|
@ -569,7 +569,7 @@ class OssClientObjectVersioningTest extends TestOssClientBase
|
||||||
$this->assertEquals(0, count($deleteMarkerList));
|
$this->assertEquals(0, count($deleteMarkerList));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ class OssClientObjectVersioningTest extends TestOssClientBase
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
if (!$this->ossClient->doesBucketExist($this->bucket)) {
|
if (!$this->ossClient->doesBucketExist($this->bucket)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -141,7 +141,7 @@ class OssClientRestoreObjectTest extends TestOssClientBase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class OssClientRestoreObjectTest extends TestOssClientBase
|
||||||
$this->ossClient->createBucket($this->archiveBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
$this->ossClient->createBucket($this->archiveBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
|
|
|
@ -131,13 +131,13 @@ class OssClientSignatureTest extends TestOssClientBase
|
||||||
$this->assertTrue(strpos($signedUrl1, 'Expires='.$expiration) !== false);
|
$this->assertTrue(strpos($signedUrl1, 'Expires='.$expiration) !== false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$this->ossClient->deleteObject($this->bucket, "a.file");
|
$this->ossClient->deleteObject($this->bucket, "a.file");
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -111,7 +111,7 @@ class OssClientTest extends TestOssClientBase
|
||||||
$ossClient->listBuckets();
|
$ossClient->listBuckets();
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ class OssClientTest extends TestOssClientBase
|
||||||
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
||||||
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
||||||
$ossClient->listBuckets();
|
$ossClient->listBuckets();
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -196,6 +197,7 @@ class OssClientTest extends TestOssClientBase
|
||||||
try {
|
try {
|
||||||
$object='test-dir';
|
$object='test-dir';
|
||||||
$ossClient->createObjectDir($bucket,$object);
|
$ossClient->createObjectDir($bucket,$object);
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +206,7 @@ class OssClientTest extends TestOssClientBase
|
||||||
$object='0';
|
$object='0';
|
||||||
$ossClient->createObjectDir($bucket,$object);
|
$ossClient->createObjectDir($bucket,$object);
|
||||||
$ossClient->putObject($bucket,$object, '');
|
$ossClient->putObject($bucket,$object, '');
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
var_dump($e);
|
var_dump($e);
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
|
@ -219,6 +222,7 @@ class OssClientTest extends TestOssClientBase
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = getenv('OSS_BUCKET');
|
||||||
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
||||||
$ossClient->getBucketCors($bucket);
|
$ossClient->getBucketCors($bucket);
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -233,6 +237,7 @@ class OssClientTest extends TestOssClientBase
|
||||||
$bucket = $this->bucket;
|
$bucket = $this->bucket;
|
||||||
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
||||||
$ossClient->getBucketCname($bucket);
|
$ossClient->getBucketCname($bucket);
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
class OssExceptionTest extends \PHPUnit_Framework_TestCase
|
class OssExceptionTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testOSS_exception()
|
public function testOSS_exception()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Core\OssUtil;
|
use OSS\Core\OssUtil;
|
||||||
use OSS\OssClient;
|
use OSS\OssClient;
|
||||||
|
|
||||||
class OssUtilTest extends \PHPUnit_Framework_TestCase
|
class OssUtilTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testIsChinese()
|
public function testIsChinese()
|
||||||
{
|
{
|
||||||
|
@ -147,10 +147,10 @@ BBBB;
|
||||||
$this->assertNotNull($list);
|
$this->assertNotNull($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsWin()
|
//public function testIsWin()
|
||||||
{
|
//{
|
||||||
//$this->assertTrue(OssUtil::isWin());
|
// //$this->assertTrue(OssUtil::isWin());
|
||||||
}
|
//}
|
||||||
|
|
||||||
public function testGetMd5SumForFile()
|
public function testGetMd5SumForFile()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
use OSS\Result\PutSetDeleteResult;
|
use OSS\Result\PutSetDeleteResult;
|
||||||
|
|
||||||
class ResultTest extends \PHPUnit_Framework_TestCase
|
class ResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testNullResponse()
|
public function testNullResponse()
|
||||||
|
@ -50,16 +50,16 @@ class ResultTest extends \PHPUnit_Framework_TestCase
|
||||||
new PutSetDeleteResult($response);
|
new PutSetDeleteResult($response);
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
use OSS\Model\RefererConfig;
|
use OSS\Model\RefererConfig;
|
||||||
|
|
||||||
class RefererConfigTest extends \PHPUnit_Framework_TestCase
|
class RefererConfigTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace OSS\Tests;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\Model\StorageCapacityConfig;
|
use OSS\Model\StorageCapacityConfig;
|
||||||
|
|
||||||
class StorageCapacityConfigTest extends \PHPUnit_Framework_TestCase
|
class StorageCapacityConfigTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml_10 = <<<BBBB
|
private $validXml_10 = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Model\StorageCapacityConfig;
|
||||||
use OSS\Result\GetStorageCapacityResult;
|
use OSS\Result\GetStorageCapacityResult;
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
class StorageCapacityTest extends \PHPUnit_Framework_TestCase
|
class StorageCapacityTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $inValidXml = <<<BBBB
|
private $inValidXml = <<<BBBB
|
||||||
|
@ -29,7 +29,9 @@ BBBB;
|
||||||
try {
|
try {
|
||||||
new GetStorageCapacityResult($response);
|
new GetStorageCapacityResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {}
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParseEmptyXml()
|
public function testParseEmptyXml()
|
||||||
|
@ -38,7 +40,9 @@ BBBB;
|
||||||
try {
|
try {
|
||||||
new GetStorageCapacityResult($response);
|
new GetStorageCapacityResult($response);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
} catch (OssException $e) {}
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParseValidXml()
|
public function testParseValidXml()
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\OssClient;
|
||||||
|
|
||||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Common.php';
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Common.php';
|
||||||
|
|
||||||
class TestOssClientBase extends \PHPUnit_Framework_TestCase
|
class TestOssClientBase extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var OssClient
|
* @var OssClient
|
||||||
|
@ -18,7 +18,7 @@ class TestOssClientBase extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
protected $bucket;
|
protected $bucket;
|
||||||
|
|
||||||
public function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->bucket = Common::getBucketName() .'-'. time();
|
$this->bucket = Common::getBucketName() .'-'. time();
|
||||||
$this->ossClient = Common::getOssClient();
|
$this->ossClient = Common::getOssClient();
|
||||||
|
@ -26,7 +26,7 @@ class TestOssClientBase extends \PHPUnit_Framework_TestCase
|
||||||
Common::waitMetaSync();
|
Common::waitMetaSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
if (!$this->ossClient->doesBucketExist($this->bucket)) {
|
if (!$this->ossClient->doesBucketExist($this->bucket)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,7 +7,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\Result\UploadPartResult;
|
use OSS\Result\UploadPartResult;
|
||||||
use OSS\Http\ResponseCore;
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
class UploadPartResultTest extends \PHPUnit_Framework_TestCase
|
class UploadPartResultTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validHeader = array('etag' => '7265F4D211B56873A381D321F586E4A9');
|
private $validHeader = array('etag' => '7265F4D211B56873A381D321F586E4A9');
|
||||||
private $invalidHeader = array();
|
private $invalidHeader = array();
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
use OSS\Model\WebsiteConfig;
|
use OSS\Model\WebsiteConfig;
|
||||||
|
|
||||||
class WebsiteConfigTest extends \PHPUnit_Framework_TestCase
|
class WebsiteConfigTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
private $validXml = <<<BBBB
|
private $validXml = <<<BBBB
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
|
@ -42,6 +42,8 @@ namespace Composer\Autoload;
|
||||||
*/
|
*/
|
||||||
class ClassLoader
|
class ClassLoader
|
||||||
{
|
{
|
||||||
|
private $vendorDir;
|
||||||
|
|
||||||
// PSR-4
|
// PSR-4
|
||||||
private $prefixLengthsPsr4 = array();
|
private $prefixLengthsPsr4 = array();
|
||||||
private $prefixDirsPsr4 = array();
|
private $prefixDirsPsr4 = array();
|
||||||
|
@ -57,6 +59,13 @@ class ClassLoader
|
||||||
private $missingClasses = array();
|
private $missingClasses = array();
|
||||||
private $apcuPrefix;
|
private $apcuPrefix;
|
||||||
|
|
||||||
|
private static $registeredLoaders = array();
|
||||||
|
|
||||||
|
public function __construct($vendorDir = null)
|
||||||
|
{
|
||||||
|
$this->vendorDir = $vendorDir;
|
||||||
|
}
|
||||||
|
|
||||||
public function getPrefixes()
|
public function getPrefixes()
|
||||||
{
|
{
|
||||||
if (!empty($this->prefixesPsr0)) {
|
if (!empty($this->prefixesPsr0)) {
|
||||||
|
@ -300,6 +309,17 @@ class ClassLoader
|
||||||
public function register($prepend = false)
|
public function register($prepend = false)
|
||||||
{
|
{
|
||||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
|
||||||
|
if (null === $this->vendorDir) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prepend) {
|
||||||
|
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||||
|
} else {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,6 +328,10 @@ class ClassLoader
|
||||||
public function unregister()
|
public function unregister()
|
||||||
{
|
{
|
||||||
spl_autoload_unregister(array($this, 'loadClass'));
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
|
||||||
|
if (null !== $this->vendorDir) {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,6 +391,16 @@ class ClassLoader
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||||
|
*
|
||||||
|
* @return self[]
|
||||||
|
*/
|
||||||
|
public static function getRegisteredLoaders()
|
||||||
|
{
|
||||||
|
return self::$registeredLoaders;
|
||||||
|
}
|
||||||
|
|
||||||
private function findFileWithExtension($class, $ext)
|
private function findFileWithExtension($class, $ext)
|
||||||
{
|
{
|
||||||
// PSR-4 lookup
|
// PSR-4 lookup
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Composer;
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
use Composer\Semver\VersionParser;
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +20,8 @@ use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class InstalledVersions
|
class InstalledVersions
|
||||||
{
|
{
|
||||||
private static $installed = array (
|
private static $installed = array (
|
||||||
|
@ -19,7 +32,7 @@ private static $installed = array (
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
'reference' => '0504b56a0d240e8ffa6c342073277a83898c68fd',
|
||||||
'name' => '__root__',
|
'name' => '__root__',
|
||||||
),
|
),
|
||||||
'versions' =>
|
'versions' =>
|
||||||
|
@ -31,19 +44,21 @@ private static $installed = array (
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
'reference' => '0504b56a0d240e8ffa6c342073277a83898c68fd',
|
||||||
),
|
),
|
||||||
'aliyuncs/oss-sdk-php' =>
|
'aliyuncs/oss-sdk-php' =>
|
||||||
array (
|
array (
|
||||||
'pretty_version' => 'v2.4.1',
|
'pretty_version' => 'v2.4.2',
|
||||||
'version' => '2.4.1.0',
|
'version' => '2.4.2.0',
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => '492866331b7bafaac09506cf42f351b7e9e63766',
|
'reference' => '0c9d902c33847c07efc66c4cdf823deaea8fc2b6',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
private static $canGetVendors;
|
||||||
|
private static $installedByVendor = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +68,16 @@ private static $installed = array (
|
||||||
|
|
||||||
public static function getInstalledPackages()
|
public static function getInstalledPackages()
|
||||||
{
|
{
|
||||||
return array_keys(self::$installed['versions']);
|
$packages = array();
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
$packages[] = array_keys($installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 === \count($packages)) {
|
||||||
|
return $packages[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +90,13 @@ return array_keys(self::$installed['versions']);
|
||||||
|
|
||||||
public static function isInstalled($packageName)
|
public static function isInstalled($packageName)
|
||||||
{
|
{
|
||||||
return isset(self::$installed['versions'][$packageName]);
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (isset($installed['versions'][$packageName])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,42 +131,50 @@ return $provided->matches($constraint);
|
||||||
|
|
||||||
public static function getVersionRanges($packageName)
|
public static function getVersionRanges($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ranges = array();
|
$ranges = array();
|
||||||
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||||
}
|
}
|
||||||
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||||
}
|
}
|
||||||
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||||
}
|
}
|
||||||
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(' || ', $ranges);
|
return implode(' || ', $ranges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function getVersion($packageName)
|
public static function getVersion($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$installed['versions'][$packageName]['version'];
|
return $installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,15 +183,19 @@ return self::$installed['versions'][$packageName]['version'];
|
||||||
|
|
||||||
public static function getPrettyVersion($packageName)
|
public static function getPrettyVersion($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$installed['versions'][$packageName]['pretty_version'];
|
return $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,15 +204,19 @@ return self::$installed['versions'][$packageName]['pretty_version'];
|
||||||
|
|
||||||
public static function getReference($packageName)
|
public static function getReference($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$installed['versions'][$packageName]['reference'];
|
return $installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,7 +225,9 @@ return self::$installed['versions'][$packageName]['reference'];
|
||||||
|
|
||||||
public static function getRootPackage()
|
public static function getRootPackage()
|
||||||
{
|
{
|
||||||
return self::$installed['root'];
|
$installed = self::getInstalled();
|
||||||
|
|
||||||
|
return $installed[0]['root'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,5 +262,33 @@ return self::$installed;
|
||||||
public static function reload($data)
|
public static function reload($data)
|
||||||
{
|
{
|
||||||
self::$installed = $data;
|
self::$installed = $data;
|
||||||
|
self::$installedByVendor = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static function getInstalled()
|
||||||
|
{
|
||||||
|
if (null === self::$canGetVendors) {
|
||||||
|
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed = array();
|
||||||
|
|
||||||
|
if (self::$canGetVendors) {
|
||||||
|
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||||
|
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir];
|
||||||
|
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed[] = self::$installed;
|
||||||
|
|
||||||
|
return $installed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382
|
||||||
require __DIR__ . '/platform_check.php';
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
|
|
|
@ -2,17 +2,17 @@
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aliyuncs/oss-sdk-php",
|
"name": "aliyuncs/oss-sdk-php",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.2",
|
||||||
"version_normalized": "2.4.1.0",
|
"version_normalized": "2.4.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
||||||
"reference": "492866331b7bafaac09506cf42f351b7e9e63766"
|
"reference": "0c9d902c33847c07efc66c4cdf823deaea8fc2b6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/492866331b7bafaac09506cf42f351b7e9e63766",
|
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/0c9d902c33847c07efc66c4cdf823deaea8fc2b6",
|
||||||
"reference": "492866331b7bafaac09506cf42f351b7e9e63766",
|
"reference": "0c9d902c33847c07efc66c4cdf823deaea8fc2b6",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
|
@ -25,10 +25,10 @@
|
||||||
"php": ">=5.3"
|
"php": ">=5.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "*",
|
||||||
"satooshi/php-coveralls": "~1.0"
|
"satooshi/php-coveralls": "*"
|
||||||
},
|
},
|
||||||
"time": "2020-09-29T06:23:57+00:00",
|
"time": "2021-06-04T06:55:06+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
"homepage": "http://www.aliyun.com/product/oss/",
|
"homepage": "http://www.aliyun.com/product/oss/",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
|
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
|
||||||
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.4.1"
|
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.4.2"
|
||||||
},
|
},
|
||||||
"install-path": "../aliyuncs/oss-sdk-php"
|
"install-path": "../aliyuncs/oss-sdk-php"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
'reference' => '0504b56a0d240e8ffa6c342073277a83898c68fd',
|
||||||
'name' => '__root__',
|
'name' => '__root__',
|
||||||
),
|
),
|
||||||
'versions' =>
|
'versions' =>
|
||||||
|
@ -18,16 +18,16 @@
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
'reference' => '0504b56a0d240e8ffa6c342073277a83898c68fd',
|
||||||
),
|
),
|
||||||
'aliyuncs/oss-sdk-php' =>
|
'aliyuncs/oss-sdk-php' =>
|
||||||
array (
|
array (
|
||||||
'pretty_version' => 'v2.4.1',
|
'pretty_version' => 'v2.4.2',
|
||||||
'version' => '2.4.1.0',
|
'version' => '2.4.2.0',
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => '492866331b7bafaac09506cf42f351b7e9e63766',
|
'reference' => '0c9d902c33847c07efc66c4cdf823deaea8fc2b6',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue