public function testItRequiresAllowedHosts() { putenv('ALLOWED_HOSTS'); // Clear env var putenv('CACHE_EXPIRATION_HOURS=1'); $this->setExpectedException(\LogicException::class, 'The ALLOWED_HOSTS configuration is missing.'); Configurator::validateEnvironment(); $this->assertEquals(500, http_response_code()); }
/** * Run the application * * @param \Symfony\Component\HttpFoundation\Request $request * @return string */ public static function run(Request $request) { self::loadEnv(); // Set things up for the resizer Configurator::validateEnvironment(); $configurator = new Configurator($request); $configurator->setupFile(getenv('ALLOWED_HOSTS')); $configurator->setHeaders(); $image = new Image($configurator->file); return $image->alterImage($configurator->config)->toBlob(); }