Skip to content

Commit

Permalink
Conform to FriendsOfCake standards
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Dec 2, 2015
1 parent 2fb5908 commit ec76d26
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src_dir: .
coverage_clover: build/logs/clover.xml
json_path: build/logs/coveralls-version.json
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = false

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

[*.yml]
indent_style = space
indent_size = 2
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/composer.lock
/vendor
/phpunit.xml
vendor/
composer.lock
21 changes: 21 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
imports:
- php

filter:
excluded_paths:
- docs/
- tests/
tools:
php_mess_detector: true
php_cpd:
excluded_dirs:
- docs/
- tests/
php_loc:
excluded_dirs:
- docs/
- tests/
php_pdepend:
excluded_dirs:
1: docs/
2: tests/
30 changes: 16 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,42 @@ php:
- 5.4
- 5.5
- 5.6
- 7.0

sudo: false

env:
matrix:
- DB=mysql db_dsn='mysql://travis@0.0.0.0/cakephp_test'
- DB=pgsql db_dsn='postgres://postgres@127.0.0.1/cakephp_test'
- DB=sqlite db_dsn='sqlite:///:memory:'
global:
- DEFAULT=1

matrix:
allow_failures:
- php: 5.4
env: COVERALLS=1 DEFAULT=0
- php: hhvm

fast_finish: true

include:
- php: 5.4
env: DB=pgsql db_dsn='postgres://postgres@127.0.0.1/cakephp_test'

- php: 5.4
env: DB=sqlite db_dsn='sqlite://:memory:'

- php: 5.4
env: PHPCS=1 DEFAULT=0

- php: 5.4
env: COVERALLS=1 DEFAULT=0

- php: hhvm
env: HHVM=1 DB=sqlite db_dsn='sqlite:///:memory:'

- php: hhvm
env: HHVM=1 DB=mysql db_dsn='mysql://travis@0.0.0.0/cakephp_test'

before_script:
- composer self-update
- composer install --prefer-dist --no-interaction --dev
- composer install --prefer-source --no-interaction --dev

- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then if [ '$DOCKER' = '1' ]; then apt-get -qq install -qq -y mysql-server && service mysql start; fi; mysql -e 'CREATE DATABASE cakephp_test;'; fi"

- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi"

Expand All @@ -44,15 +48,13 @@ before_script:
- sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev satooshi/php-coveralls:dev-master; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi"

- phpenv rehash
- set +H
- cp phpunit.xml.dist phpunit.xml
- command -v phpenv > /dev/null && phpenv rehash || true

script:
- sh -c "if [ '$COVERALLS' = '1' ]; then phpunit --stderr --coverage-clover build/logs/clover.xml; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then php vendor/bin/coveralls -c .coveralls.yml -v; fi"
- sh -c "if [ '$DEFAULT' = '1' ]; then phpunit --stderr; fi"
- sh -c "if [ '$PHPCS' = '1' ]; then vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --ignore=vendor --ignore=docs . ; fi"
- sh -c "if [ '$PHPCS' = '1' ]; then vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --ignore=vendor --ignore=docs --ignore=tests/bootstrap.php . ; fi"

notifications:
email: false
69 changes: 69 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# How to contribute

Version loves to welcome your contributions. There are several ways to help out:
* Create a ticket in GitHub, if you have found a bug
* Write testcases for open bug tickets
* Write patches for open bug/feature tickets, preferably with testcases included
* Contribute to the [documentation](https://github.com/josegonzalez/cakephp-version/tree/gh-pages)

There are a few guidelines that we need contributors to follow so that we have a
chance of keeping on top of things.

## Getting Started

* Make sure you have a [GitHub account](https://github.com/signup/free)
* Submit a ticket for your issue, assuming one does not already exist.
* Clearly describe the issue including steps to reproduce when it is a bug.
* Make sure you fill in the earliest version that you know has the issue.
* Fork the repository on GitHub.

## Making Changes

* Create a topic branch from where you want to base your work.
* This is usually the develop branch
* To quickly create a topic branch based on master; `git branch
master/my_contribution master` then checkout the new branch with `git
checkout master/my_contribution`. Better avoid working directly on the
`master` branch, to avoid conflicts if you pull in updates from origin.
* Make commits of logical units.
* Check for unnecessary whitespace with `git diff --check` before committing.
* Use descriptive commit messages and reference the #ticket number
* Core testcases should continue to pass. You can run tests locally or enable
[travis-ci](https://travis-ci.org/) for your fork, so all tests and codesniffs
will be executed.
* Your work should apply the CakePHP coding standards.

## Which branch to base the work

* Bugfix branches will be based on develop branch.
* New features that are backwards compatible will be based on develop branch
* New features or other non-BC changes will go in the next major release branch.

## Submitting Changes

* Push your changes to a topic branch in your fork of the repository.
* Submit a pull request to the repository with the correct target branch.

## Testcases and codesniffer

Version tests requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html)
3.5 or higher. To run the testcases locally use the following command:

./lib/Cake/Console/cake test Version AllVersion

To run the sniffs for CakePHP coding standards

phpcs -p --extensions=php --standard=CakePHP ./app/Plugin/Version

Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer)
repository to setup the CakePHP standard. The README contains installation info
for the sniff and phpcs.


# Additional Resources

* [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html)
* [Bug tracker](https://github.com/josegonzalez/cakephp-version/issues)
* [General GitHub documentation](https://help.github.com/)
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
* #cakephp IRC channel on freenode.org
60 changes: 34 additions & 26 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?><phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>
colors="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>

<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="Version Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
</testsuites>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="Version Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
</testsuites>

<!-- Setup a listener for fixtures -->
<listeners>
<listener
class="\Cake\TestSuite\Fixture\FixtureInjector"
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
</arguments>
</listener>
</listeners>
<filter>
<blacklist>
<directory suffix=".php">./docs</directory>
<directory suffix=".php">./vendor</directory>
<file>./tests/bootstrap.php</file>
</blacklist>
</filter>

<!-- Setup a listener for fixtures -->
<listeners>
<listener
class="\Cake\TestSuite\Fixture\FixtureInjector"
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
</arguments>
</listener>
</listeners>

</phpunit>

0 comments on commit ec76d26

Please sign in to comment.