コード例 #1
0
 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'));
 }
コード例 #2
0
 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'));
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 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'));
 }
コード例 #7
0
 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"));
 }