demo.jpg CAEQNRiBgICEoPiC0BYiIGMxZWJmYmMzYjE0OTQ0ZmZhYjgzNzkzYjc2NjZk**** true 111111 BBBB; private $validXml1 = << multipart.data CAEQNRiBgIDyz.6C0BYiIGQ2NWEwNmVhNTA3ZTQ3MzM5ODliYjM1ZTdjYjA4**** BBBB; private $validXml2 = << multipart.data true CAEQMhiBgIDXiaaB0BYiIGQzYmRkZGUxMTM1ZDRjOTZhNjk4YjRjMTAyZjhl**** test.jpg true CAEQMhiBgIDB3aWB0BYiIGUzYTA3YzliMzVmNzRkZGM5NjllYTVlMjYyYWEy**** BBBB; private $validXml3 = << multipart.data test.jpg demo.jpg BBBB; private $validXml4 = << url multipart%2F.data test%2F.jpg demo%2F.jpg BBBB; private $invalidXml = << BBBB; public function testParseValidXml() { $response = new ResponseCore(array(), $this->validXml, 200); $result = new DeleteObjectVersionsResult($response); $this->assertTrue($result->isOK()); $this->assertNotNull($result->getData()); $this->assertNotNull($result->getRawResponse()); $list = $result->getData(); $this->assertEquals(1, count($list)); $this->assertEquals('demo.jpg', $list[0]->getKey()); $this->assertEquals('CAEQNRiBgICEoPiC0BYiIGMxZWJmYmMzYjE0OTQ0ZmZhYjgzNzkzYjc2NjZk****', $list[0]->getVersionId()); $this->assertEquals('true', $list[0]->getDeleteMarker()); $this->assertEquals('111111', $list[0]->getDeleteMarkerVersionId()); $response = new ResponseCore(array(), $this->validXml1, 200); $result = new DeleteObjectVersionsResult($response); $this->assertTrue($result->isOK()); $this->assertNotNull($result->getData()); $this->assertNotNull($result->getRawResponse()); $list = $result->getData(); $this->assertEquals(1, count($list)); $this->assertEquals('multipart.data', $list[0]->getKey()); $this->assertEquals('CAEQNRiBgIDyz.6C0BYiIGQ2NWEwNmVhNTA3ZTQ3MzM5ODliYjM1ZTdjYjA4****', $list[0]->getVersionId()); $this->assertEquals('', $list[0]->getDeleteMarker()); $this->assertEquals('', $list[0]->getDeleteMarkerVersionId()); $response = new ResponseCore(array(), $this->validXml2, 200); $result = new DeleteObjectVersionsResult($response); $this->assertTrue($result->isOK()); $this->assertNotNull($result->getData()); $this->assertNotNull($result->getRawResponse()); $list = $result->getData(); $this->assertEquals(2, count($list)); $this->assertEquals('multipart.data', $list[0]->getKey()); $this->assertEquals('', $list[0]->getVersionId()); $this->assertEquals('true', $list[0]->getDeleteMarker()); $this->assertEquals('CAEQMhiBgIDXiaaB0BYiIGQzYmRkZGUxMTM1ZDRjOTZhNjk4YjRjMTAyZjhl****', $list[0]->getDeleteMarkerVersionId()); $this->assertEquals('test.jpg', $list[1]->getKey()); $this->assertEquals('', $list[1]->getVersionId()); $this->assertEquals('true', $list[1]->getDeleteMarker()); $this->assertEquals('CAEQMhiBgIDB3aWB0BYiIGUzYTA3YzliMzVmNzRkZGM5NjllYTVlMjYyYWEy****', $list[1]->getDeleteMarkerVersionId()); $response = new ResponseCore(array(), $this->validXml3, 200); $result = new DeleteObjectVersionsResult($response); $this->assertTrue($result->isOK()); $this->assertNotNull($result->getData()); $this->assertNotNull($result->getRawResponse()); $list = $result->getData(); $this->assertEquals(3, count($list)); $this->assertEquals('multipart.data', $list[0]->getKey()); $this->assertEquals('', $list[0]->getVersionId()); $this->assertEquals('', $list[0]->getDeleteMarker()); $this->assertEquals('', $list[0]->getDeleteMarkerVersionId()); $this->assertEquals('test.jpg', $list[1]->getKey()); $this->assertEquals('', $list[1]->getVersionId()); $this->assertEquals('', $list[1]->getDeleteMarker()); $this->assertEquals('', $list[1]->getDeleteMarkerVersionId()); $this->assertEquals('demo.jpg', $list[2]->getKey()); $this->assertEquals('', $list[2]->getVersionId()); $this->assertEquals('', $list[2]->getDeleteMarker()); $this->assertEquals('', $list[2]->getDeleteMarkerVersionId()); $response = new ResponseCore(array(), $this->validXml4, 200); $result = new DeleteObjectVersionsResult($response); $this->assertTrue($result->isOK()); $this->assertNotNull($result->getData()); $this->assertNotNull($result->getRawResponse()); $list = $result->getData(); $this->assertEquals(3, count($list)); $this->assertEquals('multipart/.data', $list[0]->getKey()); $this->assertEquals('', $list[0]->getVersionId()); $this->assertEquals('', $list[0]->getDeleteMarker()); $this->assertEquals('', $list[0]->getDeleteMarkerVersionId()); $this->assertEquals('test/.jpg', $list[1]->getKey()); $this->assertEquals('', $list[1]->getVersionId()); $this->assertEquals('', $list[1]->getDeleteMarker()); $this->assertEquals('', $list[1]->getDeleteMarkerVersionId()); $this->assertEquals('demo/.jpg', $list[2]->getKey()); $this->assertEquals('', $list[2]->getVersionId()); $this->assertEquals('', $list[2]->getDeleteMarker()); $this->assertEquals('', $list[2]->getDeleteMarkerVersionId()); } public function testParseNullXml() { $response = new ResponseCore(array(), "", 200); $result = new DeleteObjectVersionsResult($response); $list = $result->getData(); $this->assertEquals(0, count($list)); } public function testParseInvalidXml() { $response = new ResponseCore(array(), $this->invalidXml, 200); $result = new DeleteObjectVersionsResult($response); $list = $result->getData(); $this->assertEquals(0, count($list)); } }