mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 18:50:47 -04:00
Fix unit tests
This commit is contained in:
parent
129bfad204
commit
3ea94a7930
3 changed files with 17 additions and 14 deletions
12
tests/lib/files/cache/changepropagator.php
vendored
12
tests/lib/files/cache/changepropagator.php
vendored
|
|
@ -61,12 +61,12 @@ class ChangePropagator extends \PHPUnit_Framework_TestCase {
|
|||
$newInfo2 = $this->view->getFileInfo('/foo');
|
||||
$newInfo3 = $this->view->getFileInfo('/foo/bar');
|
||||
|
||||
$this->assertEquals($newInfo1->getMTime(), $time);
|
||||
$this->assertEquals($newInfo2->getMTime(), $time);
|
||||
$this->assertEquals($newInfo3->getMTime(), $time);
|
||||
$this->assertEquals($newInfo1['mtime'], $time);
|
||||
$this->assertEquals($newInfo2['mtime'], $time);
|
||||
$this->assertEquals($newInfo3['mtime'], $time);
|
||||
|
||||
$this->assertNotEquals($oldInfo1->getEtag(), $newInfo1->getEtag());
|
||||
$this->assertNotEquals($oldInfo2->getEtag(), $newInfo2->getEtag());
|
||||
$this->assertNotEquals($oldInfo3->getEtag(), $newInfo3->getEtag());
|
||||
$this->assertNotEquals($oldInfo1['etag'], $newInfo1['etag']);
|
||||
$this->assertNotEquals($oldInfo2['etag'], $newInfo2['etag']);
|
||||
$this->assertNotEquals($oldInfo3['etag'], $newInfo3['etag']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
5
tests/lib/files/cache/scanner.php
vendored
5
tests/lib/files/cache/scanner.php
vendored
|
|
@ -227,10 +227,7 @@ class Scanner extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
// verify cache content
|
||||
$newData0 = $this->cache->get('folder/bar.txt');
|
||||
$newData1 = $this->cache->get('folder');
|
||||
$newData2 = $this->cache->get('');
|
||||
$this->assertInternalType('string', $newData0['etag']);
|
||||
$this->assertNotEmpty($newData0['etag']);
|
||||
$this->assertNotEquals($data1['etag'], $newData1['etag']);
|
||||
$this->assertNotEquals($data2['etag'], $newData2['etag']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,8 +105,12 @@ class Scanner extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
$scanner->scan('');
|
||||
|
||||
$this->assertEquals(array('/foo', '/foo/foo.txt', '/foo/folder', '/foo/folder/bar.txt'), $propagator->getChanges());
|
||||
$this->assertEquals(array('/', '/foo', '/foo/folder'), $propagator->getAllParents());
|
||||
$changes = $propagator->getChanges();
|
||||
$parents = $propagator->getAllParents();
|
||||
sort($changes);
|
||||
sort($parents);
|
||||
$this->assertEquals(array('/foo', '/foo/folder', '/foo/folder/bar.txt', '/foo/foo.txt'), $changes);
|
||||
$this->assertEquals(array('/', '/foo', '/foo/folder'), $parents);
|
||||
|
||||
$cache->put('foo.txt', array('mtime' => time() - 50));
|
||||
|
||||
|
|
@ -116,8 +120,10 @@ class Scanner extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
$scanner->scan('');
|
||||
|
||||
$this->assertEquals(array('/foo/foo.txt'), $propagator->getChanges());
|
||||
$this->assertEquals(array('/', '/foo'), $propagator->getAllParents());
|
||||
$changes = $propagator->getChanges();
|
||||
$parents = $propagator->getAllParents();
|
||||
$this->assertEquals(array('/foo/foo.txt'), $changes);
|
||||
$this->assertEquals(array('/', '/foo'), $parents);
|
||||
|
||||
$scanner->setPropagator($originalPropagator);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue