コード例 #1
0
 public function attachTo(FileLibrary $filelib)
 {
     $this->storage = $filelib->getStorage();
     $this->adapter = $filelib->getStorage()->getAdapter()->resolve();
     if (!$this->adapter instanceof FilesystemStorageAdapter) {
         throw new InvalidArgumentException("Symlink filesystem publisher requires filesystem storage");
     }
 }
コード例 #2
0
ファイル: Renderer.php プロジェクト: kankje/xi-filelib
 /**
  * @param FileLibrary $filelib
  */
 public function attachTo(FileLibrary $filelib)
 {
     $this->fileRepository = $filelib->getFileRepository();
     $this->profiles = $filelib->getProfileManager();
     $this->storage = $filelib->getStorage();
     $this->eventDispatcher = $filelib->getEventDispatcher();
 }
コード例 #3
0
 /**
  * @test
  * @group luszo
  */
 public function deletesExclusiveResource()
 {
     $upload = ROOT_TESTS . '/data/self-lussing-manatee.jpg';
     $file = $this->filelib->getFileRepository()->upload($upload, null, 'tussi');
     $this->filelib->getFileRepository()->delete($file);
     $this->ed->dispatch(Events::FILE_AFTER_DELETE, Argument::type('Xi\\Filelib\\Event\\FileEvent'))->shouldHaveBeenCalled();
     $this->assertFalse($this->filelib->getStorage()->exists($file->getResource()));
 }
コード例 #4
0
 /**
  * @test
  */
 public function updates()
 {
     $resource = Resource::create(['id' => 'xoo-xoo-xoo']);
     $res = $this->op->create($resource, ROOT_TESTS . '/data/self-lussing-manatee.jpg');
     $this->assertSame($res, $resource);
     $this->assertNotFalse($this->op->find($res->getId()));
     $this->assertNotFalse($this->filelib->getStorage()->exists($resource));
     $this->op->update($res);
     $this->ed->dispatch(Events::RESOURCE_BEFORE_UPDATE, Argument::type('Xi\\Filelib\\Event\\ResourceEvent'))->shouldHaveBeenCalled();
     $this->ed->dispatch(Events::RESOURCE_AFTER_UPDATE, Argument::type('Xi\\Filelib\\Event\\ResourceEvent'))->shouldHaveBeenCalled();
 }
コード例 #5
0
 /**
  * @param FileLibrary $filelib
  */
 public function attachTo(FileLibrary $filelib)
 {
     $this->storage = $filelib->getStorage();
 }
コード例 #6
0
ファイル: FileLibraryTest.php プロジェクト: kankje/xi-filelib
 /**
  * @test
  */
 public function adaptersCanBeGivenLazily()
 {
     $storageAdapter = function () {
         return $this->getMockedStorageAdapter();
     };
     $backendAdapter = function () {
         return $this->getMockedBackendAdapter();
     };
     $filelib = new FileLibrary($storageAdapter, $backendAdapter);
     $this->assertInstanceOf('Xi\\Filelib\\Storage\\Storage', $filelib->getStorage());
     $this->assertInstanceOf('Xi\\Filelib\\Backend\\Backend', $filelib->getBackend());
 }