suyuan/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketRequestPayme...

52 lines
1.5 KiB
PHP
Raw Normal View History

2023-10-14 13:36:39 +08:00
<?php
namespace OSS\Tests;
use OSS\Core\OssException;
use OSS\Model\RequestPaymentConfig;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
class OssClientBucketRequestPaymentTest extends TestOssClientBase
{
public function testBucket()
{
try {
Common::waitMetaSync();
$payer = $this->ossClient->getBucketRequestPayment($this->bucket);
$this->assertEquals("BucketOwner", $payer);
} catch (OssException $e) {
$this->assertTrue(false);
}
try {
$this->ossClient->putBucketRequestPayment($this->bucket, "Requester");
} catch (OssException $e) {
var_dump($e->getMessage());
$this->assertTrue(false);
}
try {
Common::waitMetaSync();
$payer = $this->ossClient->getBucketRequestPayment($this->bucket);
$this->assertEquals("Requester", $payer);
} catch (OssException $e) {
$this->assertTrue(false);
}
try {
$this->ossClient->putBucketRequestPayment($this->bucket, "BucketOwner");
} catch (OssException $e) {
var_dump($e->getMessage());
$this->assertTrue(false);
}
try {
Common::waitMetaSync();
$payer = $this->ossClient->getBucketRequestPayment($this->bucket);
$this->assertEquals("BucketOwner", $payer);
} catch (OssException $e) {
$this->assertTrue(false);
}
}
}