public function testCleanupFrs() { $backend = new BackendTestVersion($this); $daysBefore = $_SERVER['REQUEST_TIME'] - 24 * 3600 * 5; $ff = new MockFRSFileFactory($this); $ff->setReturnValue('moveFiles', true); //$ff->expectOnce('moveFiles', array($daysBefore, $backend)); $wiki = new MockWikiAttachment($this); $wiki->setReturnValue('purgeAttachments', true); $backend->setReturnValue('getFRSFileFactory', $ff); $backend->setReturnValue('getWikiAttachment', $wiki); $this->assertTrue($backend->cleanupFRS()); }
/** * Testing succeeded delete */ function testDeleteSucceede() { $webDAVFile = new WebDAVFRSFileTestVersion($this); $webDAVFile->setReturnValue('userCanWrite', true); $frsff = new MockFRSFileFactory(); $frsff->setReturnValue('delete_file', 1); $utils = new MockWebDAVUtils(); $utils->setReturnValue('getFileFactory', $frsff); $project = new MockProject(); $webDAVFile->setReturnValue('getProject', $project); $webDAVFile->setReturnValue('getUtils', $utils); $webDAVFile->delete(); }
/** * Testing creation of file succeed */ function testCreateFilesucceed() { $webDAVFRSRelease = new WebDAVFRSReleaseTestVersion($this); $webDAVFRSRelease->setReturnValue('userCanWrite', true); $frsff = new MockFRSFileFactory(); $frsff->setReturnValue('isFileBaseNameExists', false); $frsff->setReturnValue('createFile', true); $release = new MockFRSRelease($this); $release->setReturnValue('getReleaseID', 1234); $webDAVFRSRelease->setReturnValue('getRelease', $release); $frsrf = new MockFRSReleaseFactory($this); $frsrf->expectOnce('emailNotification'); $utils = new MockWebDAVUtils(); $utils->setReturnValue('getFileFactory', $frsff); $utils->setReturnValue('getIncomingFileSize', 64); $utils->setReturnValue('getReleaseFactory', $frsrf); $project = new MockProject(); $webDAVFRSRelease->setReturnValue('getProject', $project); $user = new MockUser(); $webDAVFRSRelease->setReturnValue('getUser', $user); $webDAVFRSRelease->setReturnValue('getUtils', $utils); $data = fopen(dirname(__FILE__) . '/_fixtures/test.txt', 'r'); $webDAVFRSRelease->setReturnValue('getMaxFileSize', 64); $webDAVFRSRelease->createFile('release', $data); }