diff --git a/.ecrc b/.ecrc new file mode 100644 index 000000000..4d0f6e504 --- /dev/null +++ b/.ecrc @@ -0,0 +1,12 @@ +{ + "Verbose": true, + "IgnoreDefaults": false, + "Exclude": [ + ".phpunit.result.cache", + ".php-cs-fixer.cache", + ".idea", + ".git", + "vendor/", + "tests/fixtures" + ] +} diff --git a/.editorconfig b/.editorconfig index dd7983d3d..eda412b6c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,11 +5,14 @@ charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = space -indent_size = 4 +indent_size = 2 trim_trailing_whitespace = true +[*.php] +indent_size = 4 + [*.md] trim_trailing_whitespace = false -[*.{yml,yaml,neon}] -indent_size = 2 +[*.neon] +indent_style = tab diff --git a/.gitattributes b/.gitattributes index 93298ab07..0b9d70cfc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,12 @@ -/docs export-ignore -/tests export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/.travis.yml export-ignore -/phpunit.xml export-ignore -/phpunit.xml.dist export-ignore +/docs export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.dist.php export-ignore +/.editorconfig export-ignore +/.ecrc export-ignore +/docker-compose.yaml export-ignore +/phpstan.neon export-ignore +/phpstan-baseline.neon export-ignore +/phpunit.xml.dist export-ignore +/resources export-ignore diff --git a/.github/workflows/continuous integration.yml b/.github/workflows/continuous integration.yml new file mode 100644 index 000000000..0f88bd335 --- /dev/null +++ b/.github/workflows/continuous integration.yml @@ -0,0 +1,142 @@ +name: "Continuous Integration" + +on: + push: + pull_request: + +jobs: + phpstan: + name: "PHPStan" + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout code" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.0" + extensions: "curl, soap" + tools: "composer:v2" + + - name: "Enforce using stable dependencies" + run: "composer config minimum-stability stable" + + - name: "Check Composer configuration" + run: "composer validate --strict" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + composer-options: "--prefer-dist -o" + + - name: "Run PHPStan" + run: "composer run-script phpstan" + + editorconfig-checker: + name: EditorConfig Checker + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout code" + uses: "actions/checkout@v2" + + - name: "Install EditorConfig Checker" + uses: "editorconfig-checker/action-editorconfig-checker@main" + + - name: "Run EditorConfig Checker" + run: "editorconfig-checker" + + codestyle: + name: "PHP-CS-Fixer" + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout code" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.0" + extensions: "curl, soap" + tools: "composer:v2" + + - name: "Enforce using stable dependencies" + run: "composer config minimum-stability stable" + + - name: "Check Composer configuration" + run: "composer validate --strict" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + composer-options: "--prefer-dist -o" + + - name: "Run PHP-CS-Fixer" + run: "composer run-script cs" + + phpunit: + name: "PHPUnit Test" + runs-on: "ubuntu-latest" + + strategy: + fail-fast: false + matrix: + php: + - "8.0" + - "8.1" + - "8.2" + - "8.3" + - "8.4" + dependencies: + - "lowest" + - "highest" + stability: + - "stable" + + steps: + - name: "Checkout code" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php }}" + extensions: "curl, soap" + tools: "composer:v2" + coverage: "pcov" + + - name: "Enforce using stable dependencies" + run: "composer config minimum-stability stable" + if: "${{ matrix.stability == 'stable' }}" + + - name: "Check Composer configuration" + run: "composer validate --strict" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "${{ matrix.dependencies }}" + composer-options: "--prefer-dist -o" + + - name: "Run PHPUnit Test" + run: "vendor/bin/phpunit --coverage-clover=coverage.clover --log-junit=phpunit.xml" + +# - name: "Publish Test Report" +# uses: "mikepenz/action-junit-report@v2" +# if: "always()" # always run even if the previous step fails +# with: +# report_paths: "phpunit.xml" +# check_name: "PHPUnit Test Report (${{ matrix.php }}, ${{ matrix.dependencies }}, ${{ matrix.stability }})" +# +# - name: "Publish Scrutinizer Coverage" +# uses: "sudo-bot/action-scrutinizer@latest" +# if: "always()" # always run even if the previous step fails +# with: +# cli-args: "--format=php-clover coverage.clover" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 017138f36..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: "tests" - -on: - push: - branches: - - "master" - pull_request: - -jobs: - phpstan: - name: "PHPStan" - runs-on: "ubuntu-latest" - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Setup PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.0" - extensions: "curl, soap" - tools: "composer:v2" - - - name: "Check Composer configuration" - run: "composer validate --strict" - - - name: "Install dependencies" - run: "composer update --prefer-dist --no-interaction --no-progress" - - - name: "Execute static analysis" - run: "composer run-script phpstan" - - lint: - name: "PHP-CS-Fixer" - runs-on: "ubuntu-latest" - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Setup PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.0" - extensions: "curl, soap" - tools: "composer:v2" - - - name: "Check Composer configuration" - run: "composer validate --strict" - - - name: "Install dependencies" - run: "composer update --prefer-dist --no-interaction --no-progress" - - - name: "Execute linting" - run: "composer run-script lint" - - tests: - strategy: - fail-fast: true - matrix: - php: ["8.0"] - composer_flags: ["", "--prefer-lowest"] - - name: "Tests PHP ${{ matrix.php }} ${{ matrix.composer_flags}}" - - runs-on: "ubuntu-latest" - - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Setup PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php }}" - extensions: "curl, soap" - tools: "composer:v2" - coverage: "pcov" - - - name: "Check Composer configuration" - run: "composer validate --strict" - - - name: "Install dependencies" - run: "composer update -o ${{ matrix.composer_flags }} --prefer-dist --no-interaction --no-progress" - - - name: "Execute tests" - run: "vendor/bin/phpunit --coverage-clover=coverage.clover" - - - name: Upload Scrutinizer coverage - uses: sudo-bot/action-scrutinizer@latest - with: - cli-args: "--format=php-clover coverage.clover" diff --git a/LICENSE.md b/LICENSE.md index 0d8812c51..bb5af01e3 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -16,4 +16,4 @@ 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. \ No newline at end of file +THE SOFTWARE. diff --git a/README.md b/README.md index be1cc9da3..bae7e2488 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![PHP-VCR](https://user-images.githubusercontent.com/133832/27151811-0d95c6c4-514c-11e7-834e-eff1eec2ea16.png) -[![Build Status](https://github.com/php-vcr/php-vcr/actions/workflows/tests.yml/badge.svg)](https://github.com/php-vcr/php-vcr/actions/workflows/tests.yml) +[![Continuous Integration](https://github.com/php-vcr/php-vcr/actions/workflows/continuous%20integration.yml/badge.svg?branch=master)](https://github.com/php-vcr/php-vcr/actions/workflows/continuous%20integration.yml) [![Code Coverage](https://scrutinizer-ci.com/g/php-vcr/php-vcr/badges/coverage.png?s=15cf1644c8cf37a868e03cfba809a5e24c78f285)](https://scrutinizer-ci.com/g/php-vcr/php-vcr/) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/php-vcr/php-vcr/badges/quality-score.png?s=4f638dbca5eb51fb9c87a1dd45c5df94687d85bd)](https://scrutinizer-ci.com/g/php-vcr/php-vcr/) @@ -14,7 +14,7 @@ Disclaimer: Doing this in PHP is not as easy as in programming languages which s * Automatically records and replays your HTTP(s) interactions with minimal setup/configuration code. * Supports common http functions and extensions - * everything using [streamWrapper](http://php.net/manual/en/class.streamwrapper.php): fopen(), fread(), file_get_contents(), ... without any modification (except `$http_response_header` see #96) + * everything using [streamWrapper](http://php.net/manual/en/class.streamwrapper.php): fopen(), fread(), file_get_contents(), ... without any modification (except `$http_response_header` see [#96](https://github.com/php-vcr/php-vcr/issues/96)) * [SoapClient](http://www.php.net/manual/en/soapclient.soapclient.php) by adding `\VCR\VCR::turnOn();` in your `tests/bootstrap.php` * curl(), by adding `\VCR\VCR::turnOn();` in your `tests/bootstrap.php` * The same request can receive different responses in different tests -- just use different cassettes. @@ -121,7 +121,7 @@ composer test [Old changelog entries](docs/old-changelog.md) ## Copyright -Copyright (c) 2013-2016 Adrian Philipp. Released under the terms of the MIT license. See LICENSE for details. +Copyright (c) 2013-2023 Adrian Philipp. Released under the terms of the MIT license. See LICENSE for details. [Contributors](https://github.com/php-vcr/php-vcr/graphs/contributors)