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

Rebased #100 - New coding standard #120

Merged
merged 9 commits into from
Jul 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ tmp/
zf-mkdoc-theme/
clover.xml
coveralls-upload.json
phpcs.xml
phpunit.xml
vendor
45 changes: 17 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,30 @@ For sensitive email communications, please use [our PGP key](http://framework.ze

## RUNNING TESTS

> ### Note: testing versions prior to 2.4
>
> This component originates with Zend Framework 2. During the lifetime of ZF2,
> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no
> changes were necessary. However, due to the migration, tests may not run on
> versions < 2.4. As such, you may need to change the PHPUnit dependency if
> attempting a fix on such a version.

To run tests:

- Clone the repository:

```console
$ git clone git@github.com:zendframework/zend-code.git
$ cd
$ git clone git://github.com/zendframework/zend-code.git
$ cd zend-code
```

- Install dependencies via composer:

```console
$ curl -sS https://getcomposer.org/installer | php --
$ ./composer.phar install
$ composer install
```

If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/
If you don't have `composer` installed, please download it from https://getcomposer.org/download/

- Run the tests via `phpunit` and the provided PHPUnit config, like in this example:
- Run the tests using the "test" command shipped in the `composer.json`:

```console
$ ./vendor/bin/phpunit
$ composer test
```

You can turn on conditional tests with the phpunit.xml file.
You can turn on conditional tests with the `phpunit.xml` file.
To do so:

- Copy `phpunit.xml.dist` file to `phpunit.xml`
Expand All @@ -77,24 +68,22 @@ To do so:

## Running Coding Standards Checks

This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding
standards checks, and provides configuration for our selected checks.
`php-cs-fixer` is installed by default via Composer.
First, ensure you've installed dependencies via composer, per the previous
section on running tests.

To run checks only:
To run CS checks only:

```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs
$ composer cs-check
```

To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run`
flag:
To attempt to automatically fix common CS issues:

```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs
$ composer cs-fix
```

If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure
If the above fixes any CS issues, please re-run the tests to ensure
they pass, and make sure you add and commit the changes after verification.

## Recommended Workflow for Contributions
Expand All @@ -103,12 +92,12 @@ Your first step is to establish a public repository from which we can
pull your work into the master repository. We recommend using
[GitHub](https://github.com), as that is where the component is already hosted.

1. Setup a [GitHub account](http://github.com/), if you haven't yet
2. Fork the repository (http://github.com/zendframework/zend-code)
1. Setup a [GitHub account](https://github.com/), if you haven't yet
2. Fork the repository (https://github.com/zendframework/zend-code)
3. Clone the canonical repository locally and enter it.

```console
$ git clone git://github.com:zendframework/zend-code.git
$ git clone git://github.com/zendframework/zend-code.git
$ cd zend-code
```

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"ext-phar": "*",
"doctrine/annotations": "~1.0",
"zendframework/zend-stdlib": "^2.7 || ^3.0",
"squizlabs/php_codesniffer": "^2.5",
"phpunit/phpunit": "^6.2.2"
"phpunit/phpunit": "^6.2.3",
"zendframework/zend-coding-standard": "~1.0.0"
},
"suggest": {
"doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features",
Expand Down
111 changes: 70 additions & 41 deletions composer.lock

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

9 changes: 9 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="Zend Framework coding standard">
<rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml"/>

<!-- Paths to check -->
<file>src</file>
<file>test</file>
<exclude-pattern>*/TestAsset/*</exclude-pattern>
</ruleset>
Loading