I'm using Laravel and Codeception to do acceptance testing. Most of my tests require users to be logged in, so I wanted to extract those behaviours to the _bootstrap.php file inside the acceptance folder. I understand this is the practice for running setup prior to your tests, in Codeception.
I can confirm that my users table exists (I'm viewing it using Navicat), and that a user with an id of 1 exists. Codeception, to the best of my knowledge, is properly configured to use this database. I also have included the Laravel4 and Db modules for the acceptance suite. I receive the following error when I try to run my acceptance suite, or any individual acceptance Cept.
console:
[Illuminate\Database\QueryException]
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "users" does not exist
LINE 1: select * from "users" where "id" = $1 limit 1
^ (SQL: select * from "users" where "id" = 1 limit 1)
I get this error regardless of the contents of any of the acceptance Cepts. Even a simple $I->amOnPage('/'), or $I->comment('test') still results in the error. I believe the error occurs as soon as it encounters the command in the _bootstrap.php file. Somehow it's able to access my database. I should note that I've also tried various combinations of enabling and disabling the populate and cleanup settings for the Laravel4 and Db modules, to no avail.
Here is my acceptance/_bootstrap.php file:
<?php
Auth::loginUsingId(1);
codeception.yml:
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
config:
Db:
dsn: 'pgsql:host=localhost;dbname=myapp'
user: 'someuser'
password: 'somepass'
dump: tests/_data/dump.sql
acceptance.suite.yml:
class_name: AcceptanceTester
modules:
enabled:
- AcceptanceHelper
- Laravel4
- PhpBrowser
- Db
config:
PhpBrowser:
url: 'http://localhost'
Laravel4:
cleanup: false
Db:
populate: true
cleanup: false