[PHPUnitBridge] Add enum_exists mock#17538
Conversation
enum_exists mockenum_exists mock
|
a combination of withMockedClasses + withMockedEnums should be explained IMHO (symfony/symfony#48516 (comment)) |
|
@ro0NL the doc was actually written before adding |
|
while at it, we should probably mention mocking a class (symbol) means all *_exists() functions return true except enums, hence mockWithEnum |
6771d45 to
002d4fc
Compare
|
Updated, @javiereguiluz please tell me if I need to rephrase anything! 🙂 |
| and :phpfunction:`trait_exists` return true. | ||
|
|
||
| To register an enumeration and mock :phpfunction:`enum_exists`, | ||
| ``ClassExistsMock::withMockedEnums()`` must be used. |
There was a problem hiding this comment.
perhaps it's obvious for ppl, but only yesteday i realized class_exists returns true for enums (symfony/symfony#48516 (comment))
so what this new method enables doing is:
withMockedClasses([SomeClass::class => true])
withMockedEnums([SomeClass::class => false])to trigger a code path for if (class_exists(SomeClass::class) && !enum_exists(SomeClass::class)) {
…ois) This PR was merged into the 6.3 branch. Discussion ---------- [PhpUnitBridge] Add `enum_exists` mock | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | _N/A_ | License | MIT | Doc PR | symfony/symfony-docs#17538 Commits ------- 8d3e897 [PhpUnitBridge] Add `enum_exists` mock
|
@alexandre-daubois can you please check if this PR is up-to-date with the latest work in the code PR? Please ping me afterwards, so I can merge it, thanks |
002d4fc to
d18c238
Compare
|
@OskarStark I updated the documentation! 🙂 |
|
Thanks Alexandre. |
Related to symfony/symfony#48516