[dev] PSR-4 naming fixes in tests (part 2) (#51198)
In this PR we address PSR-4 naming-related violations (class FQN vs path mismatches and co) in tests.
This commit is contained in:
parent
d185a34145
commit
8dcb562c39
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Coding standatds: fix PSR-4 naming violation in tests (part 2).
|
|
@ -55,11 +55,16 @@
|
||||||
<include-pattern>tests/php/src/</include-pattern>
|
<include-pattern>tests/php/src/</include-pattern>
|
||||||
<exclude-pattern>plugins/woocommerce/src/Admin/Notes/DeprecatedNotes.php</exclude-pattern>
|
<exclude-pattern>plugins/woocommerce/src/Admin/Notes/DeprecatedNotes.php</exclude-pattern>
|
||||||
<exclude-pattern>plugins/woocommerce/tests/php/src/Proxies/ExampleClasses/</exclude-pattern>
|
<exclude-pattern>plugins/woocommerce/tests/php/src/Proxies/ExampleClasses/</exclude-pattern>
|
||||||
|
<exclude-pattern>plugins/woocommerce/tests/php/src/Internal/DependencyManagement/ExampleClasses/</exclude-pattern>
|
||||||
<properties>
|
<properties>
|
||||||
<property name="composerJsonPath" value="composer.json"/>
|
<property name="composerJsonPath" value="composer.json"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod.Found">
|
||||||
|
<exclude-pattern>plugins/woocommerce/tests/php/src/Blocks/Mocks/</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule ref="Generic.PHP.RequireStrictTypes">
|
<rule ref="Generic.PHP.RequireStrictTypes">
|
||||||
<include-pattern>includes/</include-pattern>
|
<include-pattern>includes/</include-pattern>
|
||||||
<include-pattern>lib/</include-pattern>
|
<include-pattern>lib/</include-pattern>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Admin\Features\ShippingPartnerSuggestions;
|
namespace Automattic\WooCommerce\Tests\Admin\ShippingPartnerSuggestions;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\EvaluateSuggestion;
|
use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\EvaluateSuggestion;
|
||||||
use Automattic\WooCommerce\Admin\Features\ShippingPartnerSuggestions\DefaultShippingPartners;
|
use Automattic\WooCommerce\Admin\Features\ShippingPartnerSuggestions\DefaultShippingPartners;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare( strict_types = 1 );
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Templates;
|
namespace Automattic\WooCommerce\Tests\Blocks\BlockTypes;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Tests\Blocks\Mocks\BlockHooksTestBlock;
|
use Automattic\WooCommerce\Tests\Blocks\Mocks\BlockHooksTestBlock;
|
||||||
use WP_UnitTestCase;
|
use WP_UnitTestCase;
|
||||||
|
|
|
@ -1,25 +1,47 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Utils;
|
namespace Automattic\WooCommerce\Tests\Blocks;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\Migration;
|
use Automattic\WooCommerce\Blocks\Migration;
|
||||||
use Automattic\WooCommerce\Blocks\Options;
|
use Automattic\WooCommerce\Blocks\Options;
|
||||||
use Mockery;
|
use Mockery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit tests for the Migration class.
|
||||||
|
*/
|
||||||
class MigrationTest extends \WP_UnitTestCase {
|
class MigrationTest extends \WP_UnitTestCase {
|
||||||
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
|
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup testing environment.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function setUp(): void {
|
protected function setUp(): void {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
delete_option( Options::WC_BLOCK_USE_BLOCKIFIED_PRODUCT_GRID_BLOCK_AS_TEMPLATE );
|
delete_option( Options::WC_BLOCK_USE_BLOCKIFIED_PRODUCT_GRID_BLOCK_AS_TEMPLATE );
|
||||||
delete_option( Options::WC_BLOCK_VERSION );
|
delete_option( Options::WC_BLOCK_VERSION );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup testing environment.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function tearDown(): void {
|
protected function tearDown(): void {
|
||||||
\Mockery::close();
|
\Mockery::close();
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inject test data into migration mock.
|
||||||
|
*
|
||||||
|
* @param Migration $mock The mock to patch.
|
||||||
|
* @param array $data The data to inject.
|
||||||
|
*
|
||||||
|
* @return Migration
|
||||||
|
*/
|
||||||
private function set_db_upgrades( Migration $mock, array $data ) {
|
private function set_db_upgrades( Migration $mock, array $data ) {
|
||||||
$reflection = new \ReflectionClass( Migration::class );
|
$reflection = new \ReflectionClass( Migration::class );
|
||||||
$property = $reflection->getProperty( 'db_upgrades' );
|
$property = $reflection->getProperty( 'db_upgrades' );
|
||||||
|
@ -32,6 +54,9 @@ class MigrationTest extends \WP_UnitTestCase {
|
||||||
return $mock;
|
return $mock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test running single migration.
|
||||||
|
*/
|
||||||
public function test_migrations_run() {
|
public function test_migrations_run() {
|
||||||
update_option( Options::WC_BLOCK_VERSION, '1.0.0' );
|
update_option( Options::WC_BLOCK_VERSION, '1.0.0' );
|
||||||
|
|
||||||
|
@ -53,6 +78,9 @@ class MigrationTest extends \WP_UnitTestCase {
|
||||||
$mock->run_migrations();
|
$mock->run_migrations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test running multiple migrations.
|
||||||
|
*/
|
||||||
public function test_multiple_migrations_run() {
|
public function test_multiple_migrations_run() {
|
||||||
update_option( Options::WC_BLOCK_VERSION, '0.0.9' );
|
update_option( Options::WC_BLOCK_VERSION, '0.0.9' );
|
||||||
|
|
||||||
|
@ -76,6 +104,9 @@ class MigrationTest extends \WP_UnitTestCase {
|
||||||
$mock->run_migrations();
|
$mock->run_migrations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test skipping executed migrations.
|
||||||
|
*/
|
||||||
public function test_skip_migrations() {
|
public function test_skip_migrations() {
|
||||||
update_option( Options::WC_BLOCK_VERSION, '2.0.0' );
|
update_option( Options::WC_BLOCK_VERSION, '2.0.0' );
|
||||||
|
|
||||||
|
@ -95,6 +126,9 @@ class MigrationTest extends \WP_UnitTestCase {
|
||||||
$mock->run_migrations();
|
$mock->run_migrations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test skipping executed migrations.
|
||||||
|
*/
|
||||||
public function test_skip_migrations_when_missing_version_option() {
|
public function test_skip_migrations_when_missing_version_option() {
|
||||||
|
|
||||||
$mock = Mockery::mock( Migration::class )->makePartial();
|
$mock = Mockery::mock( Migration::class )->makePartial();
|
||||||
|
@ -112,5 +146,4 @@ class MigrationTest extends \WP_UnitTestCase {
|
||||||
|
|
||||||
$mock->run_migrations();
|
$mock->run_migrations();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
|
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
||||||
|
|
||||||
|
use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mock class.
|
||||||
|
*/
|
||||||
|
class AssetDataRegistryMock extends AssetDataRegistry {
|
||||||
|
/**
|
||||||
|
* Debug flag.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $debug = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the debug flag value.
|
||||||
|
*
|
||||||
|
* @param bool $debug The debug flag value to set.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set_debug( $debug ) {
|
||||||
|
$this->debug = $debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the debug flag value.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function debug() {
|
||||||
|
return $this->debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exposes private registered data to child classes.
|
||||||
|
*
|
||||||
|
* @return array The registered data on the private data property
|
||||||
|
*/
|
||||||
|
public function get() {
|
||||||
|
return parent::get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for on demand initialization of asset data and registering it with
|
||||||
|
* the internal data registry.
|
||||||
|
*
|
||||||
|
* Note: core data will overwrite any externally registered data via the api.
|
||||||
|
*/
|
||||||
|
public function initialize_core_data() {
|
||||||
|
parent::initialize_core_data();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loops through each registered lazy data callback and adds the returned
|
||||||
|
* value to the data array.
|
||||||
|
*
|
||||||
|
* This method is executed right before preparing the data for printing to
|
||||||
|
* the rendered screen.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function execute_lazy_data() {
|
||||||
|
parent::execute_lazy_data();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils;
|
use Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils;
|
||||||
|
@ -10,9 +12,9 @@ class CartCheckoutUtilsMock extends CartCheckoutUtils {
|
||||||
/**
|
/**
|
||||||
* Protected test wrapper for deep_sort_with_accents.
|
* Protected test wrapper for deep_sort_with_accents.
|
||||||
*
|
*
|
||||||
* @param array $array The array we want to sort.
|
* @param array $array_to_sort The array we want to sort.
|
||||||
*/
|
*/
|
||||||
public static function deep_sort_test( $array ) {
|
public static function deep_sort_test( $array_to_sort ) {
|
||||||
return self::deep_sort_with_accents( $array );
|
return self::deep_sort_with_accents( $array_to_sort );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mock class.
|
||||||
|
*/
|
||||||
class MockTestDependency {
|
class MockTestDependency {
|
||||||
|
/**
|
||||||
|
* Dependency.
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
public $dependency;
|
public $dependency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param object $dependency Another dependency.
|
||||||
|
*/
|
||||||
public function __construct( $dependency = null ) {
|
public function __construct( $dependency = null ) {
|
||||||
$this->dependency = $dependency;
|
$this->dependency = $dependency;
|
||||||
}
|
}
|
||||||
};
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Mocks\OrderConfirmation;
|
namespace Automattic\WooCommerce\Tests\Blocks\Mocks\OrderConfirmation;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\Package;
|
use Automattic\WooCommerce\Blocks\Package;
|
||||||
|
@ -23,15 +25,24 @@ class TotalsMock extends Totals {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
|
|
||||||
return parent::render_content( $order, $permission, $attributes, $content );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For now don't need to initialize anything in tests so let's
|
* For now don't need to initialize anything in tests so let's
|
||||||
* just override the default behaviour.
|
* just override the default behaviour.
|
||||||
*/
|
*/
|
||||||
protected function initialize() {
|
protected function initialize() {
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This renders the content of the block within the wrapper.
|
||||||
|
*
|
||||||
|
* @param \WC_Order $order Order object.
|
||||||
|
* @param string|false $permission If the current user can view the order details or not.
|
||||||
|
* @param array $attributes Block attributes.
|
||||||
|
* @param string $content Original block content.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
|
||||||
|
return parent::render_content( $order, $permission, $attributes, $content );
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection;
|
use Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection;
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\BlockTypes\ProductQuery;
|
use Automattic\WooCommerce\Blocks\BlockTypes\ProductQuery;
|
|
@ -1,16 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
declare( strict_types = 1 );
|
||||||
* CartController Tests.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Tests\Blocks\Helpers\FixtureData;
|
|
||||||
use Automattic\WooCommerce\StoreApi\Utilities\CartController;
|
use Automattic\WooCommerce\StoreApi\Utilities\CartController;
|
||||||
|
use Automattic\WooCommerce\Tests\Blocks\Helpers\FixtureData;
|
||||||
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
|
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit tests for the CartController class.
|
||||||
|
*/
|
||||||
class CartControllerTests extends TestCase {
|
class CartControllerTests extends TestCase {
|
||||||
|
/**
|
||||||
|
* Test cart error code is getting exposed.
|
||||||
|
*/
|
||||||
public function test_get_cart_errors() {
|
public function test_get_cart_errors() {
|
||||||
$class = new CartController();
|
$class = new CartController();
|
||||||
$fixtures = new FixtureData();
|
$fixtures = new FixtureData();
|
||||||
|
@ -25,7 +28,7 @@ class CartControllerTests extends TestCase {
|
||||||
$out_of_stock_product_key = wc()->cart->add_to_cart( $out_of_stock_product->get_id(), 2 );
|
$out_of_stock_product_key = wc()->cart->add_to_cart( $out_of_stock_product->get_id(), 2 );
|
||||||
$out_of_stock_in_cart = wc()->cart->get_cart_item( $out_of_stock_product_key )['data'];
|
$out_of_stock_in_cart = wc()->cart->get_cart_item( $out_of_stock_product_key )['data'];
|
||||||
|
|
||||||
// This product will have exact levels of stock known
|
// This product will have exact levels of stock known.
|
||||||
$partially_out_of_stock_product = $fixtures->get_simple_product(
|
$partially_out_of_stock_product = $fixtures->get_simple_product(
|
||||||
array(
|
array(
|
||||||
'name' => 'Test Product 2',
|
'name' => 'Test Product 2',
|
||||||
|
@ -35,7 +38,7 @@ class CartControllerTests extends TestCase {
|
||||||
$partially_out_of_stock_key = wc()->cart->add_to_cart( $partially_out_of_stock_product->get_id(), 4 );
|
$partially_out_of_stock_key = wc()->cart->add_to_cart( $partially_out_of_stock_product->get_id(), 4 );
|
||||||
$partially_out_of_stock_in_cart = wc()->cart->get_cart_item( $partially_out_of_stock_key )['data'];
|
$partially_out_of_stock_in_cart = wc()->cart->get_cart_item( $partially_out_of_stock_key )['data'];
|
||||||
|
|
||||||
// This product will have exact levels of stock known
|
// This product will have exact levels of stock known.
|
||||||
$too_many_in_cart_product = $fixtures->get_simple_product(
|
$too_many_in_cart_product = $fixtures->get_simple_product(
|
||||||
array(
|
array(
|
||||||
'name' => 'Test Product 3',
|
'name' => 'Test Product 3',
|
||||||
|
@ -50,7 +53,7 @@ class CartControllerTests extends TestCase {
|
||||||
$partially_out_of_stock_in_cart->set_stock_quantity( 2 );
|
$partially_out_of_stock_in_cart->set_stock_quantity( 2 );
|
||||||
$too_many_in_cart_in_cart->set_sold_individually( true );
|
$too_many_in_cart_in_cart->set_sold_individually( true );
|
||||||
|
|
||||||
// This product will not be purchasable
|
// This product will not be purchasable.
|
||||||
$not_purchasable_product = $fixtures->get_simple_product(
|
$not_purchasable_product = $fixtures->get_simple_product(
|
||||||
array(
|
array(
|
||||||
'name' => 'Test Product 4',
|
'name' => 'Test Product 4',
|
||||||
|
@ -59,7 +62,7 @@ class CartControllerTests extends TestCase {
|
||||||
);
|
);
|
||||||
wc()->cart->add_to_cart( $not_purchasable_product->get_id(), 2 );
|
wc()->cart->add_to_cart( $not_purchasable_product->get_id(), 2 );
|
||||||
|
|
||||||
// This function will force the $product->is_purchasable() function to return false for our $not_purchasable_product
|
// This function will force the $product->is_purchasable() function to return false for our $not_purchasable_product.
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_is_purchasable',
|
'woocommerce_is_purchasable',
|
||||||
function ( $is_purchasable, $product ) use ( $not_purchasable_product ) {
|
function ( $is_purchasable, $product ) use ( $not_purchasable_product ) {
|
||||||
|
@ -88,7 +91,5 @@ class CartControllerTests extends TestCase {
|
||||||
foreach ( $expected_errors as $expected_error ) {
|
foreach ( $expected_errors as $expected_error ) {
|
||||||
$this->assertContains( $expected_error, $error_codes );
|
$this->assertContains( $expected_error, $error_codes );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
declare( strict_types = 1 );
|
||||||
* NoticeHandler Tests.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
declare( strict_types = 1 );
|
||||||
* OrderController Tests.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
use Automattic\WooCommerce\StoreApi\Utilities\ProductQueryFilters;
|
use Automattic\WooCommerce\StoreApi\Utilities\ProductQueryFilters;
|
||||||
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
|
|
||||||
use Automattic\WooCommerce\Tests\Blocks\Helpers\FixtureData;
|
use Automattic\WooCommerce\Tests\Blocks\Helpers\FixtureData;
|
||||||
|
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit tests for the ProductQueryFilters class.
|
||||||
|
*/
|
||||||
class ProductQueryFiltersTest extends TestCase {
|
class ProductQueryFiltersTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Setup test product data. Called before every test.
|
* Setup test product data. Called before every test.
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Utilities;
|
namespace Automattic\WooCommerce\Tests\Blocks\StoreApi\Utilities;
|
||||||
|
|
||||||
use Automattic\WooCommerce\StoreApi\Utilities\SanitizationUtils;
|
use Automattic\WooCommerce\StoreApi\Utilities\SanitizationUtils;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\BlockTypes;
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
|
namespace Automattic\WooCommerce\Tests\Blocks\Utils;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\Utils\MiniCartUtils;
|
use Automattic\WooCommerce\Blocks\Utils\MiniCartUtils;
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Blocks\Mocks;
|
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry;
|
|
||||||
|
|
||||||
class AssetDataRegistryMock extends AssetDataRegistry {
|
|
||||||
|
|
||||||
private $debug = true;
|
|
||||||
|
|
||||||
public function execute_lazy_data() {
|
|
||||||
parent::execute_lazy_data();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get() {
|
|
||||||
return parent::get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function set_debug( $debug ) {
|
|
||||||
$this->debug = $debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initialize_core_data() {
|
|
||||||
return parent::initialize_core_data();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function debug() {
|
|
||||||
return $this->debug;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Internal\Admin\ShippingPartnerSuggestions;
|
namespace Automattic\WooCommerce\Tests\Internal\Admin\MarketingRecommendations;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Admin\RemoteSpecs\DataSourcePoller;
|
|
||||||
use Automattic\WooCommerce\Admin\Features\MarketingRecommendations\Init;
|
|
||||||
use Automattic\WooCommerce\Admin\Features\MarketingRecommendations\DefaultMarketingRecommendations;
|
use Automattic\WooCommerce\Admin\Features\MarketingRecommendations\DefaultMarketingRecommendations;
|
||||||
|
use Automattic\WooCommerce\Admin\Features\MarketingRecommendations\Init;
|
||||||
use Automattic\WooCommerce\Admin\Features\MarketingRecommendations\MarketingRecommendationsDataSourcePoller;
|
use Automattic\WooCommerce\Admin\Features\MarketingRecommendations\MarketingRecommendationsDataSourcePoller;
|
||||||
|
use Automattic\WooCommerce\Admin\RemoteSpecs\DataSourcePoller;
|
||||||
use WC_Unit_Test_Case;
|
use WC_Unit_Test_Case;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
|
namespace Automattic\WooCommerce\Tests\Internal\Admin\Orders;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\Admin\Orders\COTRedirectionController;
|
use Automattic\WooCommerce\Internal\Admin\Orders\COTRedirectionController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes our redirection logic covering HPOS admin screens when Custom Order Tables are not authoritative.
|
* Describes our redirection logic covering HPOS admin screens when Custom Order Tables are not authoritative.
|
||||||
*/
|
*/
|
||||||
class COTRedirectionControllerTest extends WC_Unit_Test_Case {
|
class COTRedirectionControllerTest extends \WC_Unit_Test_Case {
|
||||||
/**
|
/**
|
||||||
* @var COTRedirectionController
|
* @var COTRedirectionController
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
declare( strict_types = 1 );
|
||||||
* Tests for BatchProcessingController class.
|
|
||||||
*/
|
namespace Automattic\WooCommerce\Tests\Internal\BatchProcessing;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController;
|
use Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController;
|
||||||
use Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessorInterface;
|
use Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessorInterface;
|
||||||
|
@ -10,7 +10,7 @@ use Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer;
|
||||||
/**
|
/**
|
||||||
* Class BatchProcessingControllerTests.
|
* Class BatchProcessingControllerTests.
|
||||||
*/
|
*/
|
||||||
class BatchProcessingControllerTests extends WC_Unit_Test_Case {
|
class BatchProcessingControllerTests extends \WC_Unit_Test_Case {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of BatchProcessingController.
|
* Instance of BatchProcessingController.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\ComingSoon;
|
namespace Automattic\WooCommerce\Tests\Internal\ComingSoon;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonCacheInvalidator;
|
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonCacheInvalidator;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\ComingSoon;
|
namespace Automattic\WooCommerce\Tests\Internal\ComingSoon;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonHelper;
|
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonHelper;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\ComingSoon;
|
namespace Automattic\WooCommerce\Tests\Internal\ComingSoon;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonRequestHandler;
|
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonRequestHandler;
|
||||||
use Automattic\WooCommerce\Admin\Features\Features;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the coming soon cache invalidator class.
|
* Tests for the coming soon cache invalidator class.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Internal\Orders;
|
namespace Automattic\WooCommerce\Tests\Internal\Orders;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Internal\ProductDownloads;
|
namespace Automattic\WooCommerce\Tests\Internal\ProductDownloads\ApprovedDirectories;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Register;
|
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Register;
|
||||||
|
|
||||||
use WC_Unit_Test_Case;
|
use WC_Unit_Test_Case;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Tests\Internal\ProductDownloads;
|
namespace Automattic\WooCommerce\Tests\Internal\ProductDownloads\ApprovedDirectories;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Synchronize;
|
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Synchronize;
|
||||||
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Register;
|
|
||||||
use Automattic\WooCommerce\Proxies\LegacyProxy;
|
use Automattic\WooCommerce\Proxies\LegacyProxy;
|
||||||
use Automattic\WooCommerce\RestApi\UnitTests\Helpers\ProductHelper;
|
|
||||||
use Automattic\WooCommerce\Testing\Tools\FakeQueue;
|
|
||||||
use WC_Queue_Interface;
|
use WC_Queue_Interface;
|
||||||
use WC_Unit_Test_Case;
|
use WC_Unit_Test_Case;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue