Skip to content

Commit 1b9acd0

Browse files
authored
Merge pull request #113 from moufmouf/mysql8
Adding Travis tests for MySQL 8
2 parents 2bdfa14 + 7bde41c commit 1b9acd0

File tree

7 files changed

+380
-170
lines changed

7 files changed

+380
-170
lines changed

.travis.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ matrix:
1212
env: PREFER_LOWEST="" DB=mysql COVERALLS=true
1313
- php: 7.1
1414
env: PREFER_LOWEST="--prefer-lowest" DB=mysql
15+
- php: 7.1
16+
env: PREFER_LOWEST="" DB=mysql8
17+
sudo: required
18+
services:
19+
- docker
1520
- php: 7.1
1621
env: PREFER_LOWEST="" DB=mariadb
1722
addons:
@@ -63,7 +68,15 @@ before_script:
6368
- if [ -z "$NO_WEAKREF" ] ; then pecl install weakref-beta; fi
6469
script:
6570
# Let's run the Oracle script only when the password is available (it is not available in forks unfortunately)
66-
- if [ "$DB" != "oracle" ] ; then ./vendor/bin/phpunit $PHPUNITFILE; else docker run -v $(pwd):/app -v $(pwd)/tests/Fixtures/oracle-startup.sql:/docker-entrypoint-initdb.d/oracle-startup.sql moufmouf/oracle-xe-php vendor/bin/phpunit $PHPUNITFILE; fi
71+
- |
72+
if [ "$DB" == "oracle" ] ; then
73+
docker run -v $(pwd):/app -v $(pwd)/tests/Fixtures/oracle-startup.sql:/docker-entrypoint-initdb.d/oracle-startup.sql moufmouf/oracle-xe-php vendor/bin/phpunit $PHPUNITFILE;
74+
elif [ "$DB" == "mysql8" ] ; then
75+
sudo /etc/init.d/mysql stop;
76+
tests/phpunit-mysql8.sh
77+
else
78+
./vendor/bin/phpunit $PHPUNITFILE;
79+
fi
6780
- composer phpstan
6881
- composer require-checker
6982
after_script:

phpunit.mariadb.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,4 @@
3434
</exclude>
3535
</whitelist>
3636
</filter>
37-
<logging>
38-
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
39-
<log type="coverage-clover" target="build/logs/clover.xml"/>
40-
</logging>
4137
</phpunit>

phpunit.mysql8.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
bootstrap="vendor/autoload.php"
12+
>
13+
<testsuites>
14+
<testsuite name="TDBM Test Suite">
15+
<directory>./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<php>
20+
<!-- "Real" test database -->
21+
<var name="db_host" value="127.0.0.1" />
22+
<var name="db_username" value="root" />
23+
<var name="db_password" value="" />
24+
<var name="db_name" value="tdbm_testcase" />
25+
<var name="db_port" value="3306"/>
26+
<var name="db_driver" value="pdo_mysql"/>
27+
</php>
28+
29+
<filter>
30+
<whitelist processUncoveredFilesFromWhitelist="true">
31+
<directory suffix=".php">src/</directory>
32+
<exclude>
33+
<directory suffix=".php">src/Test</directory>
34+
</exclude>
35+
</whitelist>
36+
</filter>
37+
</phpunit>

tests/TDBMServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ public function testFindObjectsFromSqlHierarchyUp()
757757
'users',
758758
'login LIKE :login OR login LIKE :login2',
759759
array('login' => 'robert.marley', 'login2' => 'bill.shakespeare'),
760-
null,
760+
'users.login DESC',
761761
null,
762762
TDBMObject::class
763763
);

tests/phpunit-mysql8.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
# Use this file to start a MySQL8 database using Docker and then run the test suite on the MySQL8 database.
4+
5+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
cd $DIR
7+
cd ..
8+
9+
docker run --rm --name mysql8-tdbm-test -p 3306:3306 -p 33060:33060 -e MYSQL_ROOT_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -d mysql:8 mysqld --default-authentication-plugin=mysql_native_password
10+
11+
# Let's wait for MySQL 8 to start
12+
sleep 20
13+
14+
vendor/bin/phpunit -c phpunit.mysql8.xml
15+
RESULT_CODE=$?
16+
17+
docker stop mysql8-tdbm-test
18+
19+
exit $RESULT_CODE

0 commit comments

Comments
 (0)