From 047c75b12eb68730e0a19052c0d8079382a8bafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Thu, 2 Apr 2020 18:36:33 +0200 Subject: [PATCH] Enhancement: Extract FieldDefinition\Reference --- .github/workflows/integrate.yaml | 4 ++-- CHANGELOG.md | 2 ++ Makefile | 4 ++-- src/FieldDefinition.php | 3 --- test/Integration/FixtureFactoryTest.php | 1 + test/Unit/FieldDefinition/ReferenceTest.php | 2 ++ test/Unit/FieldDefinitionTest.php | 1 + test/Unit/FixtureFactoryTest.php | 3 ++- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 906a9079..01b42255 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -9,8 +9,8 @@ on: # yamllint disable-line rule:truthy - "master" env: - MIN_COVERED_MSI: 98 - MIN_MSI: 96 + MIN_COVERED_MSI: 99 + MIN_MSI: 97 REQUIRED_PHP_EXTENSIONS: "mbstring" jobs: diff --git a/CHANGELOG.md b/CHANGELOG.md index 955a74dd..7dda8a74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For a full diff see [`fa9c564...master`][fa9c564...master]. * Started throwing an `Exception\ClassNotFound` exception instead of a generic `Exception` when a class was not found ([#125]), by [@localheinz] * Added `@template` annotations to assist with static code analysis ([#128]), by [@localheinz] * Removed the fluent interface from `FixtureFactory::defineEntity()` ([#131]), by [@localheinz] +* Extracted `FieldDefinition\Reference` ([#157]), by [@localheinz] ### Fixed @@ -82,5 +83,6 @@ For a full diff see [`fa9c564...master`][fa9c564...master]. [#133]: https://github.com/ergebnis/factory-bot/pull/133 [#149]: https://github.com/ergebnis/factory-bot/pull/149 [#155]: https://github.com/ergebnis/factory-bot/pull/155 +[#157]: https://github.com/ergebnis/factory-bot/pull/157 [@localheinz]: https://github.com/localheinz diff --git a/Makefile b/Makefile index a27ef58a..17fb36de 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -MIN_COVERED_MSI:=98 -MIN_MSI:=96 +MIN_COVERED_MSI:=99 +MIN_MSI:=97 .PHONY: it it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests targets diff --git a/src/FieldDefinition.php b/src/FieldDefinition.php index 62d54dbc..f704ed87 100644 --- a/src/FieldDefinition.php +++ b/src/FieldDefinition.php @@ -13,9 +13,6 @@ namespace Ergebnis\FactoryBot; -/** - * Contains static methods to define fields as sequences, references etc. - */ final class FieldDefinition implements FieldDefinition\Resolvable { private $closure; diff --git a/test/Integration/FixtureFactoryTest.php b/test/Integration/FixtureFactoryTest.php index 0dad5e9a..bf61622d 100644 --- a/test/Integration/FixtureFactoryTest.php +++ b/test/Integration/FixtureFactoryTest.php @@ -25,6 +25,7 @@ * * @uses \Ergebnis\FactoryBot\EntityDefinition * @uses \Ergebnis\FactoryBot\FieldDefinition + * @uses \Ergebnis\FactoryBot\FieldDefinition\Reference */ final class FixtureFactoryTest extends AbstractTestCase { diff --git a/test/Unit/FieldDefinition/ReferenceTest.php b/test/Unit/FieldDefinition/ReferenceTest.php index 8a18c4d2..4d987fa2 100644 --- a/test/Unit/FieldDefinition/ReferenceTest.php +++ b/test/Unit/FieldDefinition/ReferenceTest.php @@ -23,6 +23,8 @@ * * @covers \Ergebnis\FactoryBot\FieldDefinition\Reference * + * @uses \Ergebnis\FactoryBot\EntityDefinition + * @uses \Ergebnis\FactoryBot\FieldDefinition * @uses \Ergebnis\FactoryBot\FixtureFactory */ final class ReferenceTest extends AbstractTestCase diff --git a/test/Unit/FieldDefinitionTest.php b/test/Unit/FieldDefinitionTest.php index c2191ad8..7822ec65 100644 --- a/test/Unit/FieldDefinitionTest.php +++ b/test/Unit/FieldDefinitionTest.php @@ -26,6 +26,7 @@ * * @uses \Ergebnis\FactoryBot\EntityDefinition * @uses \Ergebnis\FactoryBot\Exception\InvalidCount + * @uses \Ergebnis\FactoryBot\FieldDefinition\Reference * @uses \Ergebnis\FactoryBot\FixtureFactory */ final class FieldDefinitionTest extends AbstractTestCase diff --git a/test/Unit/FixtureFactoryTest.php b/test/Unit/FixtureFactoryTest.php index b3977357..89e8698e 100644 --- a/test/Unit/FixtureFactoryTest.php +++ b/test/Unit/FixtureFactoryTest.php @@ -26,13 +26,14 @@ * @covers \Ergebnis\FactoryBot\FixtureFactory * * @uses \Ergebnis\FactoryBot\EntityDefinition - * @uses \Ergebnis\FactoryBot\FieldDefinition * @uses \Ergebnis\FactoryBot\Exception\ClassMetadataNotFound * @uses \Ergebnis\FactoryBot\Exception\ClassNotFound * @uses \Ergebnis\FactoryBot\Exception\EntityDefinitionAlreadyRegistered * @uses \Ergebnis\FactoryBot\Exception\EntityDefinitionNotRegistered * @uses \Ergebnis\FactoryBot\Exception\InvalidCount * @uses \Ergebnis\FactoryBot\Exception\InvalidFieldNames + * @uses \Ergebnis\FactoryBot\FieldDefinition + * @uses \Ergebnis\FactoryBot\FieldDefinition\Reference */ final class FixtureFactoryTest extends AbstractTestCase {