orchestral/testbench

Package Test ignores test case environment setup

mostafakram opened this issue · 7 comments

When running ./vendor/bin/testbench package:test --parallel --no-coverage i get error Access denied for user ''@'localhost' to database 'forge'

The app is seeing my connection as mysql although in my testcase i set it to testing for sqlite

class TestCase extends Orchestra {
public function getEnvironmentSetUp($app)
    {
        config()->set('database.default', 'testing');
    }
}

And ./vendor/bin/phpunit runs normally as expected

This happened after i ran composer update. I am now running "orchestra/testbench": "6.20.1" on php 7.4

I don't think parallel testing support memory based SQLite.

Thank you for your response sir

But it supports it sir and it was working before

the issue is not only with parallel testing it occurs too while running ./vendor/bin/testbench package:test

Nothing changed on Testbench side.

Ok thank you i will try to debug more and check what have changed,

sorry of inconvenient 👐

hi ,
i have the same problem. every thing i set in defineEnvironment method in TestCase did not effect the package.

if you find the solution, please share with me

i found the solution
you probably forgot to call $this->mergeConfigFrom() in your service provider

Thanks @hans-thomas for your answer but its not my issue, i am using Spatie Laravel Package tools and it calls mergeConfigFrom by default.