rename() public method

Destination path supplied by user resolved to real destination path with {@link resolveDestPath}
public rename ( string $dest ) : CFile | boolean
$dest string Destination path for the current filesystem object to be renamed/moved to
return CFile | boolean Updated current CFile object on success, 'False' on fail.
Esempio n. 1
0
 public function testRename()
 {
     $filePath0 = CFile::createTemporary();
     $newName = CFilePath::name($filePath0) . "-renamed";
     $filePath1 = CFilePath::add(CFilePath::directory($filePath0), $newName);
     CFile::write($filePath0, "Hello there!");
     CFile::rename($filePath0, $newName);
     $this->assertTrue(!CFile::exists($filePath0) && CFile::exists($filePath1) && CFile::read($filePath1)->equals("Hello there!"));
     CFile::delete($filePath1);
 }