Added code coverage and styling tests, refactored

Added runTests.sh to wrap up a bunch of test starting functionality.
Moved SetupEnvironment.sh out of Bootstrap.php and into the runTests.sh
file.

Added Coverall support for line coverage.

Added php-cs-fixer for code styling testing.
This commit is contained in:
Robert Hafner 2014-04-16 00:28:38 -07:00
parent 8650586610
commit faaff0711d
7 changed files with 35 additions and 10 deletions

3
.coveralls.yml Normal file
View File

@ -0,0 +1,3 @@
src_dir: src
coverage_clover: build/logs/clover.xml
json_path: build/logs/coveralls-upload.json

2
.gitignore vendored
View File

@ -1,5 +1,4 @@
.vagrant
/.idea
/.settings
/.buildpath
@ -7,3 +6,4 @@
/composer.lock
/vendor
/report
/build

View File

@ -6,8 +6,11 @@ php:
- 5.5
before_script:
- composer install --dev
- composer self-update && composer install --dev
- vendor/tedivm/dovecottesting/SetupEnvironment.sh
script: phpunit --verbose --coverage-text
script: ./tests/runTests.sh
after_script:
- php vendor/bin/coveralls -v

View File

@ -15,7 +15,11 @@
"php": ">=5.3.0"
},
"require-dev": {
"tedivm/dovecottesting": "1.2.1"
"tedivm/dovecottesting": "1.2.1",
"phpunit/phpunit": "4.0.*",
"fabpot/php-cs-fixer": "0.4.0",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {"Fetch": "src/"}

View File

@ -11,16 +11,17 @@
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="Fetch Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/Fetch/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
</logging>
</phpunit>

View File

@ -24,9 +24,6 @@ if(getenv('TRAVIS'))
}else{
define('TESTING_ENVIRONMENT', 'VAGRANT');
define('TESTING_SERVER_HOST', '172.31.1.2');
echo 'Initializing Environment using Vagrant' . PHP_EOL;
passthru('/bin/bash ' . __DIR__ . '/../vendor/tedivm/dovecottesting/SetupEnvironment.sh');
echo 'Environment Initialized' . PHP_EOL . PHP_EOL . PHP_EOL;
}
$filename = __DIR__ .'/../vendor/autoload.php';
@ -41,4 +38,4 @@ if (!file_exists($filename)) {
}else{
$loader = require_once $filename;
$loader->add('Fetch\\Test', __DIR__);
}
}

17
tests/runTests.sh Executable file
View File

@ -0,0 +1,17 @@
#/usr/bin/env/sh
set -e
if [ ! -n "$TRAVIS" ]; then
./vendor/tedivm/dovecottesting/SetupEnvironment.sh
sleep 5
fi
echo 'Running unit tests.'
phpunit --verbose --coverage-clover build/logs/clover.xml
echo ''
echo ''
echo ''
echo 'Testing for Coding Styling Compliance.'
echo 'All code should follow PSR standards.'
./vendor/fabpot/php-cs-fixer/php-cs-fixer fix ./ --level="all" -vv --dry-run