Skip to content

Instantly share code, notes, and snippets.

@foxted
Last active June 8, 2022 13:36
Show Gist options
  • Save foxted/0f8ed1fcc08fc79741cc to your computer and use it in GitHub Desktop.
Save foxted/0f8ed1fcc08fc79741cc to your computer and use it in GitHub Desktop.
Unit test Laravel 4.2 packages in context with Travis CI (with SQLite testing database)
language: php
php:
- 5.4
- 5.5
- 5.6
before_install:
- composer self-update
- composer create-project laravel/laravel
- cd ./laravel
- composer config repositories.[GITHUB_USERNAME] vcs [GITHUB_HTTPS_CLONE_URL]
- composer require [PACKAGE_NAME] dev-master
- composer update
- touch ./app/database/testing.sqlite
- cp ./vendor/[GITHUB_USERNAME]/[GITHUB_PACKAGE]/tests/config/database.php ./app/config/testing/
- cp ./vendor/[GITHUB_USERNAME]/[GITHUB_PACKAGE]/tests/config/app.php ./app/config/testing/
- export APP_ENV="testing"
- cd ./vendor/[GITHUB_USERNAME]/[GITHUB_PACKAGE]
script: "phpunit"
<?php
return array(
'providers' => append_config(array(
'Namespace\To\ServiceProvider'
)),
);
<?php
return array(
'default' => 'sqlite',
'connections' => array(
'sqlite' => array(
'driver' => 'sqlite',
'database' => __DIR__.'/../../database/testing.sqlite',
'prefix' => '',
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment