Renamed class + split methods
This commit is contained in:
parent
80a1f1858e
commit
9695e33e34
|
@ -18,40 +18,28 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
use OCA\Files_sharing\Tests\TestCase;
|
namespace OCA\Files_Sharing\Tests;
|
||||||
|
|
||||||
class Test_Files_Sharing_ReadOnly_Cache extends TestCase {
|
class ReadOnlyCache extends TestCase {
|
||||||
|
|
||||||
/**
|
/** @var \OC\Files\Storage\Storage */
|
||||||
* @type \OC\Files\Storage\Storage
|
|
||||||
*/
|
|
||||||
protected $storage;
|
protected $storage;
|
||||||
|
|
||||||
/**
|
/** @var \OC\Files\Storage\StorageFactory */
|
||||||
* @type OC\Files\Storage\StorageFactory
|
|
||||||
*/
|
|
||||||
protected $loader;
|
protected $loader;
|
||||||
|
|
||||||
/**
|
/** @var \OC\Files\Mount\MountPoint */
|
||||||
* @type OC\Files\Mount\MountPoint
|
|
||||||
*/
|
|
||||||
protected $readOnlyMount;
|
protected $readOnlyMount;
|
||||||
|
|
||||||
/**
|
/** @var \OCA\Files_Sharing\ReadOnlyWrapper */
|
||||||
* @type \OCA\Files_Sharing\ReadOnlyWrapper
|
|
||||||
*/
|
|
||||||
protected $readOnlyStorage;
|
protected $readOnlyStorage;
|
||||||
|
|
||||||
/**
|
/** @var \OC\Files\Cache\Cache */
|
||||||
* @type \OC\Files\Cache\Cache
|
|
||||||
*/
|
|
||||||
protected $readOnlyCache;
|
protected $readOnlyCache;
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
//error_reporting(E_ERROR | E_PARSE);
|
|
||||||
|
|
||||||
$this->view->mkdir('readonly');
|
$this->view->mkdir('readonly');
|
||||||
$this->view->file_put_contents('readonly/foo.txt', 'foo');
|
$this->view->file_put_contents('readonly/foo.txt', 'foo');
|
||||||
$this->view->file_put_contents('readonly/bar.txt', 'bar');
|
$this->view->file_put_contents('readonly/bar.txt', 'bar');
|
||||||
|
@ -66,10 +54,6 @@ class Test_Files_Sharing_ReadOnly_Cache extends TestCase {
|
||||||
$this->readOnlyCache = $this->readOnlyStorage->getCache();
|
$this->readOnlyCache = $this->readOnlyStorage->getCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown() {
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSetup() {
|
public function testSetup() {
|
||||||
$this->assertTrue($this->view->file_exists('/readonly/foo.txt'));
|
$this->assertTrue($this->view->file_exists('/readonly/foo.txt'));
|
||||||
|
|
||||||
|
@ -82,22 +66,26 @@ class Test_Files_Sharing_ReadOnly_Cache extends TestCase {
|
||||||
$this->assertInstanceOf('\OCA\Files_Sharing\ReadOnlyCache', $this->readOnlyCache);
|
$this->assertInstanceOf('\OCA\Files_Sharing\ReadOnlyCache', $this->readOnlyCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet() {
|
public function testGetWhenFileExists() {
|
||||||
$result = $this->readOnlyCache->get('files/readonly/foo.txt');
|
$result = $this->readOnlyCache->get('files/readonly/foo.txt');
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetWhenFileDoesNotExist() {
|
||||||
$result = $this->readOnlyCache->get('files/readonly/proof does not exist.md');
|
$result = $this->readOnlyCache->get('files/readonly/proof does not exist.md');
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetFolderContents() {
|
public function testGetFolderContentsWhenFolderExists() {
|
||||||
$results = $this->readOnlyCache->getFolderContents('files/readonly');
|
$results = $this->readOnlyCache->getFolderContents('files/readonly');
|
||||||
$this->assertNotEmpty($results);
|
$this->assertNotEmpty($results);
|
||||||
|
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetFolderContentsWhenFolderDoesNotExist() {
|
||||||
$results = $this->readOnlyCache->getFolderContents('files/iamaghost');
|
$results = $this->readOnlyCache->getFolderContents('files/iamaghost');
|
||||||
$this->assertEmpty($results);
|
$this->assertEmpty($results);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue