0

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?

2
  • Do you use Innodb engine? Show your CREATE TABLE statement. Commented Nov 9, 2015 at 14:10
  • I am looking at the DB in PhpMyAdmin and all the tables are Inndodb. Commented Nov 10, 2015 at 5:09

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.