Browse Source

Adding travis configuration

Karl Hughes 7 years ago
parent
commit
97fcaab1b4
5 changed files with 76 additions and 0 deletions
  1. 29
    0
      .travis.yml
  2. 1
    0
      README.md
  3. 3
    0
      composer.json
  4. 39
    0
      tests/config.php.travis
  5. 4
    0
      travisphp.ini

+ 29
- 0
.travis.yml View File

@@ -0,0 +1,29 @@
1
+dist: trusty
2
+sudo: false
3
+
4
+language: php
5
+
6
+services:
7
+  # - mysql
8
+  - postgresql
9
+
10
+addons:
11
+  postgresql: "9.4"
12
+
13
+php:
14
+  - 5.4
15
+  - 5.5
16
+  - 5.6
17
+  - 7.0
18
+  - 7.1
19
+
20
+before_install:
21
+  - phpenv config-add travisphp.ini
22
+  - psql -c 'create database testing;' -U postgres
23
+  - psql -U postgres -c "create extension postgis"
24
+  # - mysql -e 'CREATE DATABASE testing;'
25
+  - cp tests/config.php.travis tests/config.php
26
+
27
+script:
28
+  - curl https://phar.phpunit.de/phpunit-4.8.phar -L -o phpunit.phar && chmod +x phpunit.phar
29
+  - php phpunit.phar

+ 1
- 0
README.md View File

@@ -1,5 +1,6 @@
1 1
 [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/mevdschee/php-crud-api.svg)](http://isitmaintained.com/project/mevdschee/php-crud-api "Average time to resolve an issue")
2 2
 [![Percentage of issues still open](http://isitmaintained.com/badge/open/mevdschee/php-crud-api.svg)](http://isitmaintained.com/project/mevdschee/php-crud-api "Percentage of issues still open")
3
+[![Build Status](https://travis-ci.org/mevdschee/php-crud-api.svg?branch=master)](https://travis-ci.org/mevdschee/php-crud-api)
3 4
 
4 5
 # PHP-CRUD-API
5 6
 

+ 3
- 0
composer.json View File

@@ -28,6 +28,9 @@
28 28
   "require": {
29 29
     "php": ">=5.3.0"
30 30
   },
31
+  "require-dev": {
32
+    "phpunit/phpunit": "^5.7.0"
33
+  },
31 34
   "autoload": {
32 35
     "files": ["api.php"]
33 36
   }

+ 39
- 0
tests/config.php.travis View File

@@ -0,0 +1,39 @@
1
+<?php
2
+
3
+class PHP_CRUD_API_Config
4
+{
5
+    /**
6
+     * Configure one or more database connections as associative arrays.
7
+     * Tests will be run against any database connection specified here.
8
+     *
9
+     * @var array
10
+     */
11
+    public static $config = array(
12
+        /* MySQL is disabled because v5.7 is required for all tests to pass,
13
+            and Travis only has up to MySQL 5.6 installed by default. This
14
+            will be runnable once we have a test suite that adapts to the
15
+            available MySQL version. See: https://github.com/mevdschee/php-crud-api/issues/194
16
+        array(
17
+            'dbengine' => 'MySQL',
18
+            'hostname' => 'localhost',
19
+            'username' => 'root',
20
+            'password' => 'travis',
21
+            'database' => 'testing',
22
+        ),
23
+        */
24
+        array(
25
+            'dbengine' => 'PostgreSQL',
26
+            'hostname' => 'localhost',
27
+            'username' => 'postgres',
28
+            'password' => '',
29
+            'database' => 'testing',
30
+        ),
31
+        array(
32
+            'dbengine' => 'SQLite',
33
+            'hostname' => '',
34
+            'username' => '',
35
+            'password' => '',
36
+            'database' => 'tests/sqlite.db',
37
+        ),
38
+    );
39
+}

+ 4
- 0
travisphp.ini View File

@@ -0,0 +1,4 @@
1
+mysql.default_socket = "/run/mysql-5.6/mysqld.sock"
2
+mysqli.default_socket = "/run/mysql-5.6/mysqld.sock"
3
+pdo_mysql.default_socket = "/run/mysql-5.6/mysqld.sock"
4
+error_reporting = E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED

Loading…
Cancel
Save