Skip to content

Commit

Permalink
Revert "Fix: One phpunit.xml to rule them all"
Browse files Browse the repository at this point in the history
This reverts commit a59b713.
  • Loading branch information
vlucas committed Jul 10, 2015
1 parent 6d4d272 commit 7dab02c
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 13 deletions.
11 changes: 3 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
},
"autoload": {
"psr-4": {
"Spot\\": "lib/"
"Spot\\": "lib/",
"SpotTest\\": "tests/"
}
}
}
28 changes: 28 additions & 0 deletions phpunit_mysql.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/init.php"
>
<php>
<env name="SPOT_DB_TYPE" value="mysql" />
<env name="SPOT_DB_DSN" value="mysql://root@localhost/spot_test" />
</php>

<testsuites>
<testsuite name="Spot2 ORM">
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">./lib</directory>
</whitelist>
</filter>
</phpunit>
28 changes: 28 additions & 0 deletions phpunit_pgsql.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/init.php"
>
<php>
<env name="SPOT_DB_TYPE" value="pgsql" />
<env name="SPOT_DB_DSN" value="pgsql://postgres@localhost/spot_test" />
</php>

<testsuites>
<testsuite name="Spot2 ORM">
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">./lib</directory>
</whitelist>
</filter>
</phpunit>
9 changes: 7 additions & 2 deletions phpunit.xml → phpunit_sqlite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
syntaxCheck="false"
bootstrap="./tests/init.php"
>
<php>
<env name="SPOT_DB_TYPE" value="sqlite" />
<env name="SPOT_DB_DSN" value="sqlite::memory:" />
</php>

<testsuites>
<testsuite name="Spot">
<directory suffix=".php">./tests/SpotTest</directory>
<testsuite name="Spot2 ORM">
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
<filter>
Expand Down
3 changes: 1 addition & 2 deletions tests/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7dab02c

Please sign in to comment.