Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Db] Change to disconnect on initialise breaks tests where Db is used in _beforeSuite #18

Open
M1ke opened this issue May 16, 2017 · 1 comment

Comments

@M1ke
Copy link

M1ke commented May 16, 2017

What are you trying to achieve?

A helper runs code to modify the database in _beforeSuite in order to add control rows before any tests are run.

What do you get instead?

The code crashes upon trying to run SQL as the connection has been terminated. This was new behaviour added by Codeception/Codeception@5e2c999

Easiest fix would be to create a public method on Db to ensure that the connection is open before running code if config has reconnect. The quickest route would just be to make connect() public.

Details

  • Codeception version: 2.2.11
  • PHP Version: 7.0.19
  • Operating System: Ubuntu 16.04 LTS
  • Installation type: Composer
  • List of installed packages (composer show) not relevant
  • Suite configuration:
    config:
        Db:
            dsn: 'mysql:host=localhost;dbname=XXXX;charset=utf8'
            user: 'root'
            password: ''
            dump: 'tests/_data/schema.sql'
            populate: true
            cleanup: false
            reconnect: true
@Mprint
Copy link

Mprint commented May 23, 2017

** I've the same issue**
PHP Fatal error: Call to a member function getDbh() on null in \Module\Db.php on line 335

removed field from .yml "recconent: true" helped me

@Naktibalda Naktibalda transferred this issue from Codeception/Codeception Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants