Skip to content

Commit

Permalink
Add activator for Phinject integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaud Fabre committed Feb 10, 2015
1 parent 5921711 commit d53fede
Show file tree
Hide file tree
Showing 20 changed files with 425 additions and 82 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
composer.phar
vendor/
tests/output

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
Expand Down
18 changes: 18 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .scrutinizer.yml

filter:
paths: [ src/* ]

before_commands:
- "composer install --prefer-source"

tools:
external_code_coverage: true
php_cpd: true
php_pdepend: true
php_code_coverage: true
php_analyzer: true

changetracking:
bug_patterns: ["\bfix(?:es|ed)?\b"]
feature_patterns: ["\badd(?:s|ed)?\b", "\bimplement(?:s|ed)?\b"]
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm

env:
- PHP_CURRENT='5.6'

before_script:
- composer selfupdate
- composer install --dev

script:
- make phpunit
- if [ $(phpenv version-name) = $PHP_CURRENT ]; then make test-upload; fi
- if [ $(phpenv version-name) = $PHP_CURRENT ]; then make phpcs bugfree; fi

after_script:
- make clean

matrix:
fast_finish: true

notifications:
webhooks:
urls:
- http://derricks.io/repositories/buildhook/
on_success: always
on_failure: always
on_start: always
70 changes: 70 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# If the first argument is one of the supported commands...
SUPPORTED_COMMANDS := "install"
SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(SUPPORTED_COMMANDS))
ifneq "$(SUPPORTS_MAKE_ARGS)" ""
# use the rest as arguments for the command
COMMAND_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(COMMAND_ARGS):;@:)
endif

test: phpunit phpcs bugfree phpmd
test-analysis: phpcs bugfree phpmd
test-upload: scrutinizer

install:
make -f Makefile.docker -- composer install $(COMMAND_ARGS)

update:

.PHONY: test test-analysis test-upload pretest phpunit phpcs phpmd bugfree ocular scrutinizer clean clean-env clean-deps

pretest:
composer install --dev

phpunit: pretest
[ ! -d tests/output ] || mkdir -p tests/output
vendor/bin/phpunit --coverage-text --coverage-clover=tests/output/coverage.clover

ifndef STRICT
STRICT = 0
endif

ifeq "$(STRICT)" "1"
phpcs: pretest
vendor/bin/phpcs --standard=PSR2 src
else
phpcs: pretest
vendor/bin/phpcs --standard=PSR2 -n src
endif

phpcbf: pretest
vendor/bin/phpcbf --standard=PSR2 src

bugfree: pretest
[ ! -f bugfree.json ] || vendor/bin/bugfree generateConfig
vendor/bin/bugfree lint src -c bugfree.json

phpmd: pretest
vendor/bin/phpmd src/ text design,naming,cleancode,codesize,controversial,unusedcode

ocular:
[ ! -f ocular.phar ] && wget https://scrutinizer-ci.com/ocular.phar

ifdef OCULAR_TOKEN
scrutinizer: ocular
@php ocular.phar code-coverage:upload --format=php-clover tests/output/coverage.clover --access-token=$(OCULAR_TOKEN);
else
scrutinizer: ocular
php ocular.phar code-coverage:upload --format=php-clover tests/output/coverage.clover;
endif

clean: clean-env clean-deps

clean-env:
rm -rf coverage.clover
rm -rf ocular.phar
rm -rf tests/output/

clean-deps:
rm -rf vendor/
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "aztech/layers",
"description": "Stackable HTTP layers",
"require": {
"aztech/phinject": "~0.1",
"aztech/phinject": "~0.2.5",
"aztech/php-utils": "~1.0",
"league/fractal": "~0.10",
"rhumsaa/uuid": "~2.8",
Expand Down
165 changes: 102 additions & 63 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<phpunit bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
convertNoticesToExceptions="true"
>
<testsuites>
<testsuite name="All tests">
<directory suffix=".php">tests/unit</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="./tests/output/Coverage/"
charset="UTF-8" yui="true" highlight="true" />
<log type="junit" target="./tests/output/Results/Results.xml"
logIncompleteSkipped="true" />
</logging>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>

</exclude>
</whitelist>
</filter>
</phpunit>
2 changes: 1 addition & 1 deletion src/Elements/CallableLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ public function __invoke(Request $request)

return $callable($request);
}
}
}
3 changes: 1 addition & 2 deletions src/Elements/ErrorHandlingLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __invoke(Request $request)
$controller = $this->controller;

return $controller($request);
}
catch (\Exception $ex) {
} catch (\Exception $ex) {
error_log($ex);

throw new HttpException(500, $ex->getMessage());
Expand Down
Loading

0 comments on commit d53fede

Please sign in to comment.