#59999 closed enhancement (fixed)
Enhancement: Allow to overwrite `WP_UnitTestCase_Base::factory()` method.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.5 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description
What?
This is a enhancement request in order to overwrite WP_UnitTestCase_Base::factory() static method in child classes of WP_UnitTestCase_Base.
Why?
To be able to overwrite WP_UnitTest_Factory.
As an example, as third party plugin could write its own factory extending WP_UnitTest_Factory for testing purposes.
And to benefit from WP_UnitTestCase_Base features, its test case would also extend it.
But overwriting WP_UnitTestCase_Base::factory() has no effect since it's called with the self keyword instead of the static keyword which has late static binding (see here and here).
Change History (4)
This ticket was mentioned in PR #5723 on WordPress/wordpress-develop by @hugod.
2 years ago
#1
- Keywords has-patch has-unit-tests added
#3
@
2 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 57149:
@SergeyBiryukov commented on PR #5723:
2 years ago
#4
Thanks for the PR! Merged in r57149.
## What?
Remove
selfkeyword in favor ofstaticinWP_UnitTestCase_Basesofactory()can be easily ovewriten.Trac ticket: #59999