コード例 #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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 public function testCreateViaServiceManager()
 {
     $sm = Bootstrap::getServiceManager();
     $manager = $sm->get('BsbFlysystemManager');
     $this->assertInstanceOf('BsbFlysystem\\Service\\FilesystemManager', $manager);
 }
コード例 #6
0
 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();