[wp-trac] [WordPress Trac] #31135: register_taxonomy() should call a _doing_it_wrong() when called with an empty taxonomy name
WordPress Trac
noreply at wordpress.org
Mon Jan 26 07:55:42 UTC 2015
#31135: register_taxonomy() should call a _doing_it_wrong() when called with an
empty taxonomy name
--------------------------+------------------
Reporter: tyxla | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.2
Component: Taxonomy | Version: 3.0
Severity: minor | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------
Comment (by DrewAPicture):
Just a couple of things on [attachment:31135.2.patch]:
* Rather than tacking tests on to the main `test_register_taxonomy()`
method, you should split them out to more specifically-named tests. For
instance, the "> 32 characters" case is already covered by
`test_register_long_taxonomy()` a few lines below your changes
* Realistically, we're checking for the returned `WP_Error` object instead
of a `_doing_it_wrong()` to confirm the test, see below for an example of
this:
{{{
#!php
<?php
/**
* @ticket 21593
*
* @expectedIncorrectUsage register_taxonomy
*/
function test_register_long_taxonomy() {
$this->assertInstanceOf( 'WP_Error', register_taxonomy(
'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) );
}
}}}
* So perhaps creating a `test_register_short_taxonomy()` block might be
the way to go. I'd follow the same syntax as for long
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31135#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list