jeudi 16 février 2017

Config class not found when unit testing laravel package

I'm working on a Laravel (5.4) package, and I'm trying to do unit testing. I have this class :

<?php

namespace Sample;

class Foo
{
    public function getConfig()
    {
        $config = \Config::get('test');

        return $config;
    }   
}

I have this test :

<?php

use PHPUnit\Framework\TestCase;
use Sample\Foo;

class FooTest extends TestCase
{
    public function testGetConfig()
    {
        $foo = new Foo;
        $config = $foo->getConfig();
    }
}

When I execute phpunit I have this error :

Error: Class 'Config' not found

How can I unit test this class ?

Thank you.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lmJ0GH
via IFTTT

Aucun commentaire:

Enregistrer un commentaire