public function testDefaultManagers() { $config = new Config\ResourceManager(new \Pimple(['rootpath' => TEST_ROOT, 'pathmanager' => new PlatformFileSystemPathFactory()])); $config->compat(); $bolt = $this->getApp(); $this->assertInstanceOf('Bolt\\Filesystem\\Filesystem', $bolt['filesystem']->getFilesystem('root')); $this->assertInstanceOf('Bolt\\Filesystem\\Filesystem', $bolt['filesystem']->getFilesystem('config')); }
public function testDefaultManagers() { $config = new Config\ResourceManager($this->loader); $config->compat(); $bolt = $this->getApp(); $this->assertInstanceOf('League\\Flysystem\\Filesystem', $bolt['filesystem']->getManager()); $this->assertInstanceOf('League\\Flysystem\\Filesystem', $bolt['filesystem']->getManager('config')); }
protected function getApp() { $sessionMock = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Session\\Session')->setMethods(array('clear'))->setConstructorArgs(array(new MockFileSessionStorage()))->getMock(); $config = new Config\ResourceManager($this->loader); $config->compat(); $bolt = new Application(array('resources' => $config)); $bolt['config']->set('general/database', array('driver' => 'sqlite', 'databasename' => 'test', 'username' => 'test', 'memory' => true)); $bolt['session'] = $sessionMock; $bolt['resources']->setPath('files', __DIR__ . "/files"); $bolt->initialize(); return $bolt; }
protected function initializeResponder($request) { $config = new ResourceManager(__DIR__); $config->setPath('cache', 'tmp/cache'); $config->setPath('files', 'images'); $config->compat(); $app = new Application(array('resources' => $config)); $app->register(new \Bolt\Provider\CacheServiceProvider()); $responder = new ThumbnailResponder($app, $request); $responder->initialize(); return $responder; }
protected function initializeResponder($request) { $container = new Pimple(array('rootpath' => __DIR__, 'pathmanager' => new PlatformFileSystemPathFactory())); $config = new ResourceManager($container); $config->setPath('cache', 'tmp/cache'); $config->setPath('files', 'images'); $config->compat(); $app = new Application(array('resources' => $config)); $app->register(new CacheServiceProvider()); $responder = new ThumbnailResponder($app, $request); $responder->initialize(); return $responder; }
public function testCustomRequest() { $request = Request::create('/bolt/test/location', 'GET', [], [], [], ['HTTP_HOST' => 'test.dev', 'SERVER_PROTOCOL' => 'https']); $config = new ResourceManager(new \Pimple(['rootpath' => TEST_ROOT, 'request' => $request, 'pathmanager' => new PlatformFileSystemPathFactory()])); $config->compat(); $app = new Application(['resources' => $config]); $this->assertEquals('https', $config->getRequest('protocol')); $this->assertEquals('test.dev', $config->getRequest('hostname')); $this->assertEquals('http://bolt.dev/bolt/test/location', $config->getUrl('canonical')); }
public function testCustomRequest() { $request = Request::create("/bolt/test/location", "GET", array(), array(), array(), array('HTTP_HOST' => 'test.dev', 'SERVER_PROTOCOL' => 'https')); $config = new ResourceManager($this->loader, $request); $config->compat(); $app = new Application(array('resources' => $config)); $this->assertEquals("https", $config->getRequest("protocol")); $this->assertEquals("test.dev", $config->getRequest("hostname")); $this->assertEquals("https://bolt.dev/bolt/test/location", $config->getUrl("canonical")); }