Reputation: 13811
I am new to codeception and I am using it to test a web service I am creating in laravel 5. So my main config file looks like so:
codeception.yml
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: 'mysql:host=localhost;dbname=carparts'
user: 'root'
password: 'SomePassword'
dump: tests/_data/dump.sql
And the suite file called api.suite.yml looks like so:
class_name: ApiTester
modules:
enabled:
- Laravel5
- REST:
url: http://localhost:8000/api/
depends: PhpBrowser
config:
Laravel5:
cleanup: true
environment_file: .env.testing
I also copy pasted the whole dump of my database carparts
into the dump.sql
file but still when I run the tests, I still see new users created which are being created in the tests. What am I missing? Where am I going wrong?
Upvotes: 0
Views: 293
Reputation: 13811
So I did not know that in order to rollback the DB I need to enable the Db module:
class_name: ApiTester
modules:
enabled:
- Laravel5
- Db
- REST:
url: http://localhost:8000/api/
depends: PhpBrowser
config:
Laravel5:
cleanup: true
environment_file: .env.testing
And that did it.
Upvotes: 1