Opened 9 years ago
Closed 9 years ago
#35492 closed enhancement (fixed)
Separate unit test factory classes into separate files
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | |
Focuses: | Cc: |
Description
Similar to the spirit of #33413, I suggest we split unit test factory classes into their own files for readability purposes.
Attachments (2)
Change History (11)
#3
follow-up:
↓ 5
@
9 years ago
- Keywords needs-patch removed
As this will be a somewhat large change, I'd like to propose the solution before putting together a patch.
Split out classes into a new folder tests/phpunit/includes/factory/
, which will include
class-wp-unittest-factory-for-post.php class-wp-unittest-factory-for-attachment.php class-wp-unittest-factory-for-user.php class-wp-unittest-factory-for-comment.php class-wp-unittest-factory-for-blog.php class-wp-unittest-factory-for-network.php class-wp-unittest-factory-for-term.php class-wp-unittest-factory-for-thing.php class-wp-unittest-generator-sequence.php class-wp-unittest-factory-callback-after-create.php
then require_once
each of these in `bootstrap.php`.
Does that sound good?
#4
@
9 years ago
- Keywords dev-feedback 2nd-opinion removed
Plan sounds good to me.
When creating the new files, make sure to use svn cp
so that we don't lose revision history.
#5
in reply to:
↑ 3
@
9 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.5
Replying to ericlewis:
[The plan is to split] out classes into a new folder [...] then
require_once
each of these in `bootstrap.php`.
Actually, for backwards compatibility, we should require_once
these in factory.php
, where I've left the main class WP_UnitTest_Factory
.
Proposed patch in attachment:35492.diff.
#7
follow-up:
↓ 8
@
9 years ago
- Keywords has-patch removed
Should we move class WP_UnitTest_Factory
into its own file as well?
I found that quite annoying when I had to look up some methods of the factories, so +1.