My model method relies on the config()
global, here;
public function getGroup()
{
if(config('app.pages.'.$this->group.'.0')) {
return $this->group;
}
return "city";
}
I am trying to test this method in my unit test class, here;
public function testGetGroupReturnsCityAsDefault()
{
$response = new Response();
$response->group = "town";
$test = $response->getGroup();
dd($test);
}
The error I get is;
Error: Call to a member function make() on null
/home/vagrant/sites/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:62
/home/vagrant/sites/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:163
I know this is related to the config() global. But not sure how to set it in my test. I tried
public function setUp()
{
config(['app.pages' => [
'city' => [........
But got the same error. How can I set this up?
Aucun commentaire:
Enregistrer un commentaire