Skip to content

Commit

Permalink
Add test config, CS rules and fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh committed Jun 8, 2016
1 parent d734eca commit bae4626
Show file tree
Hide file tree
Showing 17 changed files with 1,095 additions and 919 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
@@ -0,0 +1,15 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
10 changes: 10 additions & 0 deletions .gitattributes
@@ -0,0 +1,10 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
23 changes: 23 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,23 @@
filter:
excluded_paths: [tests/*]

checks:
php:
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 600
runs: 3
1 change: 1 addition & 0 deletions .styleci.yml
@@ -0,0 +1 @@
preset: psr2
27 changes: 27 additions & 0 deletions .travis.yml
@@ -0,0 +1,27 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- hhvm

# This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

matrix:
include:
- php: 5.5
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'

before_script:
- travis_retry composer self-update
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source

script:
- vendor/bin/phpcs --standard=psr2 src/
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi
8 changes: 8 additions & 0 deletions build/report.junit.xml
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name=":vendor Test Suite" tests="1" assertions="1" failures="0" errors="0" time="0.008358">
<testsuite name="Barryvdh\LaravelIdeHelper\ExampleTest" file="/Users/barry/Code/laravel-ide-helper/tests/MethodTest.php" tests="1" assertions="1" failures="0" errors="0" time="0.008358">
<testcase name="testCanInstantiate" class="Barryvdh\LaravelIdeHelper\ExampleTest" file="/Users/barry/Code/laravel-ide-helper/tests/MethodTest.php" line="10" assertions="1" time="0.008358"/>
</testsuite>
</testsuite>
</testsuites>
3 changes: 3 additions & 0 deletions build/report.tap
@@ -0,0 +1,3 @@
TAP version 13
ok 1 - Barryvdh\LaravelIdeHelper\ExampleTest::testCanInstantiate
1..1
12 changes: 12 additions & 0 deletions composer.json
Expand Up @@ -18,6 +18,9 @@
"symfony/class-loader": "~2.3|~3.0"
},
"require-dev": {
"phpunit/phpunit" : "4.*",
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "~2.3",
"doctrine/dbal": "~2.3"
},
"suggest": {
Expand All @@ -28,6 +31,15 @@
"Barryvdh\\LaravelIdeHelper\\": "src"
}
},
"autoload-dev": {
"psr-4": {
":vendor\\:package_name\\": "tests"
}
},
"scripts": {
"test": "phpunit",
"cs": "phpcs --standard=psr2 src/"
},
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
Expand Down
29 changes: 29 additions & 0 deletions phpunit.xml.dist
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name=":vendor Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>

0 comments on commit bae4626

Please sign in to comment.