Skip to content

Instantly share code, notes, and snippets.

@dyon
Last active December 22, 2015 14:48
Show Gist options
  • Select an option

  • Save dyon/6487980 to your computer and use it in GitHub Desktop.

Select an option

Save dyon/6487980 to your computer and use it in GitHub Desktop.
Laravel 4 code changes to integrate Codeception.

Laravel 4 and Codeception

  • Install Codeception via Composer.
    composer require "codeception/codeception:@stable"
  • Create the bootstrap in the app directory.
    codecept bootstrap app
  • Set the PhpBrowser url config in app/tests/acceptance.suite.yml.
  • Move the codeception.yml file to the root directory.
    mv app/codeception.yml codeception.yml
  • Adjust the paths in codeception.yml to reference app/tests rather than tests.
  • Move TestCase.php to the unit tests directory.
    mv app/tests/TestCase.php app/tests/unit/TestCase.php
  • Edit TestCase.php's createApplication() method to reflect the change made in the path. return require __DIR__.'/../../../bootstrap/start.php
  • Add the following lines to app/tests/_bootstrap.php.
    include __DIR__.'/../../vendor/autoload.php'; $app = require_once __DIR__.'/../../bootstrap/start.php';
  • Edit the composer.json autoload classmap to reference the moved TestCase.php file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment