mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
let GCS backends talk to the same "storage account" during testing
This commit is contained in:
parent
726f54ce9e
commit
3d485ecd7f
|
@ -34,7 +34,7 @@ class StorageClientStub extends StorageClient
|
||||||
{
|
{
|
||||||
private $_config = null;
|
private $_config = null;
|
||||||
private $_connection = null;
|
private $_connection = null;
|
||||||
private $_buckets = array();
|
private static $_buckets = array();
|
||||||
|
|
||||||
public function __construct(array $config = array())
|
public function __construct(array $config = array())
|
||||||
{
|
{
|
||||||
|
@ -44,11 +44,11 @@ class StorageClientStub extends StorageClient
|
||||||
|
|
||||||
public function bucket($name, $userProject = false)
|
public function bucket($name, $userProject = false)
|
||||||
{
|
{
|
||||||
if (!key_exists($name, $this->_buckets)) {
|
if (!key_exists($name, self::$_buckets)) {
|
||||||
$b = new BucketStub($this->_connection, $name, array(), $this);
|
$b = new BucketStub($this->_connection, $name, array(), $this);
|
||||||
$this->_buckets[$name] = $b;
|
self::$_buckets[$name] = $b;
|
||||||
}
|
}
|
||||||
return $this->_buckets[$name];
|
return self::$_buckets[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,8 +56,8 @@ class StorageClientStub extends StorageClient
|
||||||
*/
|
*/
|
||||||
public function deleteBucket($name)
|
public function deleteBucket($name)
|
||||||
{
|
{
|
||||||
if (key_exists($name, $this->_buckets)) {
|
if (key_exists($name, self::$_buckets)) {
|
||||||
unset($this->_buckets[$name]);
|
unset(self::$_buckets[$name]);
|
||||||
} else {
|
} else {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
@ -110,11 +110,11 @@ class StorageClientStub extends StorageClient
|
||||||
|
|
||||||
public function createBucket($name, array $options = array())
|
public function createBucket($name, array $options = array())
|
||||||
{
|
{
|
||||||
if (key_exists($name, $this->_buckets)) {
|
if (key_exists($name, self::$_buckets)) {
|
||||||
throw new BadRequestException('already exists');
|
throw new BadRequestException('already exists');
|
||||||
}
|
}
|
||||||
$b = new BucketStub($this->_connection, $name, array(), $this);
|
$b = new BucketStub($this->_connection, $name, array(), $this);
|
||||||
$this->_buckets[$name] = $b;
|
self::$_buckets[$name] = $b;
|
||||||
return $b;
|
return $b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user