/** * @depends testPutAndListObjects * @dataProvider prefixKeyProvider */ public function testWorksWithPrefixKeys($key, $cleaned, $encoded) { $this->client->waitUntil('bucket_exists', array('Bucket' => $this->bucket)); $command = $this->client->getCommand('PutObject', array('Bucket' => $this->bucket, 'Key' => $key, 'SourceFile' => __FILE__)); $command->execute(); // Ensure the path is correct $this->assertEquals($encoded, $command->getRequest()->getPath()); // Ensure the key is not an array and is returned to it's previous value $this->assertEquals($key, $command['Key']); $this->client->waitUntil('object_exists', array('Bucket' => $this->bucket, 'Key' => $key)); $result = $this->client->getObject(array('Bucket' => $this->bucket, 'Key' => $key)); $this->assertEquals(file_get_contents(__FILE__), (string) $result['Body']); // Test using path style hosting $command = $this->client->getCommand('DeleteObject', array('Bucket' => $this->bucket, 'Key' => $key, 'PathStyle' => true)); $command->execute(); $this->assertEquals('/' . $this->bucket . $encoded, $command->getRequest()->getPath()); }