56 lines
2.0 KiB
PHP
56 lines
2.0 KiB
PHP
<?php
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
namespace CloudObjects\SDK;
|
|
|
|
use CloudObjects\SDK\Exceptions\InvalidSDKConfigurationException;
|
|
|
|
class ObjectRetrieverTest extends \PHPUnit\Framework\TestCase {
|
|
|
|
public function testFallbackStoreWithExistingDirectory() {
|
|
$retriever = new ObjectRetriever([
|
|
'fallback_store_directory' => sys_get_temp_dir(),
|
|
'fallback_store_scope' => '*',
|
|
]);
|
|
$this->assertInstanceOf(ObjectRetriever::class, $retriever);
|
|
}
|
|
|
|
public function testFallbackStoreWithMissingDirectory() {
|
|
$this->expectException(InvalidSDKConfigurationException::class);
|
|
new ObjectRetriever([
|
|
'fallback_store_directory' => sys_get_temp_dir().'/does-not-exist-'.uniqid(),
|
|
'fallback_store_scope' => '*',
|
|
]);
|
|
}
|
|
|
|
public function testPermanentStoreWithExistingDirectory() {
|
|
$retriever = new ObjectRetriever([
|
|
'permanent_store_directory' => sys_get_temp_dir(),
|
|
'permanent_store_scope' => '*',
|
|
]);
|
|
$this->assertInstanceOf(ObjectRetriever::class, $retriever);
|
|
}
|
|
|
|
public function testPermanentStoreWithMissingDirectory() {
|
|
$this->expectException(InvalidSDKConfigurationException::class);
|
|
new ObjectRetriever([
|
|
'permanent_store_directory' => sys_get_temp_dir().'/does-not-exist-'.uniqid(),
|
|
'permanent_store_scope' => '*',
|
|
]);
|
|
}
|
|
|
|
public function testPermanentStoreWithSameDirectoryAsFallbackStore() {
|
|
$this->expectException(InvalidSDKConfigurationException::class);
|
|
new ObjectRetriever([
|
|
'fallback_store_directory' => sys_get_temp_dir(),
|
|
'fallback_store_scope' => '*',
|
|
'permanent_store_directory' => sys_get_temp_dir(),
|
|
'permanent_store_scope' => '*',
|
|
]);
|
|
}
|
|
|
|
}
|