AES256
BBBB;
private $validXml1 = <<
KMS
kms-id
BBBB;
private $validXml2 = <<
KMS
BBBB;
private $invalidXml = <<
BBBB;
public function testParseValidXml()
{
$response = new ResponseCore(array(), $this->validXml, 200);
$result = new GetBucketEncryptionResult($response);
$this->assertTrue($result->isOK());
$this->assertNotNull($result->getData());
$this->assertNotNull($result->getRawResponse());
$config = $result->getData();
$this->assertEquals("AES256", $config->getSSEAlgorithm());
$this->assertEquals("", $config->getKMSMasterKeyID());
$response = new ResponseCore(array(), $this->validXml1, 200);
$result = new GetBucketEncryptionResult($response);
$this->assertTrue($result->isOK());
$this->assertNotNull($result->getData());
$this->assertNotNull($result->getRawResponse());
$config = $result->getData();
$this->assertEquals("KMS", $config->getSSEAlgorithm());
$this->assertEquals("kms-id", $config->getKMSMasterKeyID());
$response = new ResponseCore(array(), $this->validXml2, 200);
$result = new GetBucketEncryptionResult($response);
$this->assertTrue($result->isOK());
$this->assertNotNull($result->getData());
$this->assertNotNull($result->getRawResponse());
$config = $result->getData();
$this->assertEquals("KMS", $config->getSSEAlgorithm());
$this->assertEquals(null, $config->getKMSMasterKeyID());
}
public function testParseNullXml()
{
$response = new ResponseCore(array(), "", 200);
$result = new GetBucketEncryptionResult($response);
$config = $result->getData();
$this->assertEquals(null, $config->getSSEAlgorithm());
$this->assertEquals(null, $config->getKMSMasterKeyID());
}
public function testParseInvalidXml()
{
$response = new ResponseCore(array(), $this->invalidXml, 200);
$result = new GetBucketEncryptionResult($response);
$config = $result->getData();
$this->assertEquals(null, $config->getSSEAlgorithm());
$this->assertEquals(null, $config->getKMSMasterKeyID());
}
}