Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
15 changes: 15 additions & 0 deletions .env.postgres.travis
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
APP_ENV=testing
APP_KEY=base64:NTrXToqFZJlv48dgPc+kNpc3SBt333TfDnF1mDShsBg=
APP_URL=http://localhost:8000

DB_CONNECTION=pgsqltesting
DB_TEST_HOST=127.0.0.1
DB_TEST_DATABASE=monica
DB_TEST_USERNAME=postgres
DB_TEST_PASSWORD=

CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync

2FA_ENABLED=true
62 changes: 43 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,35 @@ language: php

php:
- 7.1
- 7.2

services:
- mysql
- postgresql

env:
matrix:
- DB=mysql
- DB=postgres
global:
# - SAUCELABS=1

matrix:
include:
- php: 7.1
env:
- DB=mysql
- SELENIUM=1
- COVERAGE=1
exclude:
- php: 7.1
env: DB=mysql
- php: 7.2
env: DB=postgres
allow_failures:
- php: 7.2
- env: DB=postgres
fast_finish: true

jdk:
- oraclejdk8
Expand All @@ -14,47 +40,45 @@ git:
depth: false

addons:
postgresql: "9.6"
chrome: stable
# sauce_connect:
# username: "asbiin"
# jwt:
# secure: "niuYhwCsFVUHS6DU3j0xi24habQOSqKpzo7qUlGmlx1x31wZNDrl+wfifeTVv6nnjoShyr4s6svn3ULl1K8tQMdyHJlO247WKMg/PSnaSUyll5+luuP5SLpV+USP8g9a7HAjU+jQO5uE/GXKDDQcD+o5dV6gv9stmc9u/np45kwgVx55bj013ll0M5qlyflJZFgp3b/M+bvqkvIFDPN2U7iFs0dkhqxBI+6qbTAN4aTtxPSPrsYdt9W8Re1suzy2/CJEEQ2xKE4zm7WQ2dg6BrpbaU2bdG6wWZUw2toA8iCyxFgbJUlXmAjPEQ5Wr+gWEQ9bLcwCIoHxUMIRbqY/SNzve7KnGXOUEF0yttyAv3aq9STA58Mr+H15zXdA5ZAwpE/tNojfaacEya/bg9fwUWOCqrPXIhwFirhf8oD2y8n+SWD27rP0qD9um9HGqGkh6bqFefIZi2xVzLya1r/2kxqFskrj+0xPjjKYwMwJIM5s7HyrtIxR7QTpFEbgHpZjCmT31I65ds56ec34wbZ0W61bm4aQAxz7UIedCYsTrqtTzTYxUJEht3/1D5FH0PSBWQACJmdjSHvh0pP7zzG2cqzq2IhHCSZjnhh6LGUPQtgZh3kq1fSP0Zw74iSVrxQETsGoPwYA6R38e+V39vV8yUHjMUXNPIhgcQQZHiZcEWI="

env:
global:
# - SAUCELABS=1

before_script:
- cp .env.travis .env
- mkdir -p $TRAVIS_BUILD_DIR/results/coverage
- mysql -e 'create database monica;'
- cp .env.$DB.travis .env
- if [[ "$DB" == "mysql" ]]; then mysql -v -e 'CREATE DATABASE monica;'; fi
- if [[ "$DB" == "postgres" ]]; then psql -e -c 'CREATE DATABASE monica;' -U postgres; fi
- composer self-update
- travis_retry composer install --no-interaction --prefer-dist --no-suggest
- if [ ! "$SAUCELABS" = "1" ]; then .ci/start-selenium.sh; fi
- if [[ "$SELENIUM" == "1" && ! "$SAUCELABS" == "1" ]]; then .ci/start-selenium.sh; fi

script:
- php artisan migrate --env=testing --no-interaction -vvv
- php artisan db:seed --env=testing --no-interaction -vvv

# Run unit tests
- vendor/bin/phpunit
- vendor/bin/phpunit -c phpunit${DB/mysql/}.xml

# Start http server
- php -S 127.0.0.1:8000 -t $TRAVIS_BUILD_DIR/public $TRAVIS_BUILD_DIR/.ci/server-cc.php &
- until $(nc -z localhost 8000); do sleep 1; echo Waiting for laravel server to start...; done;
- bash -c "if [[ \"$SELENIUM\" == \"1\" ]]; then php -S 127.0.0.1:8000 -t $TRAVIS_BUILD_DIR/public $TRAVIS_BUILD_DIR/.ci/server-cc.php; fi" &
- if [[ "$SELENIUM" == "1" ]]; then until $(nc -z localhost 8000); do sleep 1; echo Waiting for laravel server to start...; done; fi

