mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Move setUp() and tearDown() up in tests/lib/files/cache/scanner.php.
This commit is contained in:
parent
4a9f1cc74d
commit
d9a36ee82e
1 changed files with 15 additions and 15 deletions
30
tests/lib/files/cache/scanner.php
vendored
30
tests/lib/files/cache/scanner.php
vendored
|
|
@ -24,6 +24,21 @@ class Scanner extends \PHPUnit_Framework_TestCase {
|
|||
*/
|
||||
private $cache;
|
||||
|
||||
function setUp() {
|
||||
$this->storage = new \OC\Files\Storage\Temporary(array());
|
||||
$this->scanner = new \OC\Files\Cache\Scanner($this->storage);
|
||||
$this->cache = new \OC\Files\Cache\Cache($this->storage);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
if ($this->cache) {
|
||||
$ids = $this->cache->getAll();
|
||||
$permissionsCache = $this->storage->getPermissionsCache();
|
||||
$permissionsCache->removeMultiple($ids, \OC_User::getUser());
|
||||
$this->cache->clear();
|
||||
}
|
||||
}
|
||||
|
||||
function testFile() {
|
||||
$data = "dummy file data\n";
|
||||
$this->storage->file_put_contents('foo.txt', $data);
|
||||
|
|
@ -218,19 +233,4 @@ class Scanner extends \PHPUnit_Framework_TestCase {
|
|||
$this->assertNotEquals($data1['etag'], $newData1['etag']);
|
||||
$this->assertNotEquals($data2['etag'], $newData2['etag']);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
$this->storage = new \OC\Files\Storage\Temporary(array());
|
||||
$this->scanner = new \OC\Files\Cache\Scanner($this->storage);
|
||||
$this->cache = new \OC\Files\Cache\Cache($this->storage);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
if ($this->cache) {
|
||||
$ids = $this->cache->getAll();
|
||||
$permissionsCache = $this->storage->getPermissionsCache();
|
||||
$permissionsCache->removeMultiple($ids, \OC_User::getUser());
|
||||
$this->cache->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue