Beispiel #1
0
 public function testCopy()
 {
     $handler = new UpdateHelper($this->application);
     $tmpName = 'test-update-copy' . rand(1, 5000000);
     $tmp = ClassLoader::getRealPath('cache.') . $tmpName;
     file_put_contents($tmp, 'test');
     $res = $handler->copyFile($tmp, 'module/' . $tmpName);
     $expected = ClassLoader::getRealPath('module.') . $tmpName;
     if (file_exists($expected)) {
         $response = new JSONResponse(array(), 'success', $this->translate('_test_copy_success'));
     } else {
         $response = new JSONResponse(array(), 'failure', $this->translate('_test_copy_failure'));
     }
     $handler->deleteFile('module/' . $tmp);
     unlink($tmp);
     return $response;
 }