Using Codeception with Travis CI

Today I ran into the problem of connecting Codeception to Travis CI inside a Laravel application.
After a little research, I ended up doing the following (if you feel like just jumping into the answer, here is a gist of the files I used. Adapt as needed or keep reading):

  1. Referring to Codeception at my composer.json:

    "require-dev": {
        "codeception/codeception": "^2.1"
  2. Telling Travis to install the composer dependencies at the .travis.yml:

            - composer self-update
            - composer install

    This command will:

    1. Update the composer itself
    2. Install the dependencies listed on composer.json, including Codeception
  3. Referring to the newly installed codecept binary inside the script part of the .travis.yml file:

    script: php vendor/codeception/codeception/codecept run

That's it! Following these steps will allow you to run your Codecept tests inside Travis CI. You can link this to a Laravel app or any other kind of PHP code you'd like.

Gist for the whole thing x-post