diff --git a/.travis.yml b/.travis.yml index 4b3c238..65822e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,13 +7,12 @@ cache: directories: - $HOME/.composer/cache -# list any PHP version you want to test against php: - 5.4 - 5.5 - 5.6 + - 7.0 -# optionally specify a list of environments, for example to test different RDBMS env: - TYPE=mysql DSN=mysql://root@localhost/spot_test - TYPE=pgsql DSN=pgsql://postgres@localhost/spot_test" @@ -28,9 +27,5 @@ before_script: - if [[ "$TYPE" == "pgsql" ]]; then psql -c 'create database spot_test;' -U postgres; fi # omitting "script:" will default to phpunit -# use the $SPOT_DB env variable to determine the phpunit.xml to use -script: phpunit --configuration phpunit.xml --coverage-text - -# configure notifications (email, IRC, campfire etc) -#notifications: -# irc: "irc.freenode.org#travis" +# use the $TYPE env variable to determine the phpunit.xml to use +script: phpunit --configuration phpunit_$TYPE.xml --coverage-text diff --git a/composer.json b/composer.json index 9efe4be..4a79ecd 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ }, "autoload": { "psr-4": { - "Spot\\": "lib/" + "Spot\\": "lib/", + "SpotTest\\": "tests/" } } } diff --git a/phpunit_mysql.xml b/phpunit_mysql.xml new file mode 100644 index 0000000..ce8a215 --- /dev/null +++ b/phpunit_mysql.xml @@ -0,0 +1,28 @@ + + + + + + + + + + ./tests + + + + + ./lib + + + diff --git a/phpunit_pgsql.xml b/phpunit_pgsql.xml new file mode 100644 index 0000000..1b474ec --- /dev/null +++ b/phpunit_pgsql.xml @@ -0,0 +1,28 @@ + + + + + + + + + + ./tests + + + + + ./lib + + + diff --git a/phpunit.xml b/phpunit_sqlite.xml similarity index 75% rename from phpunit.xml rename to phpunit_sqlite.xml index 1b21ce3..d649fb6 100644 --- a/phpunit.xml +++ b/phpunit_sqlite.xml @@ -10,9 +10,14 @@ syntaxCheck="false" bootstrap="./tests/init.php" > + + + + + - - ./tests/SpotTest + + ./tests diff --git a/tests/init.php b/tests/init.php index fe34b2d..e72c632 100644 --- a/tests/init.php +++ b/tests/init.php @@ -10,14 +10,13 @@ * Autoload test fixtures */ $autoload = require dirname(dirname(__FILE__)) . '/vendor/autoload.php'; -$autoload->add('SpotTest', __DIR__); // Date setup date_default_timezone_set('America/Chicago'); // Setup available adapters for testing $cfg = new \Spot\Config(); -$dbDsn = getenv('DSN'); +$dbDsn = getenv('SPOT_DB_DSN'); if (!empty($dbDsn)) { $cfg->addConnection('test', $dbDsn);