generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 4
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: Implement WithOptionalStrategy #365
Merged
Merged
Conversation
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
localheinz
force-pushed
the
feature/with-optional
branch
from
August 4, 2020 16:09
755e558
to
889413b
Compare
Codecov Report
@@ Coverage Diff @@
## main #365 +/- ##
============================================
+ Coverage 98.41% 99.01% +0.60%
- Complexity 98 107 +9
============================================
Files 21 24 +3
Lines 252 304 +52
============================================
+ Hits 248 301 +53
+ Misses 4 3 -1
Continue to review full report at Codecov.
|
localheinz
force-pushed
the
feature/with-optional
branch
3 times, most recently
from
August 4, 2020 17:11
fbf7c8b
to
14b50a5
Compare
localheinz
force-pushed
the
feature/with-optional
branch
from
August 4, 2020 18:08
14b50a5
to
bbf75f1
Compare
localheinz
force-pushed
the
feature/with-optional
branch
from
August 4, 2020 18:09
bbf75f1
to
8c6b6b0
Compare
ergebnis-bot
approved these changes
Aug 4, 2020
ergebnis-bot
approved these changes
Aug 4, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR
WithOptionalStrategy
πββοΈ The fixture factory currently uses a
DefaultStrategy
for resolving field definitions.This strategy involves random behavior, and
FieldDefinition::optionalClosure()
might be resolved tonull
a concrete valueFieldDefinition::optionalReference()
might be resolved tonull
or a concrete referenceFieldDefinition::optionalSequence()
might be resolved tonull
or a concrete valueFieldDefinition::optionalValue()
might be resolved tonull
or a concrete valueFieldDefinition::references()
might be resolved to an emptyarray
or anarray
of referencesYou might have a scenario where you have entity definitions that use optional field definitions, but would like to create an entity where these optional field definitions are resolved to concrete values or references. In this case you can use a fixture factory with the
WithOptionalStrategy
.This strategy still involves random behavior, but
FieldDefinition::optionalClosure()
will be resolved to a concrete valueFieldDefinition::optionalReference()
will be resolved to a concrete valueFieldDefinition::optionalSequence()
will be resolved to a concrete valueFieldDefinition::optionalValue()
will be resolved to a concrete valueFieldDefinition::references()
will be resolved to a non-emptyarray