コード例 #1
0
ファイル: FilesystemTest.php プロジェクト: cargomedia/cm
 public function testSecondary()
 {
     $dirTmp = CM_Bootloader::getInstance()->getDirTmp();
     $filesystem = new CM_File_Filesystem(new CM_File_Filesystem_Adapter_Local($dirTmp));
     $filesystemSecondary = $this->getMockBuilder('CM_File_Filesystem')->disableOriginalConstructor()->setMethods(array('write', 'read', 'rename', 'copy', 'append', 'delete', 'ensureDirectory', 'deleteByPrefix'))->getMock();
     $filesystemSecondary->expects($this->once())->method('write')->with('/foo', 'hello');
     $filesystemSecondary->expects($this->never())->method('read');
     $filesystemSecondary->expects($this->once())->method('append')->with('/foo', 'world');
     $filesystemSecondary->expects($this->once())->method('rename')->with('/foo', '/bar');
     $filesystemSecondary->expects($this->once())->method('copy')->with('/bar', '/foo');
     $filesystemSecondary->expects($this->once())->method('delete')->with('/bar');
     $filesystemSecondary->expects($this->once())->method('ensureDirectory')->with('/my-dir');
     $filesystemSecondary->expects($this->once())->method('deleteByPrefix')->with('/my-dir');
     /** @var CM_File_Filesystem $filesystemSecondary */
     $filesystem->addSecondary($filesystemSecondary);
     $filesystem->write('/foo', 'hello');
     $filesystem->read('/foo');
     $filesystem->append('/foo', 'world');
     $filesystem->rename('/foo', '/bar');
     $filesystem->copy('/bar', '/foo');
     $filesystem->delete('/bar');
     $filesystem->ensureDirectory('/my-dir');
     $filesystem->deleteByPrefix('/my-dir');
 }
コード例 #2
0
ファイル: File.php プロジェクト: NicolasSchmutz/cm
 /**
  * @param string $content
  */
 public function append($content)
 {
     $this->_filesystem->append($this->getPath(), $content);
     $cache = CM_Cache_Storage_Runtime::getInstance();
     $cache->delete($this->_getCacheKeyContent());
 }