laravel错误调用未定义的方法Illuminate\Hashing\BcryptHasher :: driver()

I. *_*rak 3 phpunit laravel

我正在尝试测试我的laravel应用程序,运行phpunit,但得到一个错误:

Error: Call to undefined method Illuminate\Hashing\BcryptHasher::driver()
Run Code Online (Sandbox Code Playgroud)

laravel 5.5,PHPUnit 7.0

我的用户测试:

namespace Tests\Feature;

use App\User;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;

class UserTest extends TestCase
{
   use RefreshDatabase;

   /** @test */
   function name_should_not_be_too_long()
   {
      $response = $this->post('/users', [
          'name' => str_repeat('a', 51),
          'email' => $this->user->email,
          'password' => 'secret',
      ]);

      $response->assertStatus(302);
      $response->assertSessionHasErrors([
          'name' => 'The name may not be greater than 50 characters.'
      ]);
  }
Run Code Online (Sandbox Code Playgroud)

}

Gaz*_*ben 6

在CreatesApplication类中更改以下行:

Hash::driver('bcrypt')->setRounds(4); 
Run Code Online (Sandbox Code Playgroud)

对此:

Hash::setRounds(4); 
Run Code Online (Sandbox Code Playgroud)

在那之后,做一个 composer dumpautoload

如果仍然没有运气,降级到phpunit 6.0.