diff --git a/.editorconfig b/.editorconfig index fe208953..9576ebcf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,6 +2,7 @@ root = true [*] charset = utf-8 +end_of_line = lf indent_size = 4 indent_style = space insert_final_newline = true diff --git a/.github/SECURITY.md b/.github/SECURITY.md index e3f776b2..0ae0d2ac 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -2,13 +2,13 @@ ## Supported Versions -The following versions of `ergebnis/php-package-template` have active support: +The following versions of `ergebnis/factory-bot` have active support: - `^1.4.0` ## Unsupported Versions -The following versions of `ergebnis/php-package-template` have reached their end of life: +The following versions of `ergebnis/factory-bot` have reached their end of life: - `<1.4.0` diff --git a/.github/settings.yml b/.github/settings.yml index c156581c..946d42b2 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,4 +1,4 @@ -# https://github.com/probot/settings +# https://github.com/repository-settings/app branches: - name: "main" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 67a43b73..385bf1b4 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -14,6 +14,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -73,6 +75,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -146,6 +150,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -200,6 +206,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -250,6 +258,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -310,6 +320,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -358,6 +370,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -402,7 +416,7 @@ jobs: run: "mkdir -p .build/phpstan/" - name: "Run phpstan/phpstan" - run: "vendor/bin/phpstan --configuration=phpstan.neon --memory-limit=-1" + run: "vendor/bin/phpstan --ansi --configuration=phpstan.neon --memory-limit=-1" - name: "Create cache directory for vimeo/psalm" run: "mkdir -p .build/psalm/" @@ -415,6 +429,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -462,10 +478,10 @@ jobs: dependencies: "${{ matrix.dependencies }}" - name: "Show Doctrine mapping information" - run: "vendor/bin/doctrine orm:info" + run: "vendor/bin/doctrine orm:info --ansi" - name: "Validate Doctrine mapping" - run: "vendor/bin/doctrine orm:validate-schema --skip-sync" + run: "vendor/bin/doctrine orm:validate-schema --ansi --skip-sync" - name: "Run unit tests with phpunit/phpunit" run: "vendor/bin/phpunit --colors=always --configuration=test/phpunit.xml --testsuite=unit" diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 39279b01..5b326809 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -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' && diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c760eede..bbed7cdb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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" diff --git a/.github/workflows/renew.yaml b/.github/workflows/renew.yaml index b2101742..e8d0c434 100644 --- a/.github/workflows/renew.yaml +++ b/.github/workflows/renew.yaml @@ -12,6 +12,8 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: diff --git a/.github/workflows/triage.yaml b/.github/workflows/triage.yaml index 8f59cb6e..6b1217b6 100644 --- a/.github/workflows/triage.yaml +++ b/.github/workflows/triage.yaml @@ -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" diff --git a/.phive/phars.xml b/.phive/phars.xml index a30ffc0e..ec14a996 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,4 +1,4 @@ - + diff --git a/Makefile b/Makefile index 8a76ba2c..587caac3 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ static-code-analysis-baseline: vendor ## Generates a baseline for static code an vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml .PHONY: tests -tests: vendor ## Runs unit tests with phpunit/phpunit +tests: vendor ## Runs unit and integration tests with phpunit/phpunit mkdir -p .build/phpunit vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=unit vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=integration diff --git a/README.md b/README.md index ee61881f..a55c3756 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![Total Downloads](https://poser.pugx.org/ergebnis/factory-bot/downloads)](https://packagist.org/packages/ergebnis/factory-bot) [![Monthly Downloads](http://poser.pugx.org/ergebnis/factory-bot/d/monthly)](https://packagist.org/packages/ergebnis/factory-bot) -Provides a fixture factory for [`doctrine/orm`](https://github.com/doctrine/orm) entities. +This package provides a fixture factory for [`doctrine/orm`](https://github.com/doctrine/orm) entities. ## Installation @@ -1221,30 +1221,40 @@ The fixture factory will not flush the entity manager - you need to flush it you ## 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](.github/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/factory-bot:%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). ## Credits This project is based on [`breerly/factory-girl-php@0e6f1b6`](https://github.com/GoodPete/factory-girl-php/tree/0e6f1b6724d39108a2e7cef68a74668b7a77b856) (originally licensed under MIT by [Grayson Koonce](https://github.com/unhashable)), which is based on [`xi/doctrine`](https://github.com/xi-project/xi-doctrine) (originally licensed under MIT by [Xi](https://github.com/xi-project)), which in turn provided a port of [`factory_bot`](https://github.com/thoughtbot/factory_girl) (originally licensed under MIT by [Joe Ferris](https://github.com/jferris) and [thoughtbot, Inc.](https://github.com/thoughtbot)). -## 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. diff --git a/composer.json b/composer.json index 6eeeb91a..c4009626 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ "ergebnis/license": "^2.2.0", "ergebnis/php-cs-fixer-config": "^6.0.0", "ergebnis/phpstan-rules": "^2.1.0", + "ergebnis/phpunit-slow-test-detector": "^2.3.0", "infection/infection": "~0.27.2", "phpstan/extension-installer": "^1.3.1", "phpstan/phpstan": "^1.10.34", diff --git a/composer.lock b/composer.lock index 08863196..f2c189fe 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3701809d2bcebb643185d229589994ea", + "content-hash": "f5f84a3923e2d65737b462ebe1a0d909", "packages": [ { "name": "composer/package-versions-deprecated", @@ -3298,6 +3298,74 @@ }, "time": "2023-08-17T10:28:37+00:00" }, + { + "name": "ergebnis/phpunit-slow-test-detector", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/phpunit-slow-test-detector.git", + "reference": "ea03f0fb94a8ba8b2428d5dbbdcda3aa2f6b529a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/phpunit-slow-test-detector/zipball/ea03f0fb94a8ba8b2428d5dbbdcda3aa2f6b529a", + "reference": "ea03f0fb94a8ba8b2428d5dbbdcda3aa2f6b529a", + "shasum": "" + }, + "require": { + "php": "~8.1.0 || ~8.2.0", + "phpunit/phpunit": "^10.1.3" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.31.0", + "ergebnis/data-provider": "^1.3.0", + "ergebnis/license": "^2.1.0", + "ergebnis/php-cs-fixer-config": "^5.7.0", + "fakerphp/faker": "^1.22.0", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.16.0", + "vimeo/psalm": "^5.12.0" + }, + "suggest": { + "phpunit/phpunit": "^10.0.1" + }, + "type": "library", + "extra": { + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + } + }, + "autoload": { + "psr-4": { + "Ergebnis\\PHPUnit\\SlowTestDetector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com" + } + ], + "description": "Provides facilities for detecting slow tests in phpunit/phpunit.", + "homepage": "https://github.com/ergebnis/phpunit-slow-test-detector", + "keywords": [ + "detector", + "extension", + "phpunit", + "slow", + "test" + ], + "support": { + "issues": "https://github.com/ergebnis/phpunit-slow-test-detector/issues", + "source": "https://github.com/ergebnis/phpunit-slow-test-detector" + }, + "time": "2023-05-30T17:23:26+00:00" + }, { "name": "felixfbecker/advanced-json-rpc", "version": "v3.2.1", @@ -7978,5 +8046,5 @@ "platform-overrides": { "php": "8.1.21" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/test/Util/Helper.php b/test/Util/Helper.php index febfa076..9fca0526 100644 --- a/test/Util/Helper.php +++ b/test/Util/Helper.php @@ -21,7 +21,7 @@ trait Helper final protected static function faker(string $locale = 'en_US'): Generator { /** - * @var array + * @var array $fakers */ static $fakers = []; diff --git a/test/phpunit.xml b/test/phpunit.xml index 95ffd671..ddea9284 100644 --- a/test/phpunit.xml +++ b/test/phpunit.xml @@ -9,16 +9,25 @@ bootstrap="../vendor/autoload.php" cacheDirectory="../.build/phpunit/cache" cacheResult="true" - cacheResultFile="../.build/phpunit/cache" colors="true" columns="max" + displayDetailsOnIncompleteTests="true" + displayDetailsOnSkippedTests="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" executionOrder="random" + requireCoverageMetadata="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" > + + + ../src/