You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For who stumbles on this, i've solved it by adding a middleware when running in debug + test mode which looks for a duskconfig get param.
Something along these lines:
public function handle($request, Closure $next)
{
$shouldHandle = false;
//Only handle the DuskRuntimeConfig when debug=TRUE and environment=testing
if(config('app.debug') && app()->environment() == 'testing'){
//Do an extra check for hostname and environment
if(in_array($request->getHttpHost(), ['localhost:8000', '127.0.0.1:8000'])){
$shouldHandle = true;
}
}
if($shouldHandle){
if($request->has('duskconfig')){
$configValues = json_decode($request->get('duskconfig'), true);
if(sizeof($configValues) > 0){
foreach($configValues as $key => $value){
config([$key => $value]);
}
}
}
}
return $next($request);
}
Would be great if we could modify a config value with config helper in tests (or in
setUp()
):This doesn't seem to work no matter where I place the
config()->set()
command.The text was updated successfully, but these errors were encountered: