添加网站文件

This commit is contained in:
2025-12-22 13:59:40 +08:00
commit 117aaf83d1
19468 changed files with 2111999 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<?php
namespace OSS\Tests;
use OSS\Result\GetBucketStatResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class GetBucketStatResultTest extends \PHPUnit_Framework_TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" ?>
<BucketStat>
<Storage>100</Storage>
<ObjectCount>200</ObjectCount>
<MultipartUploadCount>10</MultipartUploadCount>
</BucketStat>
BBBB;
private $invalidXml = <<<BBBB
<?xml version="1.0" ?>
<BucketStat>
</BucketStat>
BBBB;
public function testParseValidXml()
{
$response = new ResponseCore(array(), $this->validXml, 200);
$result = new GetBucketStatResult($response);
$this->assertTrue($result->isOK());
$this->assertNotNull($result->getData());
$this->assertNotNull($result->getRawResponse());
$stat = $result->getData();
$this->assertEquals(100, $stat->getStorage());
$this->assertEquals(200, $stat->getObjectCount());
$this->assertEquals(10, $stat->getMultipartUploadCount());
}
public function testParseNullXml()
{
$response = new ResponseCore(array(), "", 200);
$result = new GetBucketStatResult($response);
$stat = $result->getData();
$this->assertEquals(0, $stat->getStorage());
$this->assertEquals(0, $stat->getObjectCount());
$this->assertEquals(0, $stat->getMultipartUploadCount());
}
public function testParseInvalidXml()
{
$response = new ResponseCore(array(), $this->invalidXml, 200);
$result = new GetBucketStatResult($response);
$stat = $result->getData();
$this->assertEquals(0, $stat->getStorage());
$this->assertEquals(0, $stat->getObjectCount());
$this->assertEquals(0, $stat->getMultipartUploadCount());
}
}