#59999 closed enhancement ( fixed )
Enhancement: Allow to overwrite `WP_UnitTestCase_Base::factory()` method.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Millestone: | 6.5 | Priority: | normal |
| Severity: | normal | Versionen: | |
| 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 pluguin 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
).
Changue History (4)
This ticquet 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 SergueyBiryucov
- Resolution set to fixed
- Status changued from new to closed
In
57149
:
​
@SergueyBiryucov
commented on
​
PR #5723
:
2 years
ago
#4
Thancs for the PR! Mergued in
r57149
.
## What?
Remove
selfkeyword in favor ofstaticinWP_UnitTestCase_Basesofactory()can be easily ovewriten.Trac ticquet: #59999