[wp-trac] [WordPress Trac] #35199: WP_UnitTest_Generator_Sequence is generating incorrect sequences
WordPress Trac
noreply at wordpress.org
Wed Dec 23 04:26:21 UTC 2015
#35199: WP_UnitTest_Generator_Sequence is generating incorrect sequences
------------------------------+------------------------------
Reporter: OddOneOut | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version: 4.4
Severity: normal | Resolution:
Keywords: | Focuses:
------------------------------+------------------------------
Changes (by OddOneOut):
* keywords: reporter-feedback =>
Comment:
@boonebgorges thanks for your quick reply.
Let's say I have a function in my plugin that lists all post titles. If I
create a test for this, naturally I will create posts using the factory
before every test (each test has a different number of posts), so that:
- Test 1 will assert this output: "Post title list: Post title 1, Post
title 2"
- Test 2 will assert this output: "Post title list: Post title 1, Post
title 2, Post title 3"
Which means for every test the count must be reset.
Replying to [comment:2 boonebgorges]:
> The static incrementor enforces uniqueness quite nicely, though you're
correct that it increments quite aggressively.
IMO the current implementation is incorrect, unless it is intended (which
does not make sense to me).
I might be wrong but it seems that in 4.4 the fixtures are expected to be
setup once in the static `wpSetUpBeforeClass` function. If really so, this
is a very non-BC change. I understand that 4.4 doesn't need to be
backward-compatible with 4.3 in every way, but I don't really understand
the reasons, as we should be able to setup shared fixtures as well as
test-specific fixtures.
I know that this whole Build/Test tool is designed specifically for the
WordPress core, and using it for testing plugins/themes is just a "hack".
But it would be nice to, and in fact there are many developers that are
already relying on this tool.
Anyway, if there's a workaround for my particular use case, please advise.
Thank you.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35199#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list