mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
feat(tests): Test that mtime is the same after move or rename
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
c0d84f9fb2
commit
531ec42b64
1 changed files with 10 additions and 0 deletions
|
|
@ -243,12 +243,14 @@ abstract class Storage extends \Test\TestCase {
|
|||
public function testMove($source, $target) {
|
||||
$this->initSourceAndTarget($source);
|
||||
|
||||
$mTime = $this->instance->filemtime($source);
|
||||
$this->instance->rename($source, $target);
|
||||
|
||||
$this->wait();
|
||||
$this->assertTrue($this->instance->file_exists($target), $target . ' was not created');
|
||||
$this->assertFalse($this->instance->file_exists($source), $source . ' still exists');
|
||||
$this->assertSameAsLorem($target);
|
||||
$this->assertEquals($mTime, $this->instance->filemtime($target), 'mtime was not preserved by move');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -271,11 +273,13 @@ abstract class Storage extends \Test\TestCase {
|
|||
public function testMoveOverwrite($source, $target) {
|
||||
$this->initSourceAndTarget($source, $target);
|
||||
|
||||
$mTime = $this->instance->filemtime($source);
|
||||
$this->instance->rename($source, $target);
|
||||
|
||||
$this->assertTrue($this->instance->file_exists($target), $target . ' was not created');
|
||||
$this->assertFalse($this->instance->file_exists($source), $source . ' still exists');
|
||||
$this->assertSameAsLorem($target);
|
||||
$this->assertEquals($mTime, $this->instance->filemtime($target), 'mtime was not preserved by move');
|
||||
}
|
||||
|
||||
public function testLocal() {
|
||||
|
|
@ -485,6 +489,10 @@ abstract class Storage extends \Test\TestCase {
|
|||
$this->instance->file_put_contents('source/test2.txt', 'qwerty');
|
||||
$this->instance->mkdir('source/subfolder');
|
||||
$this->instance->file_put_contents('source/subfolder/test.txt', 'bar');
|
||||
|
||||
$mTimeDirectory = $this->instance->filemtime('source');
|
||||
$mTimeTestFile = $this->instance->filemtime('source/subfolder/test.txt');
|
||||
|
||||
$this->instance->rename('source', 'target');
|
||||
|
||||
$this->assertFalse($this->instance->file_exists('source'));
|
||||
|
|
@ -505,6 +513,8 @@ abstract class Storage extends \Test\TestCase {
|
|||
$this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt'));
|
||||
$this->assertEquals('qwerty', $this->instance->file_get_contents('target/test2.txt'));
|
||||
$this->assertEquals('bar', $this->instance->file_get_contents('target/subfolder/test.txt'));
|
||||
$this->assertEquals($mTimeDirectory, $this->instance->filemtime('target'), 'directory mtime was not preserved by rename');
|
||||
$this->assertEquals($mTimeTestFile, $this->instance->filemtime('target/subfolder/test.txt'), 'file mtime was not preserved by rename');
|
||||
}
|
||||
|
||||
public function testRenameOverWriteDirectory() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue