I am updating my old Laravel personal project from 5.2 to 5.4. Upgrading to 5.3 seems to have gone fine, but now I'm moving on to 5.4. I ran into a problem.
The project used the old test level, so I installed the BrowserKit test package to support backward compatibility. I also created the following basic test case for Browserkit tests:
<?php namespace Tests; use Laravel\BrowserKitTesting\TestCase as BaseTestCase; abstract class BrowserKitTestCase extends BaseTestCase { use CreatesApplication; public $baseUrl = 'http://localhost'; }
Tests for models that use the normal test case work fine, but when I run any of the tests that use the BrowserKit test case, I see the following error message:
PHP Fatal error: Class 'PHPUnit\Framework\Constraint\Constraint' not found in /home/matthew/Projects/myproject/vendor/laravel/browser-kit-testing/src/Constraints/PageConstraint.php on line 10 PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php:895 Stack trace:
Google has not used this very well, and the error message is not terribly covered. This looks like a namespace because the PHPUnit\Framework\Constraint\Constraint class does not exist, but I'm not sure how to solve the problem. I upgraded version of PHPUnit to 5.7 if necessary, but this does not solve the problem. Can anyone suggest what might be the problem?
EDIT: Just thinking about trying to downgrade to version 1.0 and it seems to solve the problem for now, so maybe version 2.0 is designed to work with PHPUnit 6? However, I hope this post helps someone in the future.
source share