]> source.dussan.org Git - nextcloud-server.git/commitdiff
update tests
authorRobin Appelman <icewind@owncloud.com>
Tue, 10 Nov 2015 15:31:30 +0000 (16:31 +0100)
committerRobin Appelman <icewind@owncloud.com>
Thu, 19 Nov 2015 12:32:04 +0000 (13:32 +0100)
apps/files_sharing/tests/etagpropagation.php
apps/files_trashbin/tests/trashbin.php
apps/files_versions/tests/versions.php
tests/lib/files/cache/updaterlegacy.php
tests/lib/files/etagtest.php

index 1abf04df84f4621a44510931cdad3adfd0173128..2a33732d63ff7f23ffbe93c3ed47ed1d9c4cb914 100644 (file)
@@ -193,7 +193,8 @@ class EtagPropagation extends TestCase {
 
        public function testOwnerWritesToSingleFileShare() {
                $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1);
-               Filesystem::file_put_contents('/foo.txt', 'bar');
+               Filesystem::file_put_contents('/foo.txt', 'longer_bar');
+               Filesystem::touch('/foo.txt', time() - 1);
                $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4, self::TEST_FILES_SHARING_API_USER3]);
                $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2]);
 
index e28b854ca1fba58c267c0631c5d82ad2a0776521..934f831ef7473785b09cf3ee41f2080a26052d74 100644 (file)
@@ -65,7 +65,6 @@ class Test_Trashbin extends \Test\TestCase {
                \OC::registerShareHooks();
                $application = new \OCA\Files_Sharing\AppInfo\Application();
                $application->registerMountProviders();
-               $application->setupPropagation();
 
                //disable encryption
                \OC_App::disable('encryption');
index b9bc0932a8487764559b05ad06d0b25e27689ef0..6ebbf830e70e8d1731746d12eb533c6ec2432a2f 100644 (file)
@@ -51,7 +51,6 @@ class Test_Files_Versioning extends \Test\TestCase {
 
                $application = new \OCA\Files_Sharing\AppInfo\Application();
                $application->registerMountProviders();
-               $application->setupPropagation();
 
                // create test user
                self::loginHelper(self::TEST_VERSIONS_USER2, true);
index f4d52e9a390716aeca3ea27c6ada7e060a556179..c1a0d3d82309cf65c7a50f0675e0f65ec55efda8 100644 (file)
@@ -10,6 +10,7 @@ namespace Test\Files\Cache;
 
 use \OC\Files\Filesystem as Filesystem;
 use OC\Files\Storage\Temporary;
+use OC\Files\View;
 
 class UpdaterLegacy extends \Test\TestCase {
        /**
@@ -111,7 +112,8 @@ class UpdaterLegacy extends \Test\TestCase {
                $storage2->getScanner()->scan(''); //initialize etags
                $cache2 = $storage2->getCache();
                Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage');
-               $folderCachedData = $this->cache->get('folder');
+               $view = new View('/' . self::$user . '/files');
+               $folderCachedData = $view->getFileInfo('folder');
                $substorageCachedData = $cache2->get('');
                Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd');
                $this->assertTrue($cache2->inCache('foo.txt'));
@@ -124,7 +126,7 @@ class UpdaterLegacy extends \Test\TestCase {
                $this->assertInternalType('string', $cachedData['etag']);
                $this->assertNotSame($substorageCachedData['etag'], $cachedData['etag']);
 
-               $cachedData = $this->cache->get('folder');
+               $cachedData = $view->getFileInfo('folder');
                $this->assertInternalType('string', $folderCachedData['etag']);
                $this->assertInternalType('string', $cachedData['etag']);
                $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
@@ -168,8 +170,9 @@ class UpdaterLegacy extends \Test\TestCase {
                $cache2 = $storage2->getCache();
                Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage');
                Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd');
+               $view = new View('/' . self::$user . '/files');
                $this->assertTrue($cache2->inCache('foo.txt'));
-               $folderCachedData = $this->cache->get('folder');
+               $folderCachedData = $view->getFileInfo('folder');
                $substorageCachedData = $cache2->get('');
                Filesystem::unlink('folder/substorage/foo.txt');
                $this->assertFalse($cache2->inCache('foo.txt'));
@@ -180,7 +183,7 @@ class UpdaterLegacy extends \Test\TestCase {
                $this->assertNotSame($substorageCachedData['etag'], $cachedData['etag']);
                $this->assertGreaterThanOrEqual($substorageCachedData['mtime'], $cachedData['mtime']);
 
-               $cachedData = $this->cache->get('folder');
+               $cachedData = $view->getFileInfo('folder');
                $this->assertInternalType('string', $folderCachedData['etag']);
                $this->assertInternalType('string', $cachedData['etag']);
                $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
@@ -222,8 +225,9 @@ class UpdaterLegacy extends \Test\TestCase {
                $cache2 = $storage2->getCache();
                Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage');
                Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd');
+               $view = new View('/' . self::$user . '/files');
                $this->assertTrue($cache2->inCache('foo.txt'));
-               $folderCachedData = $this->cache->get('folder');
+               $folderCachedData = $view->getFileInfo('folder');
                $substorageCachedData = $cache2->get('');
                $fooCachedData = $cache2->get('foo.txt');
                Filesystem::rename('folder/substorage/foo.txt', 'folder/substorage/bar.txt');
@@ -240,7 +244,7 @@ class UpdaterLegacy extends \Test\TestCase {
                // rename can cause mtime change - invalid assert
 //             $this->assertEquals($mtime, $cachedData['mtime']);
 
-               $cachedData = $this->cache->get('folder');
+               $cachedData = $view->getFileInfo('folder');
                $this->assertInternalType('string', $folderCachedData['etag']);
                $this->assertInternalType('string', $cachedData['etag']);
                $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
@@ -287,35 +291,4 @@ class UpdaterLegacy extends \Test\TestCase {
                $this->assertEquals($time, $cachedData['mtime']);
        }
 
-       public function testTouchWithMountPoints() {
-               $storage2 = new \OC\Files\Storage\Temporary(array());
-               $cache2 = $storage2->getCache();
-               Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage');
-               Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd');
-               $this->assertTrue($cache2->inCache('foo.txt'));
-               $folderCachedData = $this->cache->get('folder');
-               $substorageCachedData = $cache2->get('');
-               $fooCachedData = $cache2->get('foo.txt');
-               $cachedData = $cache2->get('foo.txt');
-               $time = 1371006070;
-               $this->cache->put('folder', ['mtime' => $time - 100]);
-               Filesystem::touch('folder/substorage/foo.txt', $time);
-               $cachedData = $cache2->get('foo.txt');
-               $this->assertInternalType('string', $fooCachedData['etag']);
-               $this->assertInternalType('string', $cachedData['etag']);
-               $this->assertNotSame($fooCachedData['etag'], $cachedData['etag']);
-               $this->assertEquals($time, $cachedData['mtime']);
-
-               $cachedData = $cache2->get('');
-               $this->assertInternalType('string', $substorageCachedData['etag']);
-               $this->assertInternalType('string', $cachedData['etag']);
-               $this->assertNotSame($substorageCachedData['etag'], $cachedData['etag']);
-
-               $cachedData = $this->cache->get('folder');
-               $this->assertInternalType('string', $folderCachedData['etag']);
-               $this->assertInternalType('string', $cachedData['etag']);
-               $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
-               $this->assertEquals($time, $cachedData['mtime']);
-       }
-
 }
index 1a11b29cf00b79c4ecaed941cba7ee185b4351ff..192768d04afdf9946951fdf12602f0ac613f255a 100644 (file)
@@ -27,7 +27,6 @@ class EtagTest extends \Test\TestCase {
                \OC_Hook::clear('OC_Filesystem', 'setup');
                $application = new \OCA\Files_Sharing\AppInfo\Application();
                $application->registerMountProviders();
-               $application->setupPropagation();
                \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
                \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');