Skip to content

Commit bd12cf5

Browse files
committed
Set up travis build
1 parent 064b287 commit bd12cf5

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: php
2-
sudo: false
2+
services: mysql
33

44
php:
55
- 7.2
@@ -8,7 +8,14 @@ cache:
88
directories:
99
- build/.composer-cache
1010

11+
env:
12+
- PHPUNIT_MYSQL_HOSTNAME="127.0.0.1"
13+
- PHPUNIT_MYSQL_DATABASE="travis_test"
14+
- PHPUNIT_MYSQL_USERNAME="travis"
15+
- PHPUNIT_MYSQL_PASSWORD=""
16+
1117
before_install:
18+
- mysql -e "CREATE DATABASE `travis_test`;"
1219
- export COMPOSER_CACHE_DIR="$(pwd)/build/.composer-cache"
1320
- export XDEBUG="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"
1421
- mv -v "$XDEBUG" "$XDEBUG.disabled"

phpunit.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</whitelist>
1212
</filter>
1313
<php>
14-
<env name="phpunit_mysql_hostname" value="localhost" />
15-
<env name="phpunit_mysql_database" value="phpunit_tests" />
16-
<env name="phpunit_mysql_username" value="root" />
17-
<env name="phpunit_mysql_password" value="toor" />
14+
<env name="PHPUNIT_MYSQL_HOSTNAME" value="localhost" />
15+
<env name="PHPUNIT_MYSQL_DATABASE" value="phpunit_tests" />
16+
<env name="PHPUNIT_MYSQL_USERNAME" value="root" />
17+
<env name="PHPUNIT_MYSQL_PASSWORD" value="toor" />
1818
</php>
1919
</phpunit>

tests/helpers/TestPersonModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function getSpouse(): ?self
9292
return $this->record->getRelatedModel('spouse');
9393
}
9494

95-
public function getHome(): self
95+
public function getHome(): TestHouseModel
9696
{
9797
return $this->record->getRelatedModel('home');
9898
}

tests/helpers/TestPersonSchema.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class TestPersonSchema extends StaticSchema
2323
protected static $relationships = [
2424
'parents' => [
2525
'key' => 'id',
26-
'schema' => self::class,
26+
'schema' => TestParentSchema::class,
2727
'field' => 'child_id',
2828
],
2929
'children' => [
3030
'key' => 'id',
31-
'schema' => self::class,
31+
'schema' => TestParentSchema::class,
3232
'field' => 'parent_id',
3333
],
3434
'spouse' => [
@@ -44,7 +44,7 @@ class TestPersonSchema extends StaticSchema
4444
],
4545
'home' => [
4646
'key' => 'home_id',
47-
'schema' => self::class,
47+
'schema' => TestHouseSchema::class,
4848
'field' => 'id',
4949
],
5050
];

tests/tests/MySqlIntegrationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class MySqlIntegrationTest extends IntegrationTestCase
2222
protected static function createConnection(): Connection
2323
{
2424
return new MySqlConnection(new MySqlConnectionProvider(
25-
$_ENV['phpunit_mysql_hostname'],
26-
$_ENV['phpunit_mysql_database'],
27-
$_ENV['phpunit_mysql_username'],
28-
$_ENV['phpunit_mysql_password']
25+
$_ENV['PHPUNIT_MYSQL_HOSTNAME'],
26+
$_ENV['PHPUNIT_MYSQL_DATABASE'],
27+
$_ENV['PHPUNIT_MYSQL_USERNAME'],
28+
$_ENV['PHPUNIT_MYSQL_PASSWORD']
2929
));
3030
}
3131

0 commit comments

Comments
 (0)