예제 #1
0
 public function testCallForwarder()
 {
     $manager = new MountManager();
     $mock = Mockery::mock('League\\Flysystem\\FilesystemInterface');
     $mock->shouldReceive('aMethodCall')->once()->andReturn('a result');
     $manager->mountFilesystem('prot', $mock);
     $this->assertEquals($manager->aMethodCall('prot://file.ext'), 'a result');
 }
예제 #2
0
파일: App.php 프로젝트: samwilson/swidau
 /**
  * Get the filesystem manager.
  *
  * @return MountManager
  * @throws \Exception
  */
 public static function getFilesystem()
 {
     $config = new Config();
     $manager = new MountManager();
     foreach ($config->filesystems() as $name => $fsConfig) {
         $adapterName = '\\League\\Flysystem\\Adapter\\' . self::camelcase($fsConfig['type']);
         $adapter = new $adapterName($fsConfig['root']);
         $fs = new Filesystem($adapter);
         $manager->mountFilesystem($name, $fs);
     }
     return $manager;
 }
예제 #3
0
 /**
  * Mainly passes through to parent class, but before it does this method
  * checks that the passed in directory exists.
  *
  * @return void
  **/
 public function mount($prefix, $location)
 {
     if (is_dir($location)) {
         return parent::mountFilesystem($prefix, new Filesystem(new FilesystemAdapter($location)));
     }
 }
예제 #4
0
파일: Manager.php 프로젝트: aleksabp/bolt
 /**
  * Mounts a local filesystem if the directory exists.
  *
  * @param string $prefix
  * @param string $location
  *
  * @return $this
  */
 public function mount($prefix, $location)
 {
     return parent::mountFilesystem($prefix, $this->createFilesystem($location));
 }
예제 #5
0
 public function testListWith()
 {
     $manager = new MountManager();
     $response = ['path' => 'file.ext', 'timestamp' => time()];
     $mock = Mockery::mock('League\\Flysystem\\FilesystemInterface');
     $mock->shouldReceive('listWith')->with(['timestamp'], 'file.ext', false)->once()->andReturn($response);
     $manager->mountFilesystem('prot', $mock);
     $this->assertEquals($response, $manager->listWith(['timestamp'], 'prot://file.ext', false));
 }