run functional test and I got Exception

In Advance Template, trying to run a simple functional test, but I got DB Exception

Here is the test code

# AboutCept.php #


use tests\codeception\frontend\FunctionalTester;

use tests\codeception\frontend\_pages\AboutPage;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);

$I->wantTo('ensure that about works');


$I->see('About', 'h1');

And here is my codecept command

codecept run functional AboutCept

And this is the output

SQLSTATE[23000]: Integrity constraint violoation: 1451 Cannot delete or update a parent row: a foreign key constraint fails 

(`codecept`.`city`, CONSTRAINT `FK_city_user` FOREIGN KEY (`created_by`) REFERENCES `user` (`id`)).

The SQL being executed was: DELETE FROM `user`

I dont understand where in the AboutCept that do the delete user ? So frustrated :angry:

any ideas ?


I am not sure about problem, but try to run same example in book… if it works… then your configuration is fine :)

Please read below book for your clarification

the issue is i set foreign keys constraint in all tables.

When Codecept tries to loadFixtures() and unloadFixtures(), it fails because of foreign key constraints set in tables.

I found out about Global Db Fixtures which will disable integrity checks ( but I dont know how to use/setup it.

I post more when I figure it out