Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed May 25, 2017
0 parents commit 740095e
Show file tree
Hide file tree
Showing 17 changed files with 372 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
engines:
duplication:
enabled: true
config:
languages:
- php
fixme:
enabled: true
phpmd:
enabled: true

ratings:
paths:
- src/
- test/

exclude_paths:
- vendor/
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

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

[*.json]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2

[Makefile]
indent_style = tab
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.travis/ export-ignore
/.github/ export-ignore
/test/ export-ignore
/.codeclimate.yml export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.travis.yml export-ignore
/Makefile export-ignore
32 changes: 32 additions & 0 deletions .github/CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we
pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level
of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size,
race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct
* Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct,
project maintainers commit themselves to fairly and consistently applying these principles to every aspect of
managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently
removed from the project team.

This code of conduct applies both within project spaces and in public spaces when an individual is representing the
project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting
one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant, version 1.2.0, available from
http://contributor-covenant.org/version/1/2/0/
39 changes: 39 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# CONTRIBUTING

We're using [Travis CI](https://travis-ci.org) as a continuous integration system.

For details, see [`.travis.yml`](../.travis.yml).

## Tests

We're using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.

Run

```
$ make test
```

to run all the tests.

## Coding Standards

We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards.

Run

```
$ make cs
```

to automatically fix coding standard violations.

## Extra lazy?

Run

```
$ make
```

to run both coding standards check and tests!
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#### Steps required to reproduce the problem

1.
2.
3.

#### Expected Result

*

#### Actual Result

*
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This PR

* [x]
* [ ]
* [ ]

Follows #.
Related to #.
Fixes #.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/.php_cs.cache
composer.lock
22 changes: 22 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Localheinz\PhpCsFixer\Config;

$header = <<<EOF
Copyright (c) 2017 Andreas Möller
For the full copyright and license information, please view
the LICENSE file that was distributed with this source code.
@link https://github.com/localheinz/factory-girl-definition
EOF;

$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php56($header));

$config->getFinder()->in(__DIR__);

$cacheDir = \getenv('TRAVIS') ? \getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');

return $config;
53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
language: php

sudo: false

env:
global:
- secure: "OC6EEdRP4hU5FSMf7e02T9dAVfRKPhaeRpinfzXfLvLgq4b4NTIYapMA9KU9AuZSsVJPBMmkX0u5kpzS5feLxh055EjRveLsS4CfdCTHwrnqclmduboYF5wzOozLTH+5KxOAsCMhu3j7NXuRyeDZUdc5dUQXLCOwkkpWDW3iF8uBgAb2Vv4zx0yO27MFC4Q5K5ybE5i6nc+rel+66U7quN6cOzD4p0X8PC/K0EFSkMZfidrgyt0aoOQqVjnbC5DML4w+0DSPlLWx/wy0kNiWdUD79lXL6XUoc7vwKP9mISUGhfHXZulBnBp2y9CG8qyBO9ivKyJF/HlHQ3KlnwMtHlt2Zm7aE8XBIzlm7NgfR4pi89m0I7aJKvJKuNj0C20V+Zqcs+K05sFXGWUp/ltTgiboHH9V4ReihN0nivGLGqNBo+CBblzfmZG3Ij5ZwOHcAhg9ekV0OtS+lusdyZKFePj2J7neUH0k5Uh+Qbapl6SS/F91AQuVFNsrSwOLydO2cDFI2dsJKQSRdQKh7Jp00ndX2ElH6ptDiQqqDj/DSczu8nv3R3xF9Kmjel+1GZf7pH20s4B/Xmt3I1cnwwpbPIer6XxRm6RvH8FqMB7ZBqVpdy+h8EmQ/aSYHeiDVx6fHkmz40OBTe5UTsH2C02nXTwic3VkpeokMBnNaLUalug="
- secure: "KMW6WWvWpzTi+hbmFBr+0jJK9I5q9rPbyjWVgCpGVQKm2OpQem4mq/38HLmYylfyIQlwQbQOrvOW1yPxNzJ4/H9IP42J7tgyrWKytra4cJNjVVb3ExOPY2VhgMYRvzDeEbjz1nOSZCWs/fftul5P10w0tL2I5uLemlTnZxDXQItS53cPHyHFDqANvaQhLLSZ++l5+z9jtcbdKEqXi55dsUS8CEuywFCcVnedreaCnofLpbND3Q5i3zOBGctElAv0ljkHUOmbJPCMncuUwK5sBDYROg9W4CSBMCRxH2nRuypWVR89kW0PeH+fLHmK7HnrfC1GGmgHkb57F2kLsvWGhuEf9JFRwiWAVmL+lj9uqaHXSf38LmhgeutkD9SLwQ/kp+rpdQ5MzIHSH1is3t+uuTZCkOoAyHtXqpywqeLl9TONbXYq2sHxlP5p2755AVyxk2YSHjkMDb4V6bIgalBAXg6Z/BttJIYAaTitp3r4Bs808n7rjXJdDA9IX7tBpdObKVKlnFG12bgYEF/G2OB0a1bIxnhIgdl8RMx7DAlzajbDmuTOnt6sYd6KC804E6+8gWCs8cpcYafRAInoByo7EQlk70hqQuJdiAhUTgxSH5tZb33Sn1KP4gQzPFvIoA35e6GR4GxrdDWP8/hSNbVOwSoZjOO0z5AGovsa53tD2jc="

