在laravel中使用phpnuit @dataProvider捕获致命错误

时间:2018-08-30 03:49:54

标签: php laravel phpunit

php 7.2.9_1
laravel 5.6.2
nginx 1.15.2
mac 10.13.6 ^_^
phpstorm 2017.1.2

我正在使用laravel学习phpunit,我遵循phpunit的文档。当我阅读@dataprovider时,我想尝试一下。所以我在Mac中键入代码,遇到错误。我无法从日志中读取任何有用的消息。有人可以告诉我我在哪里出错?

namepsace Tests\Feature

use Tests\TestCase

class ConventionTest extends TestCase{
  /**
   * @dataProvider additionProvider
   */
  public function testParent($a, $b, $expected)
  {
      $this->assertEquals($expected, $a + $b);
  }

  public function additionProvider(){
      return [
        'adding zeros'  => [0, 0, 0],
        'zero plus one' => [0, 1, 1],
        'one plus zero' => [1, 0, 1],
        'one plus one'  => [1, 1, 3]
      ];
  }
}

我跑过phpunit tests/Feature/ConventionTest.php --filter testParent的地方是结果:

PHPUnit 7.3.2 by Sebastian Bergmann and contributors.

 .
Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 918

Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 918

Call Stack:
1.6248   25745288   1. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:0
1.6257   25755464   2. Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:87
1.6257   25755464   3. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:101
1.6257   25755464   4. Illuminate\Foundation\Application->make() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:159
1.6257   25755464   5. Illuminate\Foundation\Application->make() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:741
1.6257   25755464   6. Illuminate\Foundation\Application->resolve() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php:586
1.6258   25755464   7. Illuminate\Foundation\Application->build() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php:631
1.6258   25755576   8. Illuminate\Foundation\Application->notInstantiable() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php:758


Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 918

Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 918

Call Stack:
1.6279   25766896   1. Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:0
1.6285   25787304   2. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:123
1.6286   25795952   3. Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:87
1.6286   25795952   4. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:101
1.6286   25795952   5. Illuminate\Foundation\Application->make() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:159
1.6286   25795952   6. Illuminate\Foundation\Application->make() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:741
1.6286   25795952   7. Illuminate\Foundation\Application->resolve() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php:586
1.6287   25795952   8. Illuminate\Foundation\Application->build() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php:631
1.6287   25796064   9. Illuminate\Foundation\Application->notInstantiable() /usr/local/var/www/nginxRoot/com.FromGithub/hestia/vendor/laravel/framework/src/Illuminate/Container/Container.php:758

0 个答案:

没有答案