I'm trying to write tests for my PHP backend with codeception. At one point I needed to test if there are changes made to the database.
I (tried) to follow the steps on the codeception tutorial but it wont work. I have installed the Db module via composer and added the config in my *.suite.yml and my codeception.yml, neither of them worked. Neither the AcceptanceTester class nor the FunctionalTester class contains any database related functions.
Every tutorial I found said "just use the functions", but without explaining how to get them/add them to the Tester. The tutorial on the codeception site just installs the module and without any explanation uses the functions, not even saying in which suite.
I also tried to create a Integration test, but couldn't find any source that describes how to do it properly. In my understanding (from the official page) I created a new integration.suite.yml file (see below) and created a test with it. But the tester still not recognizing any database functions.
codeception.yml:
extensions:
enabled:
- Codeception\Extension\RunFailed
- Db:
dsn: 'mysql:host=localhost;dbname=XXX'
user: 'XXX'
password: 'XXX'
dump: 'tests/_data/dump.sql'
populate: true
cleanup: true
populator: 'mysql -u $user -h $host $dbname < $dump'
integration.suite.yml
actor: UnitTester
modules:
enabled:
- Asserts
- Db
- \Helper\Unit
Aucun commentaire:
Enregistrer un commentaire