/** * @depends testHeadBucket */ public function testPutBucketLocation() { $this->log(__METHOD__); $bucketName = self::getResourcePrefix() . '-s3eutest'; try { $this->client->headBucket(array('Bucket' => $bucketName)); } catch (\Exception $e) { $this->client->createBucket(array('Bucket' => $bucketName, 'LocationConstraint' => 'EU')); } $this->client->waitUntil('bucket_exists', array('Bucket' => $bucketName)); $result = $this->client->getBucketLocation(array('Bucket' => $bucketName)); $this->assertEquals('EU', $result['Location']); $this->client->deleteBucket(array('Bucket' => $bucketName)); }
/** * Returns the region the bucket resides in. * * @param string $bucket * * @return mixed */ public function getBucketLocation($bucket) { $params = ['Bucket' => $bucket]; return $this->instance->getBucketLocation($params); }