#35160 closed enhancement (fixed)
Add Test Coverage for Atom & Reorganize Feeds Unit Tests
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.5 | Priority: | high |
Severity: | normal | Version: | |
Component: | Feeds | Keywords: | has-unit-tests |
Focuses: | Cc: |
Description (last modified by )
In Make WordPress Core, we refer to the syndication components as the "Feeds Component". However, in our unit tests, we have the group labelled in its singular form, "Feed". I proposing that we rename this group to its plural form and relocate these test into the tests/phpunit/tests/feeds/
directory.
IMPORTANT -- I don't believe svn diff has the ability to delete directories, so if this proposal is accepted, we need to make sure to manually rename/delete the tests/phpunit/tests/feed
directory before commit. Apologies in advance!
In addition to renaming the group, this ticket aims to separate generic syndication tests from the RSS-specific test and additionally provides test coverage for Atom feeds, which currently do not exists.
I feel it is also important to note that this will mandate a refresh of any feeds-related unit tests that are currently sitting in trac. I am willing to commit to refreshing those personally, but would prefer to hold on pending approval from the Committers.
Lastly, this patch proposes a new file, tests/phpunit/tests/feeds/common.php
, which contains 3 brand new tests that will currently fail against trunk. I wanted to leave these in here to demonstrate what I was thinking with the common
tests. These relate to ticket #30210. However, if I take them back out, the purpose of the common.php
file becomes much less apparant. Let's discuss!
Attachments (4)
Change History (21)
#5
@
9 years ago
- Priority changed from normal to high
Raising priority since this is blocking any ticket where Atom testing is required. e.g. #33591
This ticket was mentioned in Slack in #core by stevenkword. View the logs.
9 years ago
#7
@
9 years ago
- Keywords needs-patch added; has-patch removed
Bug Scrub 1/8/2016 notes:
- The renaming of the group was favorable, with the note that when it is done, the associated PHP files also need to have the file docbloc item updated as well.
- Patch should be split as follows:
Phase 1: Add atom tests.
Phase 2: Rename the group.
Phase 3: Add the common.php tests AFTER the group is renamed, which currently fail and need to be fixed.
- Some of the patch functions have incomplete and/or missing docblocs.
- Some parts of the patch have formatting issues that need to be addressed.
#8
@
9 years ago
A few notes:
- The
post_count
andexcerpt_only
properties aren't set in theTests_Feeds_Atom
class.
In both Tests_Feeds_Atom
and Tests_Feeds_RSS2
:
- The author assertion needs to test against the user's display name, not their
user_login
. Need to explicitly set a display name when creating the test user. - The test posts should have some categories and tags assigned so the category and tag assertions operate on more than just the default category and an empty tag list.
- Creating more than 5 test posts might be a good idea, then an assertion can be added to ensure the feeds contain the correct number of posts.
- Unless the test posts have explicitly differentiating properties (which they don't), there's no need to loop over every post and run the assertions. Just running the assertions on the first post is enough.
assertCount( 1, $x )
can be used instead ofassertEquals( 1, count( $x ) )
.
#9
@
9 years ago
35160.atom.patch takes the suggestions made by @johnbillion into consideration. I'd rather just get the Atom tests in for now since they are blocking other tickets, and we can create new tickets down the road for dealing with common / RSS.
#10
@
9 years ago
- Summary changed from Reorganize Feeds Unit Tests & Add Test Coverage for Atom to Add Test Coverage for Atom & Reorganize Feeds Unit Tests
#11
@
9 years ago
I've also added 35160.rss2.patch which improves usage of coding standards and doc, but also implements the recommended changes found in 35160.atom.patch . They are both in the same "style" at this time.
@jorbin -- You might be interested in this one.