From 13536bef5b0edd66d31d152171205935a6638ab9 Mon Sep 17 00:00:00 2001 From: Christopher Allford Date: Wed, 15 Jul 2020 14:20:26 -0700 Subject: [PATCH 1/4] Corrected the WCInstallTest filename It is in the `includes` test section and should have the same filename as the corresponding class. --- .../{WCInstallTest.php => class-wc-install-test.php} | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) rename tests/php/includes/{WCInstallTest.php => class-wc-install-test.php} (97%) diff --git a/tests/php/includes/WCInstallTest.php b/tests/php/includes/class-wc-install-test.php similarity index 97% rename from tests/php/includes/WCInstallTest.php rename to tests/php/includes/class-wc-install-test.php index da440ced39a..5c96de68d1f 100644 --- a/tests/php/includes/WCInstallTest.php +++ b/tests/php/includes/class-wc-install-test.php @@ -5,12 +5,10 @@ * @package WooCommerce|Tests|WCInstallTest. */ -namespace Automattic\WooCommerce; - /** - * Class WC_Tests_WC_Helper. + * Class WC_Install_Test. */ -class WCInstallTest extends \WC_Unit_Test_Case { +class WC_Install_Test extends \WC_Unit_Test_Case { /** * Test if verify base table can detect missing table and adds/remove a notice. From 55385f6cecba373447da85c6c5439647b2220120 Mon Sep 17 00:00:00 2001 From: Christopher Allford Date: Wed, 15 Jul 2020 14:21:34 -0700 Subject: [PATCH 2/4] Moved the orphaned unit test into the correct directory --- .../includes/admin}/helper/class-wc-helper-api.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{unit-tests => php/includes/admin}/helper/class-wc-helper-api.php (100%) diff --git a/tests/unit-tests/helper/class-wc-helper-api.php b/tests/php/includes/admin/helper/class-wc-helper-api.php similarity index 100% rename from tests/unit-tests/helper/class-wc-helper-api.php rename to tests/php/includes/admin/helper/class-wc-helper-api.php From f72b8db576e76e1774fdd002e8ca864c0d027410 Mon Sep 17 00:00:00 2001 From: Christopher Allford Date: Wed, 15 Jul 2020 14:29:13 -0700 Subject: [PATCH 3/4] Added some exceptions to the PHPCS standards for unit tests The file comments and @throws tags are unnecessary in unit tests. --- phpcs.xml | 10 +++++++++- .../includes/admin/helper/class-wc-helper-api.php | 13 ------------- .../includes/admin/helper/class-wc-helper-test.php | 5 ----- ...lass-wc-product-csv-importer-controller-test.php | 8 ++------ tests/php/includes/class-wc-install-test.php | 5 ----- 5 files changed, 11 insertions(+), 30 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index 8075b9d8ccc..c2ac57afd5a 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -25,7 +25,7 @@ - + @@ -61,4 +61,12 @@ tests/php tests/Tools/ + + + tests/php/ + + + + tests/php/ + diff --git a/tests/php/includes/admin/helper/class-wc-helper-api.php b/tests/php/includes/admin/helper/class-wc-helper-api.php index d59711770a2..3b30727df22 100644 --- a/tests/php/includes/admin/helper/class-wc-helper-api.php +++ b/tests/php/includes/admin/helper/class-wc-helper-api.php @@ -1,9 +1,4 @@ Date: Wed, 15 Jul 2020 16:09:00 -0700 Subject: [PATCH 4/4] Added sniffs to enforce PSR-4 in the `src` and `tests/php/src` directories --- phpcs.xml | 15 +++++++++++++-- tests/php/src/.gitkeep | 1 - .../src/Internal/WCCom/ConnectionHelperTest.php | 9 +-------- 3 files changed, 14 insertions(+), 11 deletions(-) delete mode 100644 tests/php/src/.gitkeep diff --git a/phpcs.xml b/phpcs.xml index c2ac57afd5a..02724758ce3 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -43,8 +43,19 @@ includes/**/abstract-*.php - tests/* - src/* + tests/ + src/ + tests/php/src/ + + + + src/ + tests/php/src/ + + + + src/ + tests/php/src/ diff --git a/tests/php/src/.gitkeep b/tests/php/src/.gitkeep deleted file mode 100644 index ff96249002a..00000000000 --- a/tests/php/src/.gitkeep +++ /dev/null @@ -1 +0,0 @@ -# Placeholder to include the folder. Remove once tests have been written! diff --git a/tests/php/src/Internal/WCCom/ConnectionHelperTest.php b/tests/php/src/Internal/WCCom/ConnectionHelperTest.php index 02dba33541d..27e858ec1d6 100644 --- a/tests/php/src/Internal/WCCom/ConnectionHelperTest.php +++ b/tests/php/src/Internal/WCCom/ConnectionHelperTest.php @@ -1,18 +1,11 @@