Пример #1
0
 public function testCreateService()
 {
     $sm = Bootstrap::getServiceManager();
     $manager = $sm->get('BsbFlysystemAdapterManager');
     $factory = new VfsAdapterFactory();
     $adapter = $factory->createService($manager, null, null);
     $this->assertInstanceOf('League\\Flysystem\\Vfs\\VfsAdapter', $adapter);
 }
 public function testCreateService()
 {
     $sm = Bootstrap::getServiceManager();
     $manager = $sm->get('BsbFlysystemAdapterManager');
     $factory = new DropboxAdapterFactory();
     $adapter = $factory->createService($manager, 'dropboxdefault', 'dropbox_default');
     $this->assertInstanceOf('League\\Flysystem\\Dropbox\\DropboxAdapter', $adapter);
 }
 public function testCreateService()
 {
     $sm = Bootstrap::getServiceManager();
     $manager = $sm->get('BsbFlysystemAdapterManager');
     $factory = new AzureAdapterFactory(['account-name' => 'foo', 'account-key' => 'bar', 'container' => 'container']);
     $adapter = $factory->createService($manager, 'azuredefault', 'azure_default');
     $this->assertInstanceOf('League\\Flysystem\\Azure\\AzureAdapter', $adapter);
 }
 public function testCreateService()
 {
     $this->markTestSkipped('Skipped because Aws3Sv2 and Aws3Sv3 are not compatible.');
     $sm = Bootstrap::getServiceManager();
     $manager = $sm->get('BsbFlysystemAdapterManager');
     $factory = new AwsS3AdapterFactory();
     $adapter = $factory->createService($manager, 'awss3default', 'awss3_default');
     $this->assertInstanceOf('League\\Flysystem\\AwsS3v2\\AwsS3Adapter', $adapter);
 }
 public function testCreateViaServiceManager()
 {
     $sm = Bootstrap::getServiceManager();
     $manager = $sm->get('BsbFlysystemManager');
     $this->assertInstanceOf('BsbFlysystem\\Service\\FilesystemManager', $manager);
 }
 public function testCreateViaServiceManagerNull()
 {
     $sm = Bootstrap::getServiceManager();
     $manager = $sm->get('BsbFlysystemAdapterManager');
     $this->assertInstanceOf('League\\Flysystem\\Adapter\\NullAdapter', $manager->get('null_default'));
 }
Пример #7
0
        return $config;
    }
    public static function chroot()
    {
        $rootPath = dirname(static::findParentPath('vendor'));
        chdir($rootPath);
    }
    /**
     * @return ServiceManager
     */
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();
Bootstrap::chroot();