Skip to content

Commit

Permalink
Create integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Cy Rossignol <[email protected]>
  • Loading branch information
cyrossignol committed May 9, 2018
1 parent 7f02463 commit 945e74c
Show file tree
Hide file tree
Showing 23 changed files with 2,087 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/docker-compose.yml export-ignore
/phpcs.xml.dist export-ignore
/phpspec.yml.dist export-ignore
/phpunit.xml.dist export-ignore
/start-cluster.sh export-ignore
/tests export-ignore
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
build/
cluster/
docs/
vendor/
composer.phar
composer.lock
docker-compose.override.yml
phpcs.xml
phpspec.yml
phpunit.xml
24 changes: 16 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
language: php
dist: trusty
sudo: false

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm

env:
- LARAVEL_VERSION=5.0.*
- LARAVEL_VERSION=5.0.* NO_BROADCAST=1
- LARAVEL_VERSION=5.1.*
- LARAVEL_VERSION=5.2.*
- LARAVEL_VERSION=5.3.*
- LUMEN_VERSION=5.0.*
- LUMEN_VERSION=5.0.* NO_BROADCAST=1
- LUMEN_VERSION=5.1.*
- LUMEN_VERSION=5.2.*
- LUMEN_VERSION=5.3.*
Expand All @@ -38,16 +40,22 @@ matrix:
- php: 5.5
env: LUMEN_VERSION=5.3.*
- php: 7.1
env: LARAVEL_VERSION=5.0.*
env: LARAVEL_VERSION=5.0.* NO_BROADCAST=1
- php: 7.1
env: LUMEN_VERSION=5.0.*
env: LUMEN_VERSION=5.0.* NO_BROADCAST=1
- php: 7.2
env: LARAVEL_VERSION=5.0.* NO_BROADCAST=1
- php: 7.2
env: LUMEN_VERSION=5.0.* NO_BROADCAST=1

before_script:
before_install:
- if [ -n "$LARAVEL_VERSION" ]; then composer remove --dev --no-update "laravel/lumen-framework"; fi
- if [ -n "$LARAVEL_VERSION" ]; then composer require --no-update "laravel/framework:$LARAVEL_VERSION"; fi
- if [ -n "$LUMEN_VERSION" ]; then composer remove --dev --no-update "laravel/framework"; fi
- if [ -n "$LUMEN_VERSION" ]; then composer require --no-update "laravel/lumen-framework:$LUMEN_VERSION"; fi
- composer install --prefer-source --no-interaction

script:
- vendor/bin/phpunit
install: travis_retry composer install --prefer-dist --no-interaction --no-suggest

before_script: SUPERVISE=no travis_retry ./start-cluster.sh || { cat ./cluster/*.log; false; }

script: vendor/bin/phpunit --exclude-group ${LUMEN_VERSION:+laravel-only},${NO_BROADCAST:+broadcasting}
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3"

services:

cluster:
image: redis:alpine
entrypoint: ./start-cluster.sh
working_dir: /project
user: "${CONTAINER_USER_ID:-root:root}"
environment:
BIND_ADDRESS: "0.0.0.0"
SENTINEL_PORTS: "26379-26381"
REDIS_GROUP_1: "service1 6379-6381"
REDIS_GROUP_2: "service2 6382-6384"
LOGGING: "yes"
ports:
- "6379-6384:6379-6384"
- "26379-26381:26379-26381"
volumes:
- ./:/project

tests:
image: phpunit/phpunit:latest
entrypoint: vendor/bin/phpunit --colors=always
network_mode: host
user: "${CONTAINER_USER_ID:-root:root}"
volumes:
- ./:/app
19 changes: 17 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
stopOnFailure="false">

<testsuites>
<testsuite name="Example">
<directory>tests</directory>
<testsuite name="unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>

Expand All @@ -23,11 +26,23 @@
</whitelist>
</filter>

<php>
<!-- Integration test configuration: -->
<const name="TEST_REDIS_SENTINEL_HOST"
value="127.0.0.1:26379,127.0.0.1:26380,127.0.0.1:26381"/>
<const name="TEST_REDIS_SENTINEL_SERVICE" value="service1"/>
<const name="TEST_REDIS_DATABASE" value="15"/>
<const name="TEST_MAX_CONNECTION_TIMEOUT" value="5.0"/>
<const name="TEST_MIN_CONNECTION_TIMEOUT" value="0.1"/>
</php>

<!--
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/clover.xml"/>
</logging>
-->
</phpunit>
Loading

0 comments on commit 945e74c

Please sign in to comment.