Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Commit

Permalink
Add travis conf
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlap committed Jun 28, 2017
1 parent a3c39b0 commit 8a0652f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
anguage: php

php:
- 7.0
- 7.1

services:
- mysql

# This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

## Cache composer
cache:
directories:
- $HOME/.composer/cache

env:
matrix:
- COMPOSER_FLAGS="--prefer-lowest"

before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist
- mysql -e 'create database laravel_approvable;' -uroot

script:
- vendor/bin/phpcs --standard=psr2 src/
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- |
if [[ "$TRAVIS_PHP_VERSION" != '7.0' ]]; then
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
fi
2 changes: 1 addition & 1 deletion tests/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class User extends Model
*/
protected $table = 'users';

protected $fillable = ['name'];
protected $fillable = ['name', 'email'];
}
21 changes: 14 additions & 7 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,26 @@ public function setUp()
{
parent::setUp();

$this->artisan('migrate', ['--database' => 'testing']);
$this->artisan('migrate');
}

/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
* @return void
* @param \Illuminate\Foundation\Application $app
*/
protected function getEnvironmentSetUp($app)
{
// set up database configuration
$app['config']->set('database.default', 'testing');
$app['config']->set('database.default', 'mysql');
$app['config']->set('database.connections.mysql', [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'laravel_approvable',
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
]);
}

/**
Expand Down

0 comments on commit 8a0652f

Please sign in to comment.