Fix unit tests

This commit is contained in:
Robin Appelman 2014-06-04 10:01:50 +02:00
parent 129bfad204
commit 3ea94a7930
3 changed files with 17 additions and 14 deletions

View file

@ -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']);
}
}

View file

@ -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']);
}
}

View file

@ -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);