Skip to content

Commit 945e74c

Browse files
committed
Create integration tests
Signed-off-by: Cy Rossignol <[email protected]>
1 parent 7f02463 commit 945e74c

23 files changed

+2087
-34
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
/.gitignore export-ignore
44
/.scrutinizer.yml export-ignore
55
/.travis.yml export-ignore
6+
/docker-compose.yml export-ignore
7+
/phpcs.xml.dist export-ignore
68
/phpspec.yml.dist export-ignore
79
/phpunit.xml.dist export-ignore
10+
/start-cluster.sh export-ignore
811
/tests export-ignore

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
build/
2+
cluster/
23
docs/
34
vendor/
45
composer.phar
56
composer.lock
7+
docker-compose.override.yml
8+
phpcs.xml
69
phpspec.yml
710
phpunit.xml

.travis.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
language: php
22
dist: trusty
3+
sudo: false
34

45
php:
56
- 5.4
67
- 5.5
78
- 5.6
89
- 7.0
910
- 7.1
11+
- 7.2
1012
- hhvm
1113

1214
env:
13-
- LARAVEL_VERSION=5.0.*
15+
- LARAVEL_VERSION=5.0.* NO_BROADCAST=1
1416
- LARAVEL_VERSION=5.1.*
1517
- LARAVEL_VERSION=5.2.*
1618
- LARAVEL_VERSION=5.3.*
17-
- LUMEN_VERSION=5.0.*
19+
- LUMEN_VERSION=5.0.* NO_BROADCAST=1
1820
- LUMEN_VERSION=5.1.*
1921
- LUMEN_VERSION=5.2.*
2022
- LUMEN_VERSION=5.3.*
@@ -38,16 +40,22 @@ matrix:
3840
- php: 5.5
3941
env: LUMEN_VERSION=5.3.*
4042
- php: 7.1
41-
env: LARAVEL_VERSION=5.0.*
43+
env: LARAVEL_VERSION=5.0.* NO_BROADCAST=1
4244
- php: 7.1
43-
env: LUMEN_VERSION=5.0.*
45+
env: LUMEN_VERSION=5.0.* NO_BROADCAST=1
46+
- php: 7.2
47+
env: LARAVEL_VERSION=5.0.* NO_BROADCAST=1
48+
- php: 7.2
49+
env: LUMEN_VERSION=5.0.* NO_BROADCAST=1
4450

45-
before_script:
51+
before_install:
4652
- if [ -n "$LARAVEL_VERSION" ]; then composer remove --dev --no-update "laravel/lumen-framework"; fi
4753
- if [ -n "$LARAVEL_VERSION" ]; then composer require --no-update "laravel/framework:$LARAVEL_VERSION"; fi
4854
- if [ -n "$LUMEN_VERSION" ]; then composer remove --dev --no-update "laravel/framework"; fi
4955
- if [ -n "$LUMEN_VERSION" ]; then composer require --no-update "laravel/lumen-framework:$LUMEN_VERSION"; fi
50-
- composer install --prefer-source --no-interaction
5156

52-
script:
53-
- vendor/bin/phpunit
57+
install: travis_retry composer install --prefer-dist --no-interaction --no-suggest
58+
59+
before_script: SUPERVISE=no travis_retry ./start-cluster.sh || { cat ./cluster/*.log; false; }
60+
61+
script: vendor/bin/phpunit --exclude-group ${LUMEN_VERSION:+laravel-only},${NO_BROADCAST:+broadcasting}

docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "3"
2+
3+
services:
4+
5+
cluster:
6+
image: redis:alpine
7+
entrypoint: ./start-cluster.sh
8+
working_dir: /project
9+
user: "${CONTAINER_USER_ID:-root:root}"
10+
environment:
11+
BIND_ADDRESS: "0.0.0.0"
12+
SENTINEL_PORTS: "26379-26381"
13+
REDIS_GROUP_1: "service1 6379-6381"
14+
REDIS_GROUP_2: "service2 6382-6384"
15+
LOGGING: "yes"
16+
ports:
17+
- "6379-6384:6379-6384"
18+
- "26379-26381:26379-26381"
19+
volumes:
20+
- ./:/project
21+
22+
tests:
23+
image: phpunit/phpunit:latest
24+
entrypoint: vendor/bin/phpunit --colors=always
25+
network_mode: host
26+
user: "${CONTAINER_USER_ID:-root:root}"
27+
volumes:
28+
- ./:/app

phpunit.xml.dist

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
stopOnFailure="false">
1313

1414
<testsuites>
15-
<testsuite name="Example">
16-
<directory>tests</directory>
15+
<testsuite name="unit">
16+
<directory>tests/Unit</directory>
17+
</testsuite>
18+
<testsuite name="integration">
19+
<directory>tests/Integration</directory>
1720
</testsuite>
1821
</testsuites>
1922

@@ -23,11 +26,23 @@
2326
</whitelist>
2427
</filter>
2528

29+
<php>
30+
<!-- Integration test configuration: -->
31+
<const name="TEST_REDIS_SENTINEL_HOST"
32+
value="127.0.0.1:26379,127.0.0.1:26380,127.0.0.1:26381"/>
33+
<const name="TEST_REDIS_SENTINEL_SERVICE" value="service1"/>
34+
<const name="TEST_REDIS_DATABASE" value="15"/>
35+
<const name="TEST_MAX_CONNECTION_TIMEOUT" value="5.0"/>
36+
<const name="TEST_MIN_CONNECTION_TIMEOUT" value="0.1"/>
37+
</php>
38+
39+
<!--
2640
<logging>
2741
<log type="tap" target="build/report.tap"/>
2842
<log type="junit" target="build/report.junit.xml"/>
2943
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
3044
<log type="coverage-text" target="build/coverage.txt"/>
3145
<log type="coverage-clover" target="build/clover.xml"/>
3246
</logging>
47+
-->
3348
</phpunit>

0 commit comments

Comments
 (0)