0

i must press enter on running tests using phpunit in Laravel 5.7.

On every test i get following Message:

1) Tests\Feature\DepartmentsTest::a_admin_can_create_a_department Mockery\Exception\BadMethodCallException: Received Mockery_1_Illuminate_Console_OutputStyle::askQuestion(), but no expectations were specified

by setting following to false, the error disappear:

public $mockConsoleOutput = false;

After that the window hangs on running the test suite and i need to press enter to run the tests.

How can i fix that?

I´am using Windows 10 + PHPUnit 7.5.1 and Laravel 5.7.19

Thanks in advance!

/** @test */
public function a_admin_can_create_a_department()
    {

        // $this->withoutExceptionHandling();

        $attributes = [
            'description' => 'Service',
            'accessible_by_depart' => true
        ];

        $this->post('/tools/api/storeDepartment', $attributes);

        $this->assertDatabaseHas('departments', $attributes);
    }

2 Answers2

1

This fixed the problem for me https://stackoverflow.com/a/48303288/2171254

After doing that, I didn't need the line public $mockConsoleOutput = false;

Greetings

Gjaa
  • 1,461
  • 1
  • 19
  • 20
0

So now I finally found the solution.

On my migration from Laravel 5.1 to Laravel 5.2 (a long time ago) i forgot to add the following lines to the config/app.php File:

    /*
    |--------------------------------------------------------------------------
    | Application Environment
    |--------------------------------------------------------------------------
    |
    | This value determines the "environment" your application is currently
    | running in. This may determine how you prefer to configure various
    | services the application utilizes. Set this in your ".env" file.
    |
    */
    'env' => env('APP_ENV', 'production'),

Now everything works fine.

Greetings Daniel