_waitPeriod = 0; $path = $this->_config->local_directory; // If the test directory exists, remove it and replace it if (file_exists($path)) { $this->_rmRecursive($path); } mkdir($path, 0755); } public function testGetClient() { $this->assertTrue(is_string($this->_commonStorage->getClient())); } public function testNoParams() { $this->markTestSkipped('No config params needed for FileSystem'); } // TODO: Create a custom test for FileSystem that checks fetchMetadata() with file system MD. public function testFetchMetadata() { $this->markTestIncomplete('FileSystem doesn\'t support writable metadata.'); } public function testStoreMetadata() { $this->markTestSkipped('FileSystem doesn\'t support writable metadata.'); } public function testDeleteMetadata() { $this->markTestSkipped('FileSystem doesn\'t support writable metadata.'); } /** * Tears down this test case * * @return void */ public function tearDown() { $path = $this->_config->local_directory; // If the test directory exists, remove it if(file_exists($path)) { $this->_rmRecursive($path); } parent::tearDown(); } protected function _rmRecursive($path) { // Tidy up the path $path = realpath($path); if (!file_exists($path)) { return true; } else if (!is_dir($path)) { return unlink($path); } else { foreach (scandir($path) as $item) { if (!($item == '.' || $item == '..')) { $this->_rmRecursive($item); } } return rmdir($path); } } protected function _getConfig() { $config = new Zend_Config(array( Zend_Cloud_StorageService_Factory::STORAGE_ADAPTER_KEY => 'Zend_Cloud_StorageService_Adapter_Filesystem', Zend_Cloud_StorageService_Adapter_FileSystem::LOCAL_DIRECTORY => dirname(__FILE__) . '/../_files/data/FileSystemTest', )); return $config; } } if (PHPUnit_MAIN_METHOD == 'Zend_Cloud_StorageService_Adapter_FileSystemTest::main') { Zend_Cloud_StorageService_Adapter_FileSystemTest::main(); }