コード例 #1
0
ファイル: StorageTest.php プロジェクト: kankje/xi-filelib
 public function setUp()
 {
     $this->adapter = $this->getMockedStorageAdapter();
     $this->cache = $this->getMockBuilder('Xi\\Filelib\\Storage\\RetrievedCache')->disableOriginalConstructor()->getMock();
     $this->storage = new Storage($this->adapter, $this->cache);
     $this->ed = $this->getMockedEventDispatcher();
     $filelib = $this->getMockedFilelib(null, array('storage' => $this->storage, 'ed' => $this->ed));
     $this->storage->attachTo($filelib);
     $this->exception = new \Exception('Throw you like an exception');
     $this->resource = Resource::create();
     $this->version = Version::get('version');
     $this->file = File::create(array('created_at' => new DateTime()));
 }
コード例 #2
0
ファイル: FileLibrary.php プロジェクト: kankje/xi-filelib
 public function __construct($storageAdapter, $backendAdapter, EventDispatcherInterface $eventDispatcher = null, $tempDir = null)
 {
     if (!$eventDispatcher) {
         $eventDispatcher = new EventDispatcher();
     }
     if (!$tempDir) {
         $tempDir = sys_get_temp_dir();
     }
     if (!$tempDir instanceof TemporaryFileManager) {
         $tempDir = new TemporaryFileManager($tempDir);
     }
     $this->temporaryFileManager = $tempDir;
     $this->backendAdapter = $backendAdapter;
     $this->eventDispatcher = $eventDispatcher;
     $this->profileManager = new ProfileManager($this->eventDispatcher);
     $this->pluginManager = new PluginManager($this);
     $this->backend = new Backend($this->getEventDispatcher(), $this->backendAdapter);
     $this->storage = new Storage($storageAdapter);
     $this->storage->attachTo($this);
     $this->addProfile(new FileProfile('default'));
 }