Reputation: 3444
I am a beginner with the framework Laravel 5.2.
I want to understand how the unit test work. I made this test :
public function testPageLogin()
{
$this->visit('/login')
->see('Connexion');
}
When I run the script : all is fine.
Then I made this test :
$this->visit('/login')
->type('[email protected]', 'email')
->type('toto', 'password')
->check('souvenir')
->press('Connexion')
->seePageIs('/login');
Of course the fields 'email', 'password', 'souvenir' exists in the html page. And with these values, the page "login" must be displayed because these values are not known into the DB.
When I run the script, I have a failure:
Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Co ntracts\Debug\ExceptionHandler] is not instantiable. in C:\wamp\www\ecole\vendor \laravel\framework\src\Illuminate\Container\Container.php on line 748
Where am I going wrong?
Upvotes: 12
Views: 473
Reputation: 1714
This is a known bug within Laravel when using a later version of PHPUnit. I believe this bug still hasn't been fixed;
https://github.com/laravel/framework/issues/10808
In the meantime, there's some workarounds below;
1) Instead of using the global PHPUnit, use *project*/vendor/bin/phpunit
.
2) Downgrade your version of PHPUnit so that Laravel is compatible with it, to do this, run the below commands;
composer global remove phpunit/phpunit
composer global require 'phpunit/phpunit=~4.0'
Hope this helps.
Upvotes: 3