diff --git a/tests/phpunit/tests/blocks/wpBlockTypeRegistry.php b/tests/phpunit/tests/blocks/wpBlockTypeRegistry.php index c97bdc95d43a1..37773a13b7c91 100644 --- a/tests/phpunit/tests/blocks/wpBlockTypeRegistry.php +++ b/tests/phpunit/tests/blocks/wpBlockTypeRegistry.php @@ -7,6 +7,8 @@ * @since 5.0.0 * * @group blocks + * + * @covers WP_Block_Type_Registry */ class Tests_Blocks_wpBlockTypeRegistry extends WP_UnitTestCase { @@ -41,51 +43,30 @@ public function tear_down() { } /** - * Should reject numbers - * - * @ticket 45097 - * - * @expectedIncorrectUsage WP_Block_Type_Registry::register - */ - public function test_invalid_non_string_names() { - $result = $this->registry->register( 1, array() ); - $this->assertFalse( $result ); - } - - /** - * Should reject blocks without a namespace - * - * @ticket 45097 - * - * @expectedIncorrectUsage WP_Block_Type_Registry::register - */ - public function test_invalid_names_without_namespace() { - $result = $this->registry->register( 'paragraph', array() ); - $this->assertFalse( $result ); - } - - /** - * Should reject blocks with invalid characters + * Should reject invalid block names. * * @ticket 45097 * + * @dataProvider data_invalid_block_names * @expectedIncorrectUsage WP_Block_Type_Registry::register */ - public function test_invalid_characters() { - $result = $this->registry->register( 'still/_doing_it_wrong', array() ); + public function test_invalid_block_names( $name ) { + $result = $this->registry->register( $name, array() ); $this->assertFalse( $result ); } /** - * Should reject blocks with uppercase characters - * - * @ticket 45097 + * Data provider for test_invalid_block_names(). * - * @expectedIncorrectUsage WP_Block_Type_Registry::register + * @return array */ - public function test_uppercase_characters() { - $result = $this->registry->register( 'Core/Paragraph', array() ); - $this->assertFalse( $result ); + public function data_invalid_block_names(): array { + return array( + 'non-string name' => array( 1 ), + 'no namespace' => array( 'paragraph' ), + 'invalid characters' => array( 'still/_doing_it_wrong' ), + 'uppercase characters' => array( 'Core/Paragraph' ), + ); } /** diff --git a/tests/phpunit/tests/rewrite/addRewriteEndpoint.php b/tests/phpunit/tests/rewrite/addRewriteEndpoint.php index 7b3ada5febe7d..6527f32929917 100644 --- a/tests/phpunit/tests/rewrite/addRewriteEndpoint.php +++ b/tests/phpunit/tests/rewrite/addRewriteEndpoint.php @@ -2,6 +2,8 @@ /** * @group rewrite + * + * @covers ::add_rewrite_endpoint */ class Tests_Rewrite_AddRewriteEndpoint extends WP_UnitTestCase { private $qvs; diff --git a/tests/phpunit/tests/rewrite/addRewriteRule.php b/tests/phpunit/tests/rewrite/addRewriteRule.php index 02efc7bd0aa37..d667f58ceafa9 100644 --- a/tests/phpunit/tests/rewrite/addRewriteRule.php +++ b/tests/phpunit/tests/rewrite/addRewriteRule.php @@ -2,6 +2,8 @@ /** * @group rewrite + * + * @covers ::add_rewrite_rule */ class Tests_Rewrite_AddRewriteRule extends WP_UnitTestCase {