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"); } }
/** * @param FileLibrary $filelib */ public function attachTo(FileLibrary $filelib) { $this->fileRepository = $filelib->getFileRepository(); $this->profiles = $filelib->getProfileManager(); $this->storage = $filelib->getStorage(); $this->eventDispatcher = $filelib->getEventDispatcher(); }
/** * @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())); }
/** * @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(); }
/** * @param FileLibrary $filelib */ public function attachTo(FileLibrary $filelib) { $this->storage = $filelib->getStorage(); }
/** * @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()); }