2

I have a UsersTableSeeder which generates a Passport personal token:

$user = factory(User::class)->create([
    'email' => 'someone@example.com',
]);

Artisan::call('passport:client', [
    '--personal' => 'default',
    '--no-interaction' => true,
]);

However, when I seed my tests with $this->artisan('db:seed');, I'm receiving the following error:

Mockery\Exception\BadMethodCallException: Received Mockery_1_Illuminate_Console_OutputStyle::askQuestion(), but no expectations were specified

4

1 回答 1

3

The passport:client command is failing because even with --no-interaction flag it asks for the client's name if not provided. And the test doesn't know what to answer so it fails.

The following works for me.

Artisan::call('passport:client --name=<client-name> --no-interaction --personal');

Hope it helps!

于 2019-04-01T11:04:34.333 回答