Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Synchronize with ergebnis/php-package-template #318

Merged
merged 1 commit into from
Nov 27, 2023
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: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
Expand Down
6 changes: 3 additions & 3 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
version: 2

updates:
- commit-message:
- allow:
- dependency-type: "development"
commit-message:
include: "scope"
prefix: "composer"
directory: "/"
ignore:
- dependency-name: "fakerphp/faker"
labels:
- "dependency"
open-pull-requests-limit: 10
Expand Down
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://github.com/probot/settings
# https://github.com/repository-settings/app

branches:
- name: "main"
Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -27,7 +29,7 @@ jobs:
uses: "actions/checkout@v4.1.1"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "xdebug"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down Expand Up @@ -73,6 +75,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -93,7 +97,7 @@ jobs:
strict: true

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down Expand Up @@ -143,6 +147,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -156,7 +162,7 @@ jobs:
uses: "actions/checkout@v4.1.1"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down Expand Up @@ -190,13 +196,15 @@ jobs:
trust-gpg-keys: "0x033E5F8D801A2F8D"

- name: "Run maglnet/composer-require-checker"
run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json"
run: ".phive/composer-require-checker check --ansi --config-file=$(pwd)/composer-require-checker.json --verbose"

mutation-tests:
name: "Mutation Tests"

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -210,7 +218,7 @@ jobs:
uses: "actions/checkout@v4.1.1"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "xdebug"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down Expand Up @@ -247,6 +255,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -260,7 +270,7 @@ jobs:
uses: "actions/checkout@v4.1.1"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down Expand Up @@ -307,6 +317,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -320,7 +332,7 @@ jobs:
uses: "actions/checkout@v4.1.1"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down Expand Up @@ -355,6 +367,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -368,7 +382,7 @@ jobs:
uses: "actions/checkout@v4.1.1"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, opcache, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter"
Expand Down Expand Up @@ -406,6 +420,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -422,7 +438,7 @@ jobs:
uses: "actions/checkout@v4.1.1"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

steps:
- name: "Create release"
uses: "ergebnis/.github/actions/github/release/create@1.8.0"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/renew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand All @@ -27,7 +29,7 @@ jobs:
token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.27.1"
uses: "shivammathur/setup-php@2.28.0"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/triage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

steps:
- name: "Add labels based on branch name"
uses: "ergebnis/.github/actions/github/pull-request/add-label-based-on-branch-name@1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="composer-require-checker" version="^4.6.0" installed="4.6.0" location="./.phive/composer-require-checker" copy="false"/>
<phar name="composer-require-checker" version="^4.7.1" installed="4.7.1" location="./.phive/composer-require-checker" copy="false"/>
</phive>
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.

.PHONY: dependency-analysis
dependency-analysis: phive vendor ## Runs a dependency analysis with maglnet/composer-require-checker
.phive/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json
.phive/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json --verbose

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand Down
45 changes: 34 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
[![Total Downloads](https://poser.pugx.org/ergebnis/data-provider/downloads)](https://packagist.org/packages/ergebnis/data-provider)
[![Monthly Downloads](http://poser.pugx.org/ergebnis/data-provider/d/monthly)](https://packagist.org/packages/ergebnis/data-provider)

This package provides generic data providers for use with [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit).

## Installation

Run
Expand All @@ -33,7 +35,7 @@ This package provides the following generic data providers:
- [`Ergebnis\DataProvider\StringProvider`](https://github.com/ergebnis/data-provider#dataproviderstringprovider)
- [`Ergebnis\DataProvider\UuidProvider`](https://github.com/ergebnis/data-provider#dataprovideruuidprovider)

Since it is possible to use multiple `@dataProvider` annotations for test methods, these generic data providers allow for reuse and composition of data providers:
Since it is possible to use multiple [`@dataProvider` annotations](https://docs.phpunit.de/en/10.4/annotations.html#dataprovider) or [`PHPUnit\Framework\Attribute\DataProviderExternal` attributes](https://docs.phpunit.de/en/10.4/attributes.html#dataproviderexternal) for test methods, these generic data providers allow for reuse and composition of data providers:

```php
<?php
Expand All @@ -42,6 +44,7 @@ declare(strict_types=1);

namespace Example\Test;

use Ergebnis\DataProvider;
use PHPUnit\Framework;

final class ExampleTest extends Framework\TestCase
Expand All @@ -50,7 +53,17 @@ final class ExampleTest extends Framework\TestCase
* @dataProvider \Ergebnis\DataProvider\StringProvider::blank()
* @dataProvider \Ergebnis\DataProvider\StringProvider::empty()
*/
public function testFromNameRejectsBlankOrEmptyStrings(string $value): void
public function testFromNameRejectsInvalidValueWithAnnotation(string $value): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Value can not be an empty or blank string.');

UserName::fromString($value);
}

#[Framework\DataProviderExternal(DataProvider\StringProvider::class, 'blank')]
#[Framework\DataProviderExternal(DataProvider\StringProvider::class, 'empty')]
public function testFromNameRejectsInvalidValueWithAttribute(string $value): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Value can not be an empty or blank string.');
Expand Down Expand Up @@ -131,26 +144,36 @@ For examples, see [`Ergebnis\DataProvider\Test\Unit\UuidProviderTest`](test/Unit

## Changelog

Please have a look at [`CHANGELOG.md`](CHANGELOG.md).
The maintainers of this package record notable changes to this project in a [changelog](CHANGELOG.md).

## Contributing

Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).
The maintainers of this package suggest following the [contribution guide](.github/CONTRIBUTING.md).

## Code of Conduct

Please have a look at [`CODE_OF_CONDUCT.md`](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).
The maintainers of this package ask contributors to follow the [code of conduct](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).

## General Support Policy

The maintainers of this package provide limited support.

You can support the maintenance of this package by [sponsoring @localheinz](https://github.com/sponsors/localheinz) or [requesting an invoice for services related to this package](mailto:am@localheinz.com?subject=ergebnis/data-provider:%20Requesting%20invoice%20for%20services).

## PHP Version Support Policy

This package supports PHP versions with [active support](https://www.php.net/supported-versions.php).

The maintainers of this package add support for a PHP version following its initial release and drop support for a PHP version when it has reached its end of active support.

## Security Policy

Please have a look at [`SECURITY.md`](.github/SECURITY.md).
This package has a [security policy](.github/SECURITY.md).

## License

This package is licensed using the MIT License.

Please have a look at [`LICENSE.md`](LICENSE.md).
This package uses the [MIT license](LICENSE.md).

## Curious what I am up to?
## Social

Follow me on [Twitter](https://twitter.com/intent/follow?screen_name=localheinz)!
Follow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.15.0@5c774aca4746caf3d239d9c8cadb9f882ca29352">
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
<file src="src/AbstractProvider.php">
<MixedAssignment>
<code>$value</code>
Expand Down