[wp-trac] [WordPress Trac] #44707: The user should be able to create additional requests when previous duplicates are complete or archived
WordPress Trac
noreply at wordpress.org
Wed Aug 8 06:00:42 UTC 2018
#44707: The user should be able to create additional requests when previous
duplicates are complete or archived
--------------------------------------------+------------------------------
Reporter: garrett-eclipse | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Privacy | Version: 4.9.6
Severity: normal | Resolution:
Keywords: needs-refresh needs-unit-tests | Focuses: privacy
--------------------------------------------+------------------------------
Changes (by garrett-eclipse):
* keywords: needs-refresh reporter-feedback needs-unit-tests => needs-
refresh needs-unit-tests
Comment:
Thanks @cc0a,
Sorry looks like I got the user request stati incorrect, they should use
dashes instead of underscores as seen in their register_post_status calls;
https://github.com/WordPress/WordPress/blob/aab929b8d619bde14495a97cdc1eb7bdf1f1d487
/wp-includes/post.php#L318-L352
My bad, updated snippet;
{{{#!php
<?php
// Check for duplicates.
$requests_query = new WP_Query( array(
'post_type' => 'user_request',
'post_name__in' => array( $action_name ), // Action name stored
in post_name column.
'title' => $email_address, // Email address stored in
post_title column.
'post_status' => array( 'request-pending', 'request-confirmed'
),
'fields' => 'ids',
) );
}}}
With that change this is good for some unit tests. I haven't written much
unit tests so will defer to @desrosj for help but here's the guide;
https://make.wordpress.org/core/handbook/testing/automated-testing
/writing-phpunit-tests/
The tests should attempt to duplicate identical requests of the different
stati and confirm that request-failed and request-confirmed are allowed
duplicate requests while request-pending and request-confirmed block
duplicates.
Thanks again
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44707#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list