begin of thinksaas 3.68

Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
2023-06-22 13:33:25 +08:00
commit 963ec1b2ea
2746 changed files with 331806 additions and 0 deletions
@@ -0,0 +1,59 @@
<?php
namespace OSS\Tests;
use OSS\Result\AclResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class AclResultTest extends \PHPUnit_Framework_TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" ?>
<AccessControlPolicy>
<Owner>
<ID>00220120222</ID>
<DisplayName>user_example</DisplayName>
</Owner>
<AccessControlList>
<Grant>public-read</Grant>
</AccessControlList>
</AccessControlPolicy>
BBBB;
private $invalidXml = <<<BBBB
<?xml version="1.0" ?>
<AccessControlPolicy>
</AccessControlPolicy>
BBBB;
public function testParseValidXml()
{
$response = new ResponseCore(array(), $this->validXml, 200);
$result = new AclResult($response);
$this->assertEquals("public-read", $result->getData());
}
public function testParseNullXml()
{
$response = new ResponseCore(array(), "", 200);
try {
new AclResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertEquals('body is null', $e->getMessage());
}
}
public function testParseInvalidXml()
{
$response = new ResponseCore(array(), $this->invalidXml, 200);
try {
new AclResult($response);
$this->assertFalse(true);
} catch (OssException $e) {
$this->assertEquals("xml format exception", $e->getMessage());
}
}
}