Skip to content

Commit 452182e

Browse files
committed
Test file renaming
1 parent 9bdf38e commit 452182e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/Adapters/FileTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,19 @@ public function testChownUid(LoopInterface $loop, FilesystemInterface $filesyste
218218
$this->await($filesystem->file($tempFile)->chown(1000), $loop);
219219
$this->assertSame(1000, fileowner($tempFile));
220220
}
221+
222+
/**
223+
* @dataProvider filesystemProvider
224+
*/
225+
public function testRename(LoopInterface $loop, FilesystemInterface $filesystem)
226+
{
227+
$filenameFrom = uniqid('', true);
228+
$tempFileFrom = $this->tmpDir . $filenameFrom;
229+
file_put_contents($tempFileFrom, $filenameFrom);
230+
$filenameTo = uniqid('', true);
231+
$tempFileTo = $this->tmpDir . $filenameTo;
232+
$this->await($filesystem->file($tempFileFrom)->rename($tempFileTo), $loop);
233+
$this->assertFileExists($tempFileTo);
234+
$this->assertSame($filenameFrom, file_get_contents($tempFileTo));
235+
}
221236
}

0 commit comments

Comments
 (0)