/tests/tests/kernel/classes/clusterfilehandlers/ezclusterfilehandler_abstract_test.php

https://github.com/GunioRobot/ezpublish · PHP · 748 lines · 479 code · 87 blank · 182 comment · 7 complexity · 15c4137121bdbead2e36f76fd0c4221b MD5 · raw file

  1. <?php
  2. /**
  3. * File containing the eZClusterFileHandlerAbstractTest class
  4. *
  5. * @copyright Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
  6. * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
  7. * @version //autogentag//
  8. * @package tests
  9. */
  10. /**
  11. * Abstract class that gathers common cluster file handlers tests
  12. */
  13. abstract class eZClusterFileHandlerAbstractTest extends ezpDatabaseTestCase
  14. {
  15. /**
  16. * Tested cluster class
  17. * Must be overriden by any implementation
  18. * @var string eZFSFileHandler, eZDBFileHandler...
  19. */
  20. protected $clusterClass = false;
  21. protected $backupGlobals = false;
  22. protected $previousFileHandler;
  23. /**
  24. * @var eZINI
  25. */
  26. protected $fileINI;
  27. public function setUp()
  28. {
  29. // Verify that the clusterClass for each implementation is properly defined
  30. if ( $this->clusterClass === false )
  31. $this->markTestSkipped( "Test class " . get_class( $this ) . " does not provide the clusterClass property" );
  32. return parent::setUp();
  33. }
  34. /**
  35. * Helper function that creates a cluster file
  36. */
  37. protected function createFile( $path, $contents, $params = array() )
  38. {
  39. $ch = eZClusterFileHandler::instance( $path );
  40. $ch->storeContents( $contents );
  41. $ch->loadMetaData( true );
  42. }
  43. /**
  44. * Deletes one or more local files
  45. * @param mixed $path Path to the local file. Give as many as you like (variable params)
  46. */
  47. protected static function deleteLocalFiles( $path )
  48. {
  49. foreach( func_get_args() as $path )
  50. if ( file_exists( $path ) )
  51. unlink( $path );
  52. }
  53. /**
  54. * Tests the loadMetaData method
  55. *
  56. * 1. Load metadata for a non existing file*
  57. * Expected: no return value
  58. * 2.
  59. */
  60. public function testMetadata()
  61. {
  62. // non existing file
  63. $clusterFileHandler = eZClusterFileHandler::instance( 'var/tests/' . __FUNCTION__ . '/non-existing.txt' );
  64. $this->assertNull( $clusterFileHandler->size() );
  65. $this->assertNull( $clusterFileHandler->mtime() );
  66. // existing file
  67. $file = 'var/tests/' . __FUNCTION__ . '/existing-file.txt';
  68. $this->createFile( $file, md5( time() ) );
  69. $ch = eZClusterFileHandler::instance( $file );
  70. $this->assertEquals( 32, $ch->size() );
  71. $this->assertType( 'integer', $ch->mtime() );
  72. }
  73. /**
  74. * Test for the instance method
  75. * 1. Check that calling instance with no file is coherent (no filePath property)
  76. * 1. Check that calling instance on a non-existing is coherent (no filePath property)
  77. * 2. Check that calling instance on an existing file makes the data available
  78. */
  79. public function testInstance()
  80. {
  81. // no parameter
  82. $ch = eZClusterFileHandler::instance();
  83. self::assertFalse( $ch->filePath, "Path to empty instance should have been null" );
  84. unset( $ch );
  85. // non existing file
  86. $path = 'var/tests/' . __FUNCTION__ . '/nofile.txt';
  87. $ch = eZClusterFileHandler::instance( $path );
  88. self::assertEquals( $path, $ch->filePath, "Path to non-existing file should have been the path itself" );
  89. self::assertFalse( $ch->exists(), "File should not exist" );
  90. unset( $ch );
  91. if ( file_exists( $path ) )
  92. unlink( $path );
  93. // existing file
  94. $path = 'var/tests/' . __FUNCTION__ . '/file1.txt';
  95. $this->createFile( $path, md5( time() ) );
  96. $ch = eZClusterFileHandler::instance( $path );
  97. self::assertEquals( $path, $ch->filePath, "Path to existing file should have been the path itself" );
  98. self::assertTrue( $ch->exists(), "File should exist" );
  99. if ( file_exists( $path ) )
  100. unlink( $path );
  101. }
  102. /**
  103. * Test for the fileFetch() method with an existing file
  104. *
  105. * 1. Store a new file to the cluster using content
  106. * 2. Call fileFetch on this file
  107. * 3. Check that the local file exists
  108. */
  109. public function testFileFetchExistingFile()
  110. {
  111. // 1. Store a new file
  112. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  113. $this->createFile( $path, md5( time() ) );
  114. // 2. Call fileFetch() on this file
  115. $ch = eZClusterFileHandler::instance();
  116. $ch->fileFetch( $path );
  117. // 3. Check that the local file exists
  118. $this->assertFileExists( $path );
  119. unlink( $path );
  120. }
  121. /**
  122. * Test for the fileFetch() method with a non-existing file
  123. *
  124. * 1. Call fileFetch() on a non-existing file
  125. * 2. Check that the return value is false
  126. */
  127. public function testFileFetchNonExistingFile()
  128. {
  129. $path = 'var/tests/' . __FUNCTION__ . '/nofile.txt';
  130. $ch = eZClusterFileHandler::instance();
  131. $this->assertFalse( $ch->fileFetch( $path ) );
  132. $this->assertFileNotExists( $path );
  133. }
  134. /**
  135. * Test for the fetch() method with an existing file
  136. */
  137. public function testFetchExistingFile()
  138. {
  139. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  140. // create the file
  141. $this->createFile( $path, md5( time() ) );
  142. // Fetch the file, and test for existence
  143. $ch = eZClusterFileHandler::instance( $path );
  144. $ch->fetch();
  145. self::assertFileExists( $path );
  146. }
  147. /**
  148. * Test for the fetch() method with a non existing file
  149. */
  150. public function testFetchNonExistingFile()
  151. {
  152. $path = 'var/tests/' . __FUNCTION__ . '/nofile.txt';
  153. // Fetch the file, and test for existence
  154. $ch = eZClusterFileHandler::instance( $path );
  155. $ch->fetch();
  156. self::assertFileNotExists( $path );
  157. }
  158. /**
  159. * Test for the fileStore() method with the delete option
  160. */
  161. public function testFileStoreWithDelete()
  162. {
  163. // create local file on disk
  164. $directory = 'var/tests/' . __FUNCTION__;
  165. $localFile = $directory . '/file.txt';
  166. eZFile::create( 'file.txt', $directory, md5( time() ) );
  167. // 1. First store to cluster, with delete option
  168. $ch = eZClusterFileHandler::instance();
  169. $ch->fileStore( $localFile, 'test', true, 'text/plain' );
  170. // 2. Check that the created file exists
  171. $ch2 = eZClusterFileHandler::instance( $localFile );
  172. self::assertTrue( $ch2->exists() );
  173. if ( !$this instanceof eZFSFileHandlerTest )
  174. {
  175. self::assertEquals( 'text/plain', $ch2->metaData['datatype'] );
  176. self::assertEquals( 'test', $ch2->metaData['scope'] );
  177. self::assertFileNotExists( $localFile );
  178. }
  179. }
  180. /**
  181. * Test for the fileStore() method with the delete option
  182. */
  183. public function testFileStoreWithoutDelete()
  184. {
  185. // create local file on disk
  186. $directory = 'var/tests/' . __FUNCTION__;
  187. $localFile = $directory . '/file.txt';
  188. eZFile::create( 'file.txt', $directory, md5( time() ) );
  189. // 1. First store to cluster, with delete option
  190. $ch = eZClusterFileHandler::instance();
  191. $ch->fileStore( $localFile, 'test', false, 'text/plain' );
  192. // 2. Check that the created file exists
  193. $ch2 = eZClusterFileHandler::instance( $localFile );
  194. self::assertTrue( $ch2->exists() );
  195. if ( !$this instanceof eZFSFileHandlerTest )
  196. {
  197. self::assertEquals( 'text/plain', $ch2->metaData['datatype'] );
  198. self::assertEquals( 'test', $ch2->metaData['scope'] );
  199. self::assertFileExists( $localFile );
  200. }
  201. self::deleteLocalFiles( $localFile );
  202. }
  203. /**
  204. * Test for the fileStoreContents() method
  205. */
  206. public function testFileStoreContents()
  207. {
  208. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  209. $ch = eZClusterFileHandler::instance();
  210. $ch->fileStoreContents( $path, md5( time() ), 'test', 'text/plain' );
  211. self::assertTrue( $ch->fileExists( $path ) );
  212. }
  213. /**
  214. * Test for the storeContents() method
  215. */
  216. public function testStoreContents()
  217. {
  218. $file = 'var/tests/' . __FUNCTION__ . '/file.txt';
  219. $contents = md5( time() );
  220. // 1. Store the file to cluster
  221. $ch = eZClusterFileHandler::instance( $file );
  222. $ch->storeContents( $contents, 'test', 'plain/text', false );
  223. $ch->loadMetaData( true );
  224. self::assertTrue( $ch->exists() );
  225. }
  226. /**
  227. * Test for the storeContents() method with a local copy
  228. */
  229. public function testStoreContentsWithLocalCopy()
  230. {
  231. $file = 'var/tests/' . __FUNCTION__ . '/file.txt';
  232. $contents = md5( time() );
  233. // 1. Store the file to cluster
  234. $ch = eZClusterFileHandler::instance( $file );
  235. $ch->storeContents( $contents, 'test', 'plain/text', true );
  236. $ch->loadMetaData( true );
  237. self::assertTrue( $ch->exists() );
  238. if ( !$this instanceof eZFSFileHandlerTest )
  239. self::assertFileExists( $file );
  240. }
  241. /**
  242. * Test for the processCache() method
  243. */
  244. public function testProcessCacheOne()
  245. {
  246. $path = 'var/tests/' . __FUNCTION__ . '/cache.txt';
  247. $extradata = array( 'content' => array( __METHOD__, 2, 3, 4 ) );
  248. $ch = eZClusterFileHandler::instance( $path );
  249. $result = $ch->processCache(
  250. array( $this, 'processCacheRetrieveCallback' ),
  251. array( $this, 'processCacheGenerateCallback' ),
  252. null, null, $extradata );
  253. $ch->loadMetaData( true );
  254. self::assertEquals( $extradata['content'], $result );
  255. self::assertTrue( $ch->exists(), "Cache file '$path' doesn't exist" );
  256. self::deleteLocalFiles( $path );
  257. }
  258. /**
  259. * Test for the processCache() method
  260. */
  261. public function testProcessCacheTwo()
  262. {
  263. $path = 'var/tests/' . __FUNCTION__ . '/cache.txt';
  264. $expected = new eZClusterFileFailure( 2, "Manual generation of file data is required, calling storeCache is required" );
  265. $ch = eZClusterFileHandler::instance( $path );
  266. $result = $ch->processCache(
  267. array( $this, 'processCacheRetrieveCallback' ),
  268. null,
  269. null, null, array() );
  270. $ch->loadMetaData( true );
  271. self::assertEquals( $expected, $result );
  272. // self::assertTrue( $ch->exists(), "Cache file '$path' doesn't exist" );
  273. self::deleteLocalFiles( $path );
  274. }
  275. /**
  276. * Generate callback used by {@link testProcessCache()}
  277. *
  278. * Will store the 'content' key from $extraData as the cached content
  279. */
  280. public function processCacheGenerateCallback( $path, $extraData )
  281. {
  282. /** Add random content ?
  283. * Idea: use extra data to carry options around from {@link testProcessCache}
  284. */
  285. return array( 'content' => $extraData['content'], 'scope' => 'test', 'datatype' => 'text/plain' );
  286. }
  287. /**
  288. * Retrieve callback used by {@link testProcessCache()}
  289. */
  290. public function processCacheRetrieveCallback( $path, $mtime, $extraData )
  291. {
  292. // Return the file's content ? A way to really manage expiry MUST be used
  293. // See examples in nodeViewFunctions
  294. // Must return what was cached by the generate callback
  295. return include( $path );
  296. }
  297. /**
  298. * Test for the isFileExpired() method
  299. */
  300. public function testIsFileExpired()
  301. {
  302. $fname = 'var/tests/' . __FUNCTION__ . '/file.txt';
  303. $ch = eZClusterFileHandler::instance();
  304. // Negative mtime: expired
  305. $mtime = -1;
  306. $expiry = -1;
  307. $curtime = time();
  308. $ttl = null;
  309. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  310. self::assertTrue( $result, "negative mtime: expired expected" );
  311. // FALSE mtime: expired
  312. $mtime = false;
  313. $expiry = -1;
  314. $curtime = time();
  315. $ttl = null;
  316. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  317. self::assertTrue( $result, "false mtime: expired expected" );
  318. // NULL TTL + mtime < expiry: expired
  319. $mtime = time() - 3600; // mtime < expiry
  320. $expiry = time();
  321. $curtime = time();
  322. $ttl = null;
  323. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  324. self::assertTrue( $result,
  325. "no TTL + mtime < expiry: expired expected" );
  326. // NULL TTL + mtime > expiry: not expired
  327. $mtime = time();
  328. $expiry = time() - 3600; // expires in the future
  329. $curtime = time();
  330. $ttl = null;
  331. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  332. self::assertFalse( $result,
  333. "no TTL + mtime > expiry: not expired expected" );
  334. // TTL != null, mtime < curtime - ttl: expired
  335. $mtime = time();
  336. $expiry = -1; // disable expiry check
  337. $curtime = time();
  338. $ttl = 60; // 60 seconds TTL
  339. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  340. self::assertFalse( $result,
  341. "TTL + ( mtime < ( curtime - ttl ) ): !expired expected" );
  342. // TTL != null, mtime > curtime - ttl: not expired
  343. $mtime = time() - 90; // old file
  344. $expiry = -1; // disable expiry check
  345. $curtime = time();
  346. $ttl = 60; // 60 seconds TTL
  347. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  348. self::assertTrue( $result,
  349. "TTL + ( mtime > ( curtime - ttl ) ): expired expected" );
  350. // TTL != null, mtime < expiry: expired
  351. $mtime = time() - 90; // old file
  352. $expiry = time(); // file is expired
  353. $curtime = time();
  354. $ttl = 60; // 60 seconds TTL
  355. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  356. self::assertTrue( $result,
  357. "TTL + ( mtime < expiry ): expired expected" );
  358. // TTL != null, mtime > expiry: not expired
  359. $mtime = time();
  360. $expiry = time() - 90;
  361. $curtime = time();
  362. $ttl = 60;
  363. $result = $ch->isFileExpired( $fname, $mtime, $expiry, $curtime, $ttl);
  364. self::assertFalse( $result,
  365. "TTL + ( mtime > expiry ): !expired expected" );
  366. }
  367. /**
  368. * Test for the isExpired() method
  369. */
  370. public function testIsExpired()
  371. {
  372. // file will be created with current time as mtime()
  373. $path = 'var/tests/' . __FUNCTION__. '/file.txt';
  374. $this->createFile( $path, md5( time() ) );
  375. $clusterHandler = eZClusterFileHandler::instance( $path );
  376. // expiry date < mtime / no TTL: !expired
  377. self::assertFalse( $clusterHandler->isExpired( $expiry = time() - 3600, time(), null ),
  378. "expiry date < mtime, no TTL, !expired expected" );
  379. // expiry date > mtime / no TTL: !expired
  380. self::assertTrue( $clusterHandler->isExpired( $expiry = time() + 3600, time(), null ),
  381. "expiry date > mtime, no TTL, expired expected" );
  382. // mtime < curtime - ttl: !expired
  383. self::assertFalse( $clusterHandler->isExpired( $expiry = -1, time(), 60 ),
  384. "mtime < curtime - ttl: !expired expected" );
  385. // mtime > curtime - ttl: expired
  386. self::assertTrue( $clusterHandler->isExpired( $expiry = -1, time(), -60 ),
  387. "mtime > curtime - ttl: expired expected" );
  388. }
  389. /**
  390. * Test for the storeCache() method
  391. */
  392. public function testStoreCache()
  393. {
  394. self::markTestIncomplete();
  395. }
  396. /**
  397. * Test for the processFile() method
  398. */
  399. public function testProcessFile()
  400. {
  401. self::markTestIncomplete();
  402. }
  403. /**
  404. * Test for the fileFetchContents() method
  405. */
  406. public function testFileFetchContents()
  407. {
  408. // Create a file
  409. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  410. $contents = __METHOD__;
  411. $this->createFile( $path, $contents );
  412. $ch = eZClusterFileHandler::instance();
  413. self::assertEquals( $contents, $ch->fileFetchContents( $path ) );
  414. }
  415. /**
  416. * Test for the fileFetchContents() method on a non-existing file
  417. */
  418. public function testFileFetchContentsNonExistingFile()
  419. {
  420. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  421. $ch = eZClusterFileHandler::instance();
  422. self::assertFalse( $ch->fileFetchContents( $path ) );
  423. }
  424. /**
  425. * Test for the fetchContents() method
  426. */
  427. public function testFetchContents()
  428. {
  429. // Create a file
  430. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  431. $contents = __METHOD__;
  432. $this->createFile( $path, $contents );
  433. $ch = eZClusterFileHandler::instance( $path );
  434. self::assertEquals( $contents, $ch->fetchContents() );
  435. }
  436. /**
  437. * Test for the fetchContents() method with a non-existing file
  438. */
  439. public function testFetchContentsNonExistingFile()
  440. {
  441. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  442. $ch = eZClusterFileHandler::instance( $path );
  443. self::assertFalse( $ch->fetchContents() );
  444. }
  445. /**
  446. * Test for the stat() method
  447. */
  448. public function testStat()
  449. {
  450. self::markTestIncomplete();
  451. }
  452. /**
  453. * Test for the size() method
  454. */
  455. public function testSize()
  456. {
  457. self::markTestIncomplete();
  458. }
  459. /**
  460. * Test for the mtime() method
  461. */
  462. public function testMtime()
  463. {
  464. self::markTestIncomplete();
  465. }
  466. /**
  467. * Test for the name() method
  468. */
  469. public function testName()
  470. {
  471. self::markTestIncomplete();
  472. }
  473. /**
  474. * Test for the fileDeleteByDirList() method
  475. */
  476. public function testFileDeleteByDirList()
  477. {
  478. self::markTestIncomplete();
  479. }
  480. /**
  481. * Test for the fileDelete() method
  482. */
  483. public function testFileDelete()
  484. {
  485. // Create a file
  486. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  487. $this->createFile( $path, md5( time() ) );
  488. $ch = eZClusterFileHandler::instance();
  489. // Check if it exists
  490. self::assertTrue( $ch->fileExists( $path ) );
  491. // Delete the file
  492. $ch->fileDelete( $path );
  493. // Re-check the file
  494. self::assertFalse( $ch->fileExists( $path ) );
  495. }
  496. /**
  497. * Test for the delete() method
  498. */
  499. public function testDelete()
  500. {
  501. // Create a file
  502. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  503. $this->createFile( $path, md5( time() ) );
  504. $ch = eZClusterFileHandler::instance( $path );
  505. // Check if it exists
  506. self::assertTrue( $ch->exists(), "File doesn't exist after creation" );
  507. // Delete the file
  508. $ch->delete();
  509. // Re-check the file
  510. self::assertFalse( $ch->exists(), "File still exists after deletion" );
  511. }
  512. /**
  513. * Test for the purge() method
  514. */
  515. public function testPurge()
  516. {
  517. self::markTestIncomplete();
  518. }
  519. /**
  520. * Test for the exists() method
  521. */
  522. public function testExists()
  523. {
  524. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  525. $ch = eZClusterFileHandler::instance( $path );
  526. // file hasn't been created yet
  527. self::assertFalse( $ch->exists(), "The file hasn't been created, exists() should have returned false" );
  528. $this->createFile( $path, md5( time() ) );
  529. $ch->loadMetaData( true );
  530. self::assertTrue( $ch->exists(), "The file been created, exists() should have returned true" );
  531. }
  532. /**
  533. * Test for the fileExists() method
  534. */
  535. public function testFileExists()
  536. {
  537. $path = 'var/tests/' . __FUNCTION__ . '/file.txt';
  538. $ch = eZClusterFileHandler::instance();
  539. // file hasn't been created yet
  540. self::assertFalse( $ch->fileExists( $path ), "The file hasn't been created, exists() should have returned false" );
  541. $this->createFile( $path, md5( time() ) );
  542. $ch->loadMetaData( true );
  543. self::assertTrue( $ch->fileExists( $path ), "The file been created, exists() should have returned true" );
  544. }
  545. /**
  546. * Test for the stat() method
  547. */
  548. public function testPassthrough()
  549. {
  550. self::markTestIncomplete( "Deprecated" );
  551. }
  552. /**
  553. * Test for the fileCopy() method
  554. */
  555. public function testFileCopy()
  556. {
  557. // Create a file
  558. $sourcePath = 'var/tests/' . __FUNCTION__ . '/file-source.txt';
  559. $destinationPath = 'var/tests/' . __FUNCTION__ . '/file-target.txt';
  560. $this->createFile( $sourcePath, 'contents' );
  561. $ch = eZClusterFileHandler::instance();
  562. // check existence on both
  563. self::assertTrue( $ch->fileExists( $sourcePath ), "Source file doesn't exist" );
  564. self::assertFalse( $ch->fileExists( $destinationPath ), "Destination file already exists" );
  565. // copy the file
  566. $ch->fileCopy( $sourcePath, $destinationPath );
  567. // check existence on both
  568. self::assertTrue( $ch->fileExists( $sourcePath ), "Source file no longer exists" );
  569. self::assertTrue( $ch->fileExists( $destinationPath ), "Destination file doesn't exist" );
  570. self::deleteLocalFiles( $sourcePath, $destinationPath );
  571. }
  572. /**
  573. * Test for the fileLinkCopy() method
  574. */
  575. public function testFileLinkCopy()
  576. {
  577. self::markTestIncomplete();
  578. }
  579. /**
  580. * Test for the fileMove() method
  581. */
  582. public function testFileMove()
  583. {
  584. // Create a file
  585. $sourcePath = 'var/tests/' . __FUNCTION__ . '/file-source.txt';
  586. $destinationPath = 'var/tests/' . __FUNCTION__ . '/file-target.txt';
  587. $this->createFile( $sourcePath, 'contents' );
  588. $ch = eZClusterFileHandler::instance();
  589. // check existence on both
  590. self::assertTrue( $ch->fileExists( $sourcePath ), "Source file doesn't exist" );
  591. self::assertFalse( $ch->fileExists( $destinationPath ), "Destination file already exists" );
  592. // copy the file
  593. $ch->fileMove( $sourcePath, $destinationPath );
  594. // check existence on both
  595. self::assertFalse( $ch->fileExists( $sourcePath ), "Source file still longer exists" );
  596. self::assertTrue( $ch->fileExists( $destinationPath ), "Destination file doesn't exist" );
  597. self::deleteLocalFiles( $sourcePath, $destinationPath );
  598. }
  599. /**
  600. * Test for the move() method
  601. */
  602. public function testMove()
  603. {
  604. // Create a file
  605. $sourcePath = 'var/tests/' . __FUNCTION__ . '/file-source.txt';
  606. $destinationPath = 'var/tests/' . __FUNCTION__ . '/file-target.txt';
  607. $this->createFile( $sourcePath, 'contents' );
  608. $ch = eZClusterFileHandler::instance( $sourcePath );
  609. // check existence on both
  610. self::assertTrue( $ch->fileExists( $sourcePath ), "Source file doesn't exist" );
  611. self::assertFalse( $ch->fileExists( $destinationPath ), "Destination file already exists" );
  612. // copy the file
  613. $ch->move( $destinationPath );
  614. // check existence on both
  615. self::assertFalse( $ch->fileExists( $sourcePath ), "Source file still longer exists" );
  616. self::assertTrue( $ch->fileExists( $destinationPath ), "Destination file doesn't exist" );
  617. self::deleteLocalFiles( $sourcePath, $destinationPath );
  618. }
  619. /**
  620. * Test for the eZClusterFileHandler::preFork() global method
  621. */
  622. public function testPreFork(){}
  623. }
  624. ?>