예제 #1
0
 /**
  * @return void
  */
 public function testGetNewNameOverwriteWithExistingFile()
 {
     $filter = new FileRename(array('source' => $this->_oldFile, 'target' => $this->_newFile, 'overwrite' => true));
     copy($this->_oldFile, $this->_newFile);
     $this->assertEquals(array(0 => array('source' => $this->_oldFile, 'target' => $this->_newFile, 'overwrite' => true)), $filter->getFile());
     $this->assertEquals($this->_newFile, $filter->getNewName($this->_oldFile));
 }
예제 #2
0
 /**
  * @return void
  */
 public function testGetRandomizedFileWithoutExtension()
 {
     $fileNoExt = $this->_filesPath . 'newfile';
     $filter = new FileRename(array('source' => $this->_oldFile, 'target' => $fileNoExt, 'randomize' => true));
     $this->assertEquals(array(0 => array('source' => $this->_oldFile, 'target' => $fileNoExt, 'overwrite' => false, 'randomize' => true)), $filter->getFile());
     $this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}#', $filter->getNewName($this->_oldFile));
 }