]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed testTouch unit test to work with stable5
authorVincent Petry <pvince81@owncloud.com>
Fri, 22 Nov 2013 13:53:56 +0000 (14:53 +0100)
committerVincent Petry <pvince81@owncloud.com>
Fri, 22 Nov 2013 13:53:56 +0000 (14:53 +0100)
Calling getFileInfo() would trigger checkUpdate() and would return the
real file mtime because the test value 500 was in the past.

This fix makes this test work with the stable5 behavior.

Removed "storage_mtime" references which don't exist in stable5.

tests/lib/files/view.php

index 88b4113008b38e35f6db914558033f11ee7c4b19..aceb36aa01e1742d2e29e3d453d15a234a5a14ca 100644 (file)
@@ -275,18 +275,20 @@ class View extends \PHPUnit_Framework_TestCase {
 
                $rootView = new \OC\Files\View('');
                $oldCachedData = $rootView->getFileInfo('foo.txt');
+               $newMTime = $oldCachedData['mtime'] + 500;
 
-               $rootView->touch('foo.txt', 500);
+               $rootView->touch('foo.txt', $newMTime);
 
                $cachedData = $rootView->getFileInfo('foo.txt');
-               $this->assertEquals(500, $cachedData['mtime']);
-               $this->assertEquals($oldCachedData['storage_mtime'], $cachedData['storage_mtime']);
+               $this->assertEquals($newMTime, $cachedData['mtime']);
+
+               // reset mtime to original to make sure the next file access
+               // gets a higher mtime
+               $rootView->touch('foo.txt', $oldCachedData['mtime']);
 
-               $rootView->putFileInfo('foo.txt', array('storage_mtime' => 1000)); //make sure the watcher detects the change
                $rootView->file_put_contents('foo.txt', 'asd');
                $cachedData = $rootView->getFileInfo('foo.txt');
                $this->assertGreaterThanOrEqual($cachedData['mtime'], $oldCachedData['mtime']);
-               $this->assertEquals($cachedData['storage_mtime'], $cachedData['mtime']);
        }
 
        /**