I only want the sql dump to only load at the start of the api suite so i set up
populate: true
cleanup: false
But i got told that the table already exist ?
Provide console output if related. Use
-vvvmode for more details.
[RuntimeException]
Error Output:
[Codeception\Exception\ModuleException]
Db: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'cities'
already exists
a couple a days ago it is running fine, i think it have something to do with the newer codeception version.
but when i turn the setting to:
populate: true
cleanup: true
It is running fine but it is re-load the sql dump each test which i do not want.
composer show)class_name: ApiTester
modules:
enabled:
- \Helper\Api
- Db
- REST:
url: /my-url/
depends: PhpBrowser
depends: Laravel5
config:
Laravel5:
cleanup: true
environment_file: .env.testing
Db:
dsn: 'mysql:host=localhost;dbname=testing-db'
user: 'root'
password: ''
dump: 'tests/_data/dump.sql'
populate: true
cleanup: false
You should use the cleanup method of the Laravel module or the Db module, but not of both. If you use it from the Laravel module, disable it for the Db module, and vice versa.
Did this work before and stopped working after an update? Or is this your first try?
Yes it did work before, a couple of days ago.
The laravel cleanup method doesn't work for me (don't know why, i have tried it in the acception test too, creating a user but it doesn't get deleted when the test is finished) so i using the Db modules to reset the database before test suite.
I rollback the codeception from 2.2.6 to 2.2.5 and all the way to 2.2.0 but none is working.
If i'm running it on an empty database then it work but not the already exist database.
It keep saying that tables already exist instead of delete the database and repopulate it using dump.sql file.
It working fine if i also config the cleanup: true, but not if the cleanup: false
Solve it by adding option of "DROP TABLE IF EXIST" for the dump mysql file.
Don't know why option "cleanup=true" work, i think it delete the entire database and then run the sql file.
Most helpful comment
Solve it by adding option of "DROP TABLE IF EXIST" for the dump mysql file.
Don't know why option "cleanup=true" work, i think it delete the entire database and then run the sql file.