From a3a926097a15b206466637c363e3afcc0da9c120 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 8 Aug 2022 23:22:43 +0000 Subject: [PATCH] Build/Test Tools: Add @covers tags to the import tests. Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev. See #39265. git-svn-id: https://develop.svn.wordpress.org/trunk@53864 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/import/import.php | 11 +++++++++++ tests/phpunit/tests/import/parser.php | 25 +++++++++++++++++++++++++ tests/phpunit/tests/import/postmeta.php | 2 ++ 3 files changed, 38 insertions(+) diff --git a/tests/phpunit/tests/import/import.php b/tests/phpunit/tests/import/import.php index 1053b01dbb..0f4412fe11 100644 --- a/tests/phpunit/tests/import/import.php +++ b/tests/phpunit/tests/import/import.php @@ -33,6 +33,9 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { } } + /** + * @covers WP_Import::import + */ public function test_small_import() { global $wpdb; @@ -201,6 +204,9 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { $this->assertCount( 1, $cats ); } + /** + * @covers WP_Import::import + */ public function test_double_import() { $authors = array( 'admin' => false, @@ -242,6 +248,9 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { $this->assertSame( 1, $comment_count->total_comments ); } + /** + * @covers ::get_importers + */ public function test_ordering_of_importers() { global $wp_importers; $_wp_importers = $wp_importers; // Preserve global state. @@ -267,6 +276,8 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { /** * @ticket 21007 + * + * @covers WP_Import::import */ public function test_slashes_should_not_be_stripped() { global $wpdb; diff --git a/tests/phpunit/tests/import/parser.php b/tests/phpunit/tests/import/parser.php index 40ed789ac6..76dc3c1972 100644 --- a/tests/phpunit/tests/import/parser.php +++ b/tests/phpunit/tests/import/parser.php @@ -24,6 +24,10 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php'; } + /** + * @covers WXR_Parser_SimpleXML::parse + * @covers WXR_Parser_XML::parse + */ public function test_malformed_wxr() { $file = DIR_TESTDATA . '/export/malformed.xml'; @@ -36,6 +40,11 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { } } + /** + * @covers WXR_Parser_SimpleXML::parse + * @covers WXR_Parser_XML::parse + * @covers WXR_Parser_Regex::parse + */ public function test_invalid_wxr() { $f1 = DIR_TESTDATA . '/export/missing-version-tag.xml'; $f2 = DIR_TESTDATA . '/export/invalid-version-tag.xml'; @@ -50,6 +59,11 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { } } + /** + * @covers WXR_Parser_SimpleXML::parse + * @covers WXR_Parser_XML::parse + * @covers WXR_Parser_Regex::parse + */ public function test_wxr_version_1_1() { $file = DIR_TESTDATA . '/export/valid-wxr-1.1.xml'; @@ -143,6 +157,11 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { } } + /** + * @covers WXR_Parser_SimpleXML::parse + * @covers WXR_Parser_XML::parse + * @covers WXR_Parser_Regex::parse + */ public function test_wxr_version_1_0() { $file = DIR_TESTDATA . '/export/valid-wxr-1.0.xml'; @@ -236,6 +255,10 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { * sections that contain escaped closing tags ("]]>" -> "]]]]>"). * * @link https://core.trac.wordpress.org/ticket/15203 + * + * @covers WXR_Parser_SimpleXML::parse + * @covers WXR_Parser_XML::parse + * @covers WXR_Parser_Regex::parse */ public function test_escaped_cdata_closing_sequence() { $file = DIR_TESTDATA . '/export/crazy-cdata-escaped.xml'; @@ -269,6 +292,8 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { /** * Ensure that the regex parser can still parse invalid CDATA blocks (i.e. those * with "]]>" unescaped within a CDATA section). + * + * @covers WXR_Parser_Regex::parse */ public function test_unescaped_cdata_closing_sequence() { $file = DIR_TESTDATA . '/export/crazy-cdata.xml'; diff --git a/tests/phpunit/tests/import/postmeta.php b/tests/phpunit/tests/import/postmeta.php index 0abd7f0a9d..bbe10deca9 100644 --- a/tests/phpunit/tests/import/postmeta.php +++ b/tests/phpunit/tests/import/postmeta.php @@ -4,6 +4,8 @@ require_once __DIR__ . '/base.php'; /** * @group import + * + * @covers WP_Import::import */ class Tests_Import_Postmeta extends WP_Import_UnitTestCase { public function set_up() {