matrix:
include:
- php: 5.6
env: WITH_LOWEST=true
- php: 5.6
env: WITH_HIGHEST=true WITH_CS=true
- php: 7.0
env: WITH_LOWEST=true
- php: 7.0
env: WITH_HIGHEST=true
- php: 7.1
env: WITH_LOWEST=true
- php: 7.1
env: WITH_HIGHEST=true WITH_COVERAGE=true

cache:
directories:
- $HOME/.composer/cache
- $HOME/.php-cs-fixer

before_install:
- source .travis/xdebug.sh
- xdebug-disable
- composer validate
- composer config github-oauth.github.com $GITHUB_TOKEN

install:
- if [[ "$WITH_LOWEST" == "true" ]]; then composer update --prefer-lowest; else composer install; fi

before_script:
- mkdir -p "$HOME/.php-cs-fixer"
- mkdir -p build/logs

script:
- if [[ "$WITH_CS" == "true" ]]; then vendor/bin/php-cs-fixer fix --config=.php_cs --diff --dry-run --verbose; fi
- if [[ "$WITH_COVERAGE" == "true" ]]; then xdebug-enable; fi
- if [[ "$WITH_COVERAGE" == "true" ]]; then vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml; else vendor/bin/phpunit --configuration=test/Unit/phpunit.xml; fi
- if [[ "$WITH_COVERAGE" == "true" ]]; then xdebug-disable; fi

after_success:
- if [[ "$WITH_COVERAGE" == "true" ]]; then vendor/bin/test-reporter --coverage-report=build/logs/clover.xml; fi

notifications:
email: false
22 changes: 22 additions & 0 deletions .travis/xdebug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# The problem is that we do not want to remove the configuration file, just disable it for a few tasks, then enable it
#
# For reference, see
#
# - https://docs.travis-ci.com/user/languages/php#Disabling-preinstalled-PHP-extensions
# - https://docs.travis-ci.com/user/languages/php#Custom-PHP-configuration

config="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"

function xdebug-disable() {
if [[ -f $config ]]; then
mv $config "$config.bak"
fi
}

function xdebug-enable() {
if [[ -f "$config.bak" ]]; then
mv "$config.bak" $config
fi
}
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The MIT License (MIT)

Copyright (c) 2017 Andreas Möller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: composer coverage cs it test

it: cs test

composer:
rm -rf composer.lock
composer self-update
composer validate
composer update

coverage: composer
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text

cs: composer
vendor/bin/php-cs-fixer fix --config=.php_cs --diff --verbose

test: composer
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
composer update --prefer-lowest
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# factory-girl-definition

[![Build Status](https://travis-ci.org/localheinz/factory-girl-definition.svg?branch=master)](https://travis-ci.org/localheinz/factory-girl-definition)
[![Code Climate](https://codeclimate.com/github/localheinz/factory-girl-definition/badges/gpa.svg)](https://codeclimate.com/github/localheinz/factory-girl-definition)
[![Test Coverage](https://codeclimate.com/github/localheinz/factory-girl-definition/badges/coverage.svg)](https://codeclimate.com/github/localheinz/factory-girl-definition/coverage)
[![Issue Count](https://codeclimate.com/github/localheinz/factory-girl-definition/badges/issue_count.svg)](https://codeclimate.com/github/localheinz/factory-girl-definition)
[![Latest Stable Version](https://poser.pugx.org/localheinz/factory-girl-definition/v/stable)](https://packagist.org/packages/localheinz/factory-girl-definition)
[![Total Downloads](https://poser.pugx.org/localheinz/factory-girl-definition/downloads)](https://packagist.org/packages/localheinz/factory-girl-definition)

## Installation

Run

```
$ composer require localheinz/factory-girl-definition
```

## Usage

:bulb: This is a great place for showing a few usage examples!

## Contributing

Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).

## Code of Conduct

Please have a look at [`CONDUCT.md`](.github/CONDUCT.md).

## License

This package is licensed using the MIT License.
34 changes: 34 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "localheinz/factory-girl-definition",
"description": "Provides an interface and a finder for definitions with breerly/factory-girl-php.",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Andreas Möller",
"email": "[email protected]"
}
],
"config": {
"preferred-install": "dist",
"sort-packages": true
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "0.4.4",
"localheinz/php-cs-fixer-config": "1.2.1",
"phpunit/phpunit": "^5.7.20"
},
"autoload": {
"psr-4": {
"Localheinz\\FactoryGirl\\Definition\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Localheinz\\FactoryGirl\\Definition\\Test\\": "test"
}
}
}
Empty file added src/.gitkeep
Empty file.
29 changes: 29 additions & 0 deletions test/Unit/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
bootstrap="../../vendor/autoload.php"
colors="true"
columns="max"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true"
>
<testsuites>
<testsuite name="Unit Tests">
<directory>.</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../../src</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit 740095e

Please sign in to comment.