-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit de6f80a
Showing
18 changed files
with
493 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
labels: | ||
- "dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Dependabot auto-merge | ||
on: pull_request_target | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
|
||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v1.6.0 | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Auto-merge Dependabot PRs for semver-minor updates | ||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Auto-merge Dependabot PRs for semver-patch updates | ||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Fix PHP code style issues | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
php-code-styling: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Fix PHP code style issues | ||
uses: aglipanci/laravel-pint-action@2.2.0 | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Fix styling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Static analysis | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.3' | ||
coverage: none | ||
|
||
- name: Install composer dependencies | ||
uses: ramsey/composer-install@v3 | ||
|
||
- name: Run PHPStan | ||
run: ./vendor/bin/phpstan --error-format=github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
phpunit: | ||
name: PHPUnit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.3' | ||
coverage: xdebug | ||
|
||
- name: Setup problem matchers | ||
run: | | ||
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
- name: Install composer dependencies | ||
uses: ramsey/composer-install@v3 | ||
|
||
- name: List Installed Dependencies | ||
run: composer show -D | ||
|
||
- name: Execute tests | ||
run: vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Update changelog | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
latest-version: ${{ github.event.release.name }} | ||
release-notes: ${{ github.event.release.body }} | ||
|
||
- name: Commit updated CHANGELOG | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: main | ||
commit_message: Update CHANGELOG | ||
file_pattern: CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/.idea | ||
/.phpunit.cache | ||
/.vscode | ||
/build | ||
/coverage | ||
/vendor | ||
.phpunit.result.cache | ||
composer.lock | ||
phpstan.neon | ||
phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
All notable changes to `testing-matrix` will be documented in this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Roj Vroemen <roj@feature.ninja> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Testing Matrix | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/feature-ninja/testing-matrix.svg?style=flat-square)](https://packagist.org/packages/feature-ninja/testing-matrix) | ||
[![Tests](https://img.shields.io/github/actions/workflow/status/feature-ninja/testing-matrix/run-phpunit.yml?branch=main&label=tests&style=flat-square)](https://github.com/feature-ninja/testing-matrix/actions/workflows/run-phpunit.yml) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/feature-ninja/testing-matrix.svg?style=flat-square)](https://packagist.org/packages/feature-ninja/testing-matrix) | ||
|
||
Easily test multiple scenarios by creating a testing matrix | ||
|
||
## Installation | ||
|
||
You can install the package via composer: | ||
|
||
```bash | ||
composer require feature-ninja/testing-matrix | ||
``` | ||
|
||
## Usage | ||
|
||
Create a testing matrix from an array: | ||
|
||
```php | ||
use FeatureNinja\TestingMatrix\Matrix; | ||
|
||
$matrix = Matrix::create([ | ||
'a' => [1, 2], | ||
'b' => [3, 4], | ||
]); | ||
|
||
assert(iterator_to_array($matrix) === [ | ||
'a=1 b=3' => [1, 3], | ||
'a=1 b=4' => [1, 4], | ||
'a=2 b=3' => [2, 3], | ||
'a=2 b=4' => [2, 4], | ||
]); | ||
``` | ||
|
||
Usage in PHPUnit: | ||
|
||
```php | ||
use FeatureNinja\TestingMatrix\Matrix; | ||
use PHPUnit\Framework\Attributes\DataProvider;use PHPUnit\Framework\Attributes\Test; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ExampleTest extends TestCase | ||
{ | ||
public static function example_data_provider(): Generator | ||
{ | ||
yield from Matrix::create([ | ||
'a' => [1, 2], | ||
'b' => [3, 4], | ||
]); | ||
} | ||
|
||
#[Test] | ||
#[DataProvider('examples')] | ||
public function example(int $a, int $b): void | ||
{ | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
## Testing | ||
|
||
```bash | ||
composer test | ||
``` | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Security Vulnerabilities | ||
|
||
Please review [our security policy](../../security/policy) on how to report security vulnerabilities. | ||
|
||
## Credits | ||
|
||
- [Roj Vroemen](https://github.com/rojtjo) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "feature-ninja/testing-matrix", | ||
"description": "Easily test multiple scenarios by creating a testing matrix", | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Roj Vroemen", | ||
"email": "roj@feature.ninja" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"FeatureNinja\\TestingMatrix\\": "src/" | ||
} | ||
}, | ||
"require": { | ||
"php": "^8.3" | ||
}, | ||
"require-dev": { | ||
"laravel/pint": "^1.10", | ||
"phpstan/extension-installer": "^1.3", | ||
"phpstan/phpstan": "^1.10", | ||
"phpstan/phpstan-deprecation-rules": "^1.1", | ||
"phpstan/phpstan-phpunit": "^1.3", | ||
"phpunit/phpunit": "^11.3" | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"phpstan/extension-installer": true | ||
} | ||
}, | ||
"scripts": { | ||
"fix": "@php vendor/bin/pint", | ||
"test": "@php vendor/bin/phpunit", | ||
"analyze": "@php vendor/bin/phpstan", | ||
"complete-check": [ | ||
"@test", | ||
"@analyze" | ||
] | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-main": "1.x-dev" | ||
} | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 6 | ||
paths: | ||
- src | ||
tmpDir: build/phpstan |
Oops, something went wrong.