I’m seeing the same error, but I’m not using Codeception.
Somehow, by the time the tearDownAfterClass()
method is called, the connection to the database is closed or otherwise not available.
I was able to remove the error overriding the tearDownAfterClass()
method in the base class for all my tests:
public static function tearDownAfterClass() {
global $wpdb;
@$wpdb->check_connection();
parent::tearDownAfterClass();
}
This, of course, is not a great solution, but it works while we discover why is the connection not available at that point.