Merge pull request #27043 from woocommerce/fix/unit-test-suite

Test Suite & Namespace PHPCS Changes
This commit is contained in:
Christopher Allford 2020-07-20 08:40:00 -07:00 committed by GitHub
commit 636327c110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 45 deletions

View File

@ -25,7 +25,7 @@
<arg name="parallel" value="8" /> <arg name="parallel" value="8" />
<!-- Configs --> <!-- Configs -->
<config name="minimum_supported_wp_version" value="5.0" /> <config name="minimum_supported_wp_version" value="5.2" />
<config name="testVersion" value="7.0-" /> <config name="testVersion" value="7.0-" />
<!-- Rules --> <!-- Rules -->
@ -43,8 +43,19 @@
<rule ref="WordPress.Files.FileName.InvalidClassFileName"> <rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>includes/**/abstract-*.php</exclude-pattern> <exclude-pattern>includes/**/abstract-*.php</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern> <exclude-pattern>tests/</exclude-pattern>
<exclude-pattern>src/*</exclude-pattern> <exclude-pattern>src/</exclude-pattern>
<exclude-pattern>tests/php/src/</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ClassFileName">
<include-pattern>src/</include-pattern>
<include-pattern>tests/php/src/</include-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName">
<include-pattern>src/</include-pattern>
<include-pattern>tests/php/src/</include-pattern>
</rule> </rule>
<rule ref="Generic.Commenting"> <rule ref="Generic.Commenting">
@ -61,4 +72,12 @@
<exclude-pattern>tests/php</exclude-pattern> <exclude-pattern>tests/php</exclude-pattern>
<exclude-pattern>tests/Tools/</exclude-pattern> <exclude-pattern>tests/Tools/</exclude-pattern>
</rule> </rule>
<rule ref="Squiz.Commenting.FunctionCommentThrowTag.Missing">
<exclude-pattern>tests/php/</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment.Missing">
<exclude-pattern>tests/php/</exclude-pattern>
</rule>
</ruleset> </ruleset>

View File

@ -1,9 +1,4 @@
<?php <?php
/**
* Class WC_Helper_API unit tests.
*
* @package WooCommerce\Tests\Importer
*/
/** /**
* Test class for WC_Helper_API. * Test class for WC_Helper_API.
@ -22,8 +17,6 @@ class WC_Tests_Helper_API extends WC_Unit_Test_Case {
/** /**
* Test that the url method returns the correct WooCommerce.com path. * Test that the url method returns the correct WooCommerce.com path.
*
* @return void
*/ */
public function test_api_url() { public function test_api_url() {
$url = WC_Helper_API::url( '/test-path' ); $url = WC_Helper_API::url( '/test-path' );
@ -32,8 +25,6 @@ class WC_Tests_Helper_API extends WC_Unit_Test_Case {
/** /**
* Test a GET request through the WC_Helper_API. * Test a GET request through the WC_Helper_API.
*
* @return void
*/ */
public function test_get_request() { public function test_get_request() {
$request = WC_Helper_API::get( $request = WC_Helper_API::get(
@ -45,8 +36,6 @@ class WC_Tests_Helper_API extends WC_Unit_Test_Case {
/** /**
* Test a POST request through the WC_Helper_API. * Test a POST request through the WC_Helper_API.
*
* @return void
*/ */
public function test_post_request() { public function test_post_request() {
$request = WC_Helper_API::post( $request = WC_Helper_API::post(
@ -58,8 +47,6 @@ class WC_Tests_Helper_API extends WC_Unit_Test_Case {
/** /**
* Test a PUT request through the WC_Helper_API. * Test a PUT request through the WC_Helper_API.
*
* @return void
*/ */
public function test_put_request() { public function test_put_request() {
$request = WC_Helper_API::put( $request = WC_Helper_API::put(

View File

@ -1,9 +1,4 @@
<?php <?php
/**
* Class WC_Tests_WC_Helper file.
*
* @package WooCommerce|Tests|WC_Helper.
*/
/** /**
* Class WC_Tests_WC_Helper. * Class WC_Tests_WC_Helper.

View File

@ -1,13 +1,9 @@
<?php <?php
/**
* Class WC_Product_CSV_Importer_Controller_Test
* @package WooCommerce\Tests\Admin
*
* Tests to ensure that the CSV product importer works as expected.
*/
/** /**
* Class WC_Product_CSV_Importer_Controller_Test * Class WC_Product_CSV_Importer_Controller_Test
*
* Tests to ensure that the CSV product importer works as expected.
*/ */
class WC_Product_CSV_Importer_Controller_Test extends WC_Unit_Test_Case { class WC_Product_CSV_Importer_Controller_Test extends WC_Unit_Test_Case {

View File

@ -1,16 +1,9 @@
<?php <?php
/**
* Class WCInstallTest file.
*
* @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. * Test if verify base table can detect missing table and adds/remove a notice.

View File

@ -1 +0,0 @@
# Placeholder to include the folder. Remove once tests have been written!

View File

@ -1,18 +1,11 @@
<?php <?php
/**
* Tests for ConnectionHelper for WCCom
*
* @package WooCommerce|Tests|Internal|WCCom.
*/
namespace Automattic\WooCommerce\Tests\Internal; namespace Automattic\WooCommerce\Tests\Internal\WCCom;
use Automattic\WooCommerce\Internal\WCCom\ConnectionHelper; use Automattic\WooCommerce\Internal\WCCom\ConnectionHelper;
/** /**
* Class ConnectionHelperTest. * Class ConnectionHelperTest.
*
* @package Automattic\WooCommerce\Tests\Internal.
*/ */
class ConnectionHelperTest extends \WC_Unit_Test_Case { class ConnectionHelperTest extends \WC_Unit_Test_Case {