# Run browser tests
- if [ "$SAUCELABS" = "1" ]; then vendor/bin/steward run travis chrome -vvv --server-url=http://$SAUCE_USERNAME:$SAUCE_ACCESS_KEY@localhost:4445 --capability="tunnel-identifier:'${TRAVIS_JOB_NUMBER}'"; fi
- if [ ! "$SAUCELABS" = "1" ]; then vendor/bin/steward run travis chrome -vvv; fi
- if [[ "$SELENIUM" == "1" && "$SAUCELABS" = "1" ]]; then vendor/bin/steward run travis chrome -vvv --server-url=http://$SAUCE_USERNAME:$SAUCE_ACCESS_KEY@localhost:4445 --capability="tunnel-identifier:'${TRAVIS_JOB_NUMBER}'"; fi
- if [[ "$SELENIUM" == "1" && ! "$SAUCELABS" = "1" ]]; then vendor/bin/steward run travis chrome -vvv; fi

after_script:
- vendor/bin/steward results -vvv
- .ci/travis-report.sh 2>/dev/null
- cat selenium-server.log
- cat selenium-node.log
- vendor/bin/phpcov merge --clover=$TRAVIS_BUILD_DIR/results/coverage2.xml $TRAVIS_BUILD_DIR/results/coverage/
- bash <(curl -s https://codecov.io/bash)
- ./travis-sonar.sh
- if [[ "$SELENIUM" == "1" ]]; then vendor/bin/steward results -vvv; fi
- if [[ "$SELENIUM" == "1" ]]; then .ci/travis-report.sh 2>/dev/null; fi
- if [[ "$SELENIUM" == "1" ]]; then cat selenium-server.log; fi
- if [[ "$SELENIUM" == "1" ]]; then cat selenium-node.log; fi
- if [[ "$COVERAGE" == "1" ]]; then vendor/bin/phpcov merge --clover=$TRAVIS_BUILD_DIR/results/coverage2.xml $TRAVIS_BUILD_DIR/results/coverage/; fi
- if [[ "$COVERAGE" == "1" ]]; then bash <(curl -s https://codecov.io/bash); fi
- if [[ "$COVERAGE" == "1" ]]; then ./travis-sonar.sh; fi

cache:
directories:
Expand Down
Binary file modified .travis.yml.sig
Binary file not shown.
29 changes: 21 additions & 8 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@
],

'testing' => [
'driver' => 'mysql',
'host' => env('DB_TEST_HOST'),
'database' => env('DB_TEST_DATABASE'),
'username' => env('DB_TEST_USERNAME'),
'password' => env('DB_TEST_PASSWORD'),
'charset' => 'utf8',
'driver' => 'mysql',
'host' => env('DB_TEST_HOST'),
'database' => env('DB_TEST_DATABASE'),
'username' => env('DB_TEST_USERNAME'),
'password' => env('DB_TEST_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'prefix' => '',
'strict' => false,
],

'pgsql' => [
Expand All @@ -90,6 +90,19 @@
'schema' => 'public',
],

'pgsqltesting' => [
'driver' => 'pgsql',
'host' => env('DB_TEST_HOST'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_TEST_DATABASE'),
'username' => env('DB_TEST_USERNAME'),
'password' => env('DB_TEST_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'schema' => 'public',
],

],

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class ChangeGiftColumnStructure extends Migration
*/
public function up()
{
DB::statement('ALTER TABLE gifts MODIFY about_object_id INTEGER;');
Schema::table('gifts', function (Blueprint $table) {
$table->integer('about_object_id')->change();
});

Schema::table('gifts', function ($table) {
$table->dropColumn([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DeleteContactFieldsFromContacts extends Migration
public function up()
{
Schema::table('contacts', function (Blueprint $table) {
$table->dropIndex('unique_for_each_account_email_pair');
$table->dropUnique('unique_for_each_account_email_pair');
$table->dropColumn('email');
$table->dropColumn('phone_number');
$table->dropColumn('street');
Expand Down
53 changes: 53 additions & 0 deletions phpunitpostgres.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Unit Tests">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>

<testsuite name="Helpers Tests">
<directory suffix="Test.php">./tests/Helper</directory>
</testsuite>

<testsuite name="Feature Tests">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>

<testsuite name="Api Tests">
<directory suffix="Test.php">./tests/Api</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
<exclude>
<file>./app/Http/routes.php</file>
</exclude>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="base64:NTrXToqFZJlv48dgPc+kNpc3SBt333TfDnF1mDShsBg="/>
<env name="DB_CONNECTION" value="pgsqltesting"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_DATABASE" value="monica"/>
<env name="DB_USERNAME" value="postgres"/>
<env name="DB_PASSWORD" value=""/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
<logging>
<log type="coverage-clover" target="./results/coverage.xml"/>
<log type="junit" target="./results/junit.xml"/>
</logging>
</phpunit>