public function testRegister() { $app = new Application(array('resources' => new Standard(__DIR__))); $provider = new ThumbnailProvider(); $app->register($provider); $this->assertArrayHasKey('files', $app['thumbnails.paths']); $this->assertArrayHasKey('theme', $app['thumbnails.paths']); $app['request'] = Request::create('/'); $this->assertInstanceOf('Bolt\\Thumbs\\ThumbnailResponder', $app['thumbnails']); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $app['thumbnails.response']); }
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; }
/** * It is mandatory to disable translation caching, otherwise it creates * difficulties with regard to testing in isolation. * * For example, without disabling translation caching, `testDefaultTranslationLoading()` * passes, but the following tests fail, as the cached messages are loaded * instead of re-building the whole message catalogue. * * @param Application $app */ protected function registerTranslationServiceWithCachingDisabled(Application $app) { $app->register(new \Silex\Provider\TranslationServiceProvider(), ['translator.cache_dir' => null, 'locale_fallbacks' => [Application::DEFAULT_LOCALE]]); }