Laravel queries stop working when using Db module for cleanup of acceptance tests #3898

NerdsvilleCEO opened this Issue Jan 8, 2017 · 3 comments


None yet

1 participant


What are you trying to achieve?

I am trying to clear the database during each acceptance test run, so that I could remove all the serialized data, and I finally got that working successfully, but to do that I had to use a different DB name so that I could drop and recreate the database.

1-3 works already

  1. Drop database if exists
  2. Recreate DB with user as owner
  3. Laravel migrations/seed
  4. Laravel queries in controller

What do you get instead?

It is saying that the relation doesn't exist
QueryException in Connection.php line 770:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "blogposts" does not exist
LINE 1: select * from "blogposts"
^ (SQL: select * from "blogposts")
in Connection.php line 770
at Connection->runQueryCallback('sele


  • Codeception version: 2.2.7

  • PHP Version: 5.6.29

  • Operating System: Centos 7.3

  • Installation type: Composer

  • Suite configuration:

actor: Tester
    tests: tests
    log: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
        - Codeception\Extension\RunFailed
            dsn: "pgsql:host=;dbname=anotherdb"
            user: ''
            password: ''
            dump: tests/_data/dump.sql

class_name: AcceptanceTester
        - WebDriver:
            url: 'http://localhost:8000'
            browser: phantomjs
            window_size: maximize
        - Db
        - Laravel5:
            part: ORM
            run_database_migrations: true
            run_database_seeder: true
            database_seeder_class: DatabaseSeeder
            environment_file: .env.testing
        - \Helper\Acceptance

Turns out it is losing the environment settings for some reason and using the .env file, even with .env.testing specified as the environment file, I modified the DB for the testing DB it was pointing to in the .env file and it now works... This is odd because migrations/seeds are running against the correct DB, and queries worked until I ran the db_dump using the Db module


Hm I have no clue what I did but it is working now... I changed everything back to old config and it works, closing this

NerdsvilleCEO commented Jan 8, 2017 edited

Ok so I found out what was happening, it seems that since phantomjs uses the app to test against it was using dev configuration for the actual app, are there any recommendations for how to conduct the testing? Should I run a separate app server for this that runs using the test environment?

@NerdsvilleCEO NerdsvilleCEO reopened this Jan 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment