Commit ab55e18f authored by Igor Wiedler's avatar Igor Wiedler

[mount] check for invalid appPath in LazyApplication

parent d7c280e9
......@@ -45,6 +45,10 @@ class LazyApplication
$this->app = require $this->appPath;
}
if (!$this->app instanceof Application) {
throw new \InvalidArgumentException('The provided path did not return a Silex\Application on inclusion.');
}
return $this->app;
}
}
......@@ -109,4 +109,21 @@ EOF
unlink($tmp);
}
public function testLazyMountWithAnInvalidExternalFile()
{
$tmp = sys_get_temp_dir().'/SilexInvalidLazyApp.php';
file_put_contents($tmp, '');
$mounted = new LazyApplication($tmp);
$app = new Application();
$app->mount('/hello', $mounted);
try {
$app->handle(Request::create('/hello/Silex'));
$this->fail('Invalid LazyApplications should throw an exception.');
} catch (\InvalidArgumentException $e) {
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment