Merge WooCommerce Admin Unit Tests (#32287)
This folds the unit tests from WooCommerce Admin into the core test suite, enabling them to run.
This commit is contained in:
parent
e12d82ae46
commit
14e852b4b2
|
@ -11,7 +11,7 @@ defaults:
|
|||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||
timeout-minutes: 15
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
strategy:
|
||||
|
|
|
@ -8,7 +8,7 @@ defaults:
|
|||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||
timeout-minutes: 15
|
||||
timeout-minutes: 20
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
strategy:
|
||||
|
|
|
@ -5,7 +5,7 @@ if [[ ${RUN_PHPCS} == 1 ]] || [[ ${RUN_E2E} == 1 ]]; then
|
|||
fi
|
||||
|
||||
if [[ ${RUN_CODE_COVERAGE} == 1 ]]; then
|
||||
phpdbg -qrr ./vendor/bin/phpunit -d memory_limit=-1 -c phpunit.xml --coverage-clover=coverage.clover --exclude-group=timeout $@
|
||||
phpdbg -qrr ./vendor/bin/phpunit -d memory_limit=-1 -c phpunit.xml --coverage-clover=coverage.clover --exclude-group=timeout --exclude-group=run-in-seprate-process $@
|
||||
else
|
||||
vendor/bin/phpunit -c phpunit.xml $@
|
||||
fi
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
*/
|
||||
|
||||
use Automattic\WooCommerce\Proxies\LegacyProxy;
|
||||
use Automattic\WooCommerce\Internal\Admin\FeaturePlugin;
|
||||
use Automattic\WooCommerce\Testing\Tools\CodeHacking\CodeHacker;
|
||||
use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\StaticMockerHack;
|
||||
use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\FunctionsMockerHack;
|
||||
use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\BypassFinalsHack;
|
||||
use Automattic\WooCommerce\Testing\Tools\DependencyManagement\MockableLegacyProxy;
|
||||
|
||||
\PHPUnit\Framework\Error\Deprecated::$enabled = false;
|
||||
/**
|
||||
* Class WC_Unit_Tests_Bootstrap
|
||||
*/
|
||||
|
@ -46,6 +47,9 @@ class WC_Unit_Tests_Bootstrap {
|
|||
ini_set( 'display_errors', 'on' ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted
|
||||
error_reporting( E_ALL ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting, WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting
|
||||
|
||||
// Ensure theme install tests use direct filesystem method.
|
||||
define( 'FS_METHOD', 'direct' );
|
||||
|
||||
// Ensure server variable is set for WP email functions.
|
||||
// phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected
|
||||
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
|
||||
|
@ -67,6 +71,9 @@ class WC_Unit_Tests_Bootstrap {
|
|||
// install WC.
|
||||
tests_add_filter( 'setup_theme', array( $this, 'install_wc' ) );
|
||||
|
||||
// Set up WC-Admin config.
|
||||
tests_add_filter( 'woocommerce_admin_get_feature_config', array( $this, 'add_development_features' ) );
|
||||
|
||||
/*
|
||||
* Load PHPUnit Polyfills for the WP testing suite.
|
||||
* @see https://github.com/WordPress/wordpress-develop/pull/1563/
|
||||
|
@ -168,7 +175,12 @@ class WC_Unit_Tests_Bootstrap {
|
|||
public function load_wc() {
|
||||
define( 'WC_TAX_ROUNDING_MODE', 'auto' );
|
||||
define( 'WC_USE_TRANSACTIONS', false );
|
||||
update_option( 'woocommerce_enable_coupons', 'yes' );
|
||||
update_option( 'woocommerce_calc_taxes', 'yes' );
|
||||
update_option( 'woocommerce_onboarding_opt_in', 'yes' );
|
||||
|
||||
require_once $this->plugin_dir . '/woocommerce.php';
|
||||
FeaturePlugin::instance()->init();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,7 +189,6 @@ class WC_Unit_Tests_Bootstrap {
|
|||
* @since 2.2
|
||||
*/
|
||||
public function install_wc() {
|
||||
|
||||
// Clean existing install first.
|
||||
define( 'WP_UNINSTALL_PLUGIN', true );
|
||||
define( 'WC_REMOVE_ALL_DATA', true );
|
||||
|
@ -206,13 +217,13 @@ class WC_Unit_Tests_Bootstrap {
|
|||
* @since 2.2
|
||||
*/
|
||||
public function includes() {
|
||||
|
||||
// framework.
|
||||
require_once $this->tests_dir . '/framework/class-wc-unit-test-factory.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-session-handler.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-wc-data.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-wc-object-query.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-payment-gateway.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-mock-enhanced-payment-gateway.php';
|
||||
require_once $this->tests_dir . '/framework/class-wc-payment-token-stub.php';
|
||||
require_once $this->tests_dir . '/framework/vendor/class-wp-test-spy-rest-server.php';
|
||||
|
||||
|
@ -232,11 +243,29 @@ class WC_Unit_Tests_Bootstrap {
|
|||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-shipping-zones.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-payment-token.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-settings.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-reports.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-admin-notes.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-test-action-queue.php';
|
||||
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-queue.php';
|
||||
|
||||
// Traits.
|
||||
require_once $this->tests_dir . '/framework/traits/trait-wc-rest-api-complex-meta.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the `development` features for testing.
|
||||
*
|
||||
* @param array $flags Existing feature flags.
|
||||
* @return array Filtered feature flags.
|
||||
*/
|
||||
public function add_development_features( $flags ) {
|
||||
$config = json_decode( file_get_contents( $this->plugin_dir . '/../woocommerce-admin/config/development.json' ) ); // @codingStandardsIgnoreLine.
|
||||
foreach ( $config->features as $feature => $bool ) {
|
||||
$flags[ $feature ] = $bool;
|
||||
}
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the single class instance.
|
||||
*
|
||||
|
|
|
@ -11,9 +11,9 @@ use Automattic\WooCommerce\Internal\Admin\Schedulers\OrdersScheduler;
|
|||
use \Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore as OrdersStatsDataStore;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Init
|
||||
* Class WC_Admin_Tests_API_Init
|
||||
*/
|
||||
class WC_Tests_API_Init extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Init extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Set up.
|
||||
*/
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Notes\Note;
|
|||
use Automattic\WooCommerce\Admin\Notes\Notes;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Admin_Notes
|
||||
* Class WC_Admin_Tests_API_Admin_Notes
|
||||
*/
|
||||
class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* WC Tests API Data
|
||||
*/
|
||||
class WC_Tests_API_Data extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Data extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -10,7 +10,7 @@ use \Automattic\WooCommerce\Admin\API\Experiments;
|
|||
/**
|
||||
* WC Tests API Options
|
||||
*/
|
||||
class WC_Tests_API_Experiments extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Experiments extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* WC Tests API Leaderboards
|
||||
*/
|
||||
class WC_Tests_API_Leaderboards extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Leaderboards extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Endpoints.
|
||||
*
|
|
@ -11,7 +11,7 @@ use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProducts;
|
|||
/**
|
||||
* WC Tests API Onboarding Product Types
|
||||
*/
|
||||
class WC_Tests_API_Onboarding_Product_Types extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Onboarding_Product_Types extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -13,7 +13,7 @@ use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile as Profil
|
|||
/**
|
||||
* WC Tests API Onboarding Profile
|
||||
*/
|
||||
class WC_Tests_API_Onboarding_Profiles extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Onboarding_Profiles extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -11,10 +11,17 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
|||
|
||||
require_once __DIR__ . '/../features/onboarding-tasks/test-task.php';
|
||||
|
||||
// Wrokaround to suppress exif_read_data errors from
|
||||
// https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/image.php#L835
|
||||
define('WP_RUN_CORE_TESTS', false);
|
||||
|
||||
/**
|
||||
* WC Tests API Onboarding Tasks
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
* @group run-in-seprate-process
|
||||
*/
|
||||
class WC_Tests_API_Onboarding_Tasks extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Onboarding_Tasks extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
||||
|
@ -55,6 +62,8 @@ class WC_Tests_API_Onboarding_Tasks extends WC_REST_Unit_Test_Case {
|
|||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
$this->remove_color_or_logo_attribute_taxonomy();
|
||||
TaskLists::clear_lists();
|
||||
TaskLists::init_default_lists();
|
||||
}
|
||||
|
||||
/**
|
|
@ -11,7 +11,7 @@ use \Automattic\WooCommerce\Internal\Admin\Onboarding;
|
|||
/**
|
||||
* WC Tests API Onboarding Themes
|
||||
*/
|
||||
class WC_Tests_API_Onboarding_Themes extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Onboarding_Themes extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -10,7 +10,7 @@ use \Automattic\WooCommerce\Admin\API\Options;
|
|||
/**
|
||||
* WC Tests API Options
|
||||
*/
|
||||
class WC_Tests_API_Options extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Options extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -11,7 +11,7 @@ use Automattic\WooCommerce\Admin\API\Reports\Controller as ReportsController;
|
|||
/**
|
||||
* WC Tests API Orders
|
||||
*/
|
||||
class WC_Tests_API_Orders extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Orders extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -10,7 +10,7 @@ use \Automattic\WooCommerce\Admin\API\Plugins;
|
|||
/**
|
||||
* WC Tests API Plugins
|
||||
*/
|
||||
class WC_Tests_API_Plugins extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Plugins extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Product_Attributes
|
||||
* Class WC_Admin_Tests_API_Product_Attributes
|
||||
*/
|
||||
class WC_Tests_API_Product_Attributes extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Product_Attributes extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* WC Tests API Product Reviews
|
||||
*/
|
||||
class WC_Tests_API_Product_Reviews extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Product_Reviews extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* WC Tests API ProductsLowInStock
|
||||
*/
|
||||
class WC_Tests_API_ProductsLowInStock extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_ProductsLowInStock extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,8 +7,11 @@
|
|||
|
||||
/**
|
||||
* WC Tests API Products
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
* @group run-in-seprate-process
|
||||
*/
|
||||
class WC_Tests_API_Products extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Products extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
||||
|
@ -61,39 +64,4 @@ class WC_Tests_API_Products extends WC_REST_Unit_Test_Case {
|
|||
|
||||
$product->delete( true );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test low stock query.
|
||||
*/
|
||||
public function test_low_stock() {
|
||||
wp_set_current_user( $this->user );
|
||||
|
||||
// Create a product with stock management.
|
||||
$product = WC_Helper_Product::create_simple_product();
|
||||
$product->set_manage_stock( true );
|
||||
$product->set_low_stock_amount( 2 );
|
||||
$product->set_stock_quantity( 5 );
|
||||
$product->save();
|
||||
|
||||
// Order enough of the product to trigger low stock status.
|
||||
$order_time = '2020-11-24T10:00:00';
|
||||
$order = WC_Helper_Order::create_order( 1, $product );
|
||||
$order->set_status( 'completed' );
|
||||
$order->set_date_created( $order_time );
|
||||
$order->save();
|
||||
|
||||
// Sync analytics data (used for last order date).
|
||||
WC_Helper_Queue::run_all_pending();
|
||||
|
||||
$request = new WP_REST_Request( 'GET', '/wc-analytics/products' );
|
||||
$request->set_param( 'low_in_stock', true );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
|
||||
$this->assertEquals( 200, $response->get_status() );
|
||||
$this->assertCount( 1, $data );
|
||||
$this->assertEquals( $product->get_id(), $data[0]['id'] );
|
||||
$this->assertEquals( $order_time, $data[0]['last_order_date'] );
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@
|
|||
* @package WooCommerce\Admin\Tests\API
|
||||
* @since 3.6.4
|
||||
*/
|
||||
class WC_Tests_API_Report_Controllers extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Report_Controllers extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Setup test admin notes data. Called before every test.
|
||||
*
|
|
@ -9,9 +9,9 @@
|
|||
use Automattic\WooCommerce\Internal\Admin\CategoryLookup;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Categories
|
||||
* Class WC_Admin_Tests_API_Reports_Categories
|
||||
*/
|
||||
class WC_Tests_API_Reports_Categories extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Categories extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Coupons_Stats
|
||||
* Class WC_Admin_Tests_API_Reports_Coupons_Stats
|
||||
*/
|
||||
class WC_Tests_API_Reports_Coupons_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Coupons_Stats extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Coupons
|
||||
* Class WC_Admin_Tests_API_Reports_Coupons
|
||||
*/
|
||||
class WC_Tests_API_Reports_Coupons extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Coupons extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -8,11 +8,13 @@
|
|||
|
||||
/**
|
||||
* Reports Customers Stats REST API Test Class
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
* @group run-in-seprate-process
|
||||
* @package WooCommerce\Admin\Tests\API
|
||||
* @since 3.5.0
|
||||
*/
|
||||
class WC_Tests_API_Reports_Customers_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Customers_Stats extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Endpoint.
|
||||
*
|
|
@ -10,11 +10,13 @@ use \Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore as CustomersDa
|
|||
|
||||
/**
|
||||
* Reports Customers REST API Test Class
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
* @group run-in-seprate-process
|
||||
* @package WooCommerce\Admin\Tests\API
|
||||
* @since 3.5.0
|
||||
*/
|
||||
class WC_Tests_API_Reports_Customers extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Customers extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Endpoint.
|
||||
*
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* WC_Tests_API_Reports_Downloads_Stats
|
||||
* WC_Admin_Tests_API_Reports_Downloads_Stats
|
||||
*/
|
||||
class WC_Tests_API_Reports_Downloads_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Downloads_Stats extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* WC_Tests_API_Reports_Downloads
|
||||
* WC_Admin_Tests_API_Reports_Downloads
|
||||
*/
|
||||
class WC_Tests_API_Reports_Downloads extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Downloads extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Export
|
||||
* Class WC_Admin_Tests_API_Reports_Export
|
||||
*/
|
||||
class WC_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Export route.
|
||||
*
|
||||
|
@ -67,6 +67,7 @@ class WC_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case {
|
|||
*/
|
||||
public function test_taxes_report_export() {
|
||||
global $wpdb;
|
||||
add_filter( 'wc_tax_enabled', '__return_true' );
|
||||
wp_set_current_user( $this->user );
|
||||
WC_Helper_Reports::reset_stats_dbs();
|
||||
|
||||
|
@ -152,5 +153,6 @@ class WC_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case {
|
|||
$this->assertEquals( 100, $status['percent_complete'] );
|
||||
$this->assertStringMatchesFormat( '%s/wp-admin/?action=woocommerce_admin_download_report_csv&filename=wc-taxes-report-export-%d', $status['download_url'] );
|
||||
$this->assertStringMatchesFormat( '%s/wc-analytics/reports/taxes/export/%d/status', $status['_links']['self'][0]['href'] );
|
||||
remove_filter( 'wc_tax_enabled', '__return_true' );
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ use Automattic\WooCommerce\Admin\ReportsSync;
|
|||
*
|
||||
* @package WooCommerce\Admin\Tests\API
|
||||
*/
|
||||
class WC_Tests_API_Reports_Import extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Import extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Endpoint.
|
||||
*
|
|
@ -9,9 +9,9 @@
|
|||
use \Automattic\WooCommerce\Admin\API\Reports\TimeInterval;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Reports_Interval_Stats
|
||||
* Class WC_Admin_Tests_Reports_Interval_Stats
|
||||
*/
|
||||
class WC_Tests_Reports_Interval_Stats extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Reports_Interval_Stats extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Local timezone used throughout the tests.
|
|
@ -6,13 +6,13 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* WC_Tests_API_Reports_Orders_Stats
|
||||
* WC_Admin_Tests_API_Reports_Orders_Stats
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Orders_Stats
|
||||
* Class WC_Admin_Tests_API_Reports_Orders_Stats
|
||||
*/
|
||||
class WC_Tests_API_Reports_Orders_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Orders_Stats extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -14,7 +14,7 @@ use \Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore as CustomersDa
|
|||
* @package WooCommerce\Admin\Tests\API
|
||||
* @since 3.5.0
|
||||
*/
|
||||
class WC_Tests_API_Reports_Orders extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Orders extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* WC_Tests_API_Reports_Performance_Indicators
|
||||
* WC_Admin_Tests_API_Reports_Performance_Indicators
|
||||
*/
|
||||
class WC_Tests_API_Reports_Performance_Indicators extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Performance_Indicators extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Products_Stats
|
||||
* Class WC_Admin_Tests_API_Reports_Products_Stats
|
||||
*/
|
||||
class WC_Tests_API_Reports_Products_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Products_Stats extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -12,7 +12,7 @@
|
|||
* @package WooCommerce\Admin\Tests\API
|
||||
* @since 3.5.0
|
||||
*/
|
||||
class WC_Tests_API_Reports_Products extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Products extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Revenue_Stats
|
||||
* Class WC_Admin_Tests_API_Reports_Revenue_Stats
|
||||
*/
|
||||
class WC_Tests_API_Reports_Revenue_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Revenue_Stats extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Stock_Stats
|
||||
* Class WC_Admin_Tests_API_Reports_Stock_Stats
|
||||
*/
|
||||
class WC_Tests_API_Reports_Stock_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Stock_Stats extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Stock
|
||||
* Class WC_Admin_Tests_API_Reports_Stock
|
||||
*/
|
||||
class WC_Tests_API_Reports_Stock extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Stock extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* WC_Tests_API_Reports_Taxes_Stats
|
||||
* WC_Admin_Tests_API_Reports_Taxes_Stats
|
||||
*/
|
||||
class WC_Tests_API_Reports_Taxes_Stats extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Taxes_Stats extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* WC_Tests_API_Reports_Taxes
|
||||
* WC_Admin_Tests_API_Reports_Taxes
|
||||
*/
|
||||
class WC_Tests_API_Reports_Taxes extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Taxes extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_API_Reports_Variations
|
||||
* Class WC_Admin_Tests_API_Reports_Variations
|
||||
*/
|
||||
class WC_Tests_API_Reports_Variations extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Reports_Variations extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* WC Tests API Themes
|
||||
*/
|
||||
class WC_Tests_API_Themes extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Themes extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* WC Tests API Variations
|
||||
*/
|
||||
class WC_Tests_API_Variations extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_API_Variations extends WC_REST_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Endpoints.
|
|
@ -15,7 +15,7 @@ use Automattic\WooCommerce\Internal\Admin\Schedulers\OrdersScheduler;
|
|||
* @package WooCommerce\Admin\Tests\Reports
|
||||
* @since 3.5.0
|
||||
*/
|
||||
class WC_Tests_Reports_Regenerate_Batching extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Reports_Regenerate_Batching extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Queue batch size.
|
||||
*
|
|
@ -7,7 +7,7 @@ use Automattic\WooCommerce\Admin\Notes\Note;
|
|||
*
|
||||
* @package WooCommerce\Admin\Tests\DBUpdates
|
||||
*/
|
||||
class WC_Tests_Update_Is_Read_From_Last_Read extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Update_Is_Read_From_Last_Read extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* @var object current user
|
||||
*/
|
|
@ -8,24 +8,45 @@
|
|||
use Automattic\WooCommerce\Internal\Admin\CustomerEffortScoreTracks;
|
||||
|
||||
// CustomerEffortScoreTracks only works in wp-admin, so let's fake it.
|
||||
define( 'WP_ADMIN', true );
|
||||
class CurrentScreenMock {
|
||||
public function in_admin() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WC_Tests_CES_Tracks
|
||||
* Class WC_Admin_Tests_CES_Tracks
|
||||
*/
|
||||
class WC_Tests_CES_Tracks extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_CES_Tracks extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* @var CustomerEffortScoreTracks
|
||||
*/
|
||||
private $ces;
|
||||
|
||||
/**
|
||||
* @var object Backup object of $GLOBALS['current_screen'];
|
||||
*/
|
||||
private $current_screen_backup;
|
||||
|
||||
/**
|
||||
* Overridden setUp method from PHPUnit
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
update_option( 'woocommerce_allow_tracking', 'yes' );
|
||||
if ( isset( $GLOBALS['current_screen'] ) ) {
|
||||
$this->current_screen_backup = $GLOBALS['current_screen'];
|
||||
}
|
||||
$GLOBALS['current_screen'] = new CurrentScreenMock();
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
if ( $this->current_screen_backup ) {
|
||||
$GLOBALS['current_screen'] = $this->current_screen_backup;
|
||||
}
|
||||
update_option( 'woocommerce_allow_tracking', 'no' );
|
||||
}
|
||||
|
||||
/**
|
|
@ -8,9 +8,9 @@
|
|||
use \Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingThemes;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Onboarding
|
||||
* Class WC_Admin_Tests_Onboarding
|
||||
*/
|
||||
class WC_Tests_Onboarding extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Onboarding extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Verifies that given an array of theme objects, the object containing Storefront will be sorted to the first position.
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Internal\Admin\ShippingLabelBannerDisplayRules;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Shipping_Label_Banner_Display_Rules
|
||||
* Class WC_Admin_Tests_Shipping_Label_Banner_Display_Rules
|
||||
*/
|
||||
class WC_Tests_Shipping_Label_Banner_Display_Rules extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Shipping_Label_Banner_Display_Rules extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Jetpack version to test the display manager.
|
|
@ -8,9 +8,9 @@
|
|||
use \Automattic\WooCommerce\Admin\Features\TransientNotices;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Transient_Notices
|
||||
* Class WC_Admin_Tests_Transient_Notices
|
||||
*/
|
||||
class WC_Tests_Transient_Notices extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Transient_Notices extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Test that notices can be added.
|
|
@ -10,9 +10,9 @@ require_once __DIR__ . '/test-task.php';
|
|||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList;
|
||||
|
||||
/**
|
||||
* class WC_Tests_OnboardingTasks_TaskList
|
||||
* class WC_Admin_Tests_OnboardingTasks_TaskList
|
||||
*/
|
||||
class WC_Tests_OnboardingTasks_TaskList extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_OnboardingTasks_TaskList extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Task list.
|
|
@ -11,9 +11,9 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
|||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList;
|
||||
|
||||
/**
|
||||
* class WC_Tests_OnboardingTasks_Task
|
||||
* class WC_Admin_Tests_OnboardingTasks_Task
|
||||
*/
|
||||
class WC_Tests_OnboardingTasks_Task extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_OnboardingTasks_Task extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Tests that a task is visible by default.
|
|
@ -11,9 +11,9 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList;
|
|||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\Purchase;
|
||||
|
||||
/**
|
||||
* class WC_Tests_OnboardingTasks_TaskList
|
||||
* class WC_Admin_Tests_OnboardingTasks_TaskList
|
||||
*/
|
||||
class WC_Tests_OnboardingTasks_Task_Purchase extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_OnboardingTasks_Task_Purchase extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Task list.
|
|
@ -10,9 +10,9 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList;
|
|||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\StoreDetails;
|
||||
|
||||
/**
|
||||
* class WC_Tests_OnboardingTasks_TaskList
|
||||
* class WC_Admin_Tests_OnboardingTasks_TaskList
|
||||
*/
|
||||
class WC_Tests_OnboardingTasks_Task_StoreDetails extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_OnboardingTasks_Task_StoreDetails extends WC_Unit_Test_Case {
|
||||
|
||||
|
||||
/**
|
|
@ -10,9 +10,9 @@ use Automattic\WooCommerce\Admin\DataSourcePoller;
|
|||
use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\PaymentGatewaySuggestionsDataSourcePoller;
|
||||
|
||||
/**
|
||||
* class WC_Tests_PaymentGatewaySuggestions_DataSourcePoller
|
||||
* class WC_Admin_Tests_PaymentGatewaySuggestions_DataSourcePoller
|
||||
*/
|
||||
class WC_Tests_PaymentGatewaySuggestions_DataSourcePoller extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_PaymentGatewaySuggestions_DataSourcePoller extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Set up.
|
||||
*/
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\EvaluateSuggestion;
|
||||
|
||||
/**
|
||||
* class WC_Tests_PaymentGatewaySuggestions_EvaluateSuggestion
|
||||
* class WC_Admin_Tests_PaymentGatewaySuggestions_EvaluateSuggestion
|
||||
*/
|
||||
class WC_Tests_PaymentGatewaySuggestions_EvaluateSuggestion extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_PaymentGatewaySuggestions_EvaluateSuggestion extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Mock gateway option.
|
||||
*/
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\Features\RemotePaymentMethods\PaymentGatewaysController;
|
||||
|
||||
/**
|
||||
* class WC_Tests_PaymentGatewaySuggestions_PaymentGatewaysController
|
||||
* class WC_Admin_Tests_PaymentGatewaySuggestions_PaymentGatewaysController
|
||||
*/
|
||||
class WC_Tests_PaymentGatewaySuggestions_PaymentGatewaysController extends WC_REST_Unit_Test_Case {
|
||||
class WC_Admin_Tests_PaymentGatewaySuggestions_PaymentGatewaysController extends WC_REST_Unit_Test_Case {
|
||||
/**
|
||||
* Endpoints.
|
||||
*
|
|
@ -11,9 +11,9 @@ use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\DefaultPayme
|
|||
use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\PaymentGatewaySuggestionsDataSourcePoller;
|
||||
|
||||
/**
|
||||
* class WC_Tests_PaymentGatewaySuggestions_Init
|
||||
* class WC_Admin_Tests_PaymentGatewaySuggestions_Init
|
||||
*/
|
||||
class WC_Tests_PaymentGatewaySuggestions_Init extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_PaymentGatewaySuggestions_Init extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Set up.
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Features\Navigation\Favorites;
|
|||
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Navigation_Favorites
|
||||
* Class WC_Admin_Tests_Navigation_Favorites
|
||||
*/
|
||||
class WC_Tests_Navigation_Favorites extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Navigation_Favorites extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* @var Favorites
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Features\Navigation\Menu;
|
|||
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Navigation_Menu
|
||||
* Class WC_Admin_Tests_Navigation_Menu
|
||||
*/
|
||||
class WC_Tests_Navigation_Menu extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Navigation_Menu extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* @var Menu
|
|
@ -13,9 +13,12 @@ use Automattic\WooCommerce\Admin\Features\Navigation\Screen;
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Navigation_Screen
|
||||
* Class WC_Admin_Tests_Navigation_Screen
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
* @group run-in-seprate-process
|
||||
*/
|
||||
class WC_Tests_Navigation_Screen extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Navigation_Screen extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* @var Screen
|
|
@ -8,9 +8,9 @@
|
|||
use \Automattic\WooCommerce\Admin\Notes\Note;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Note
|
||||
* Class WC_Admin_Tests_Note
|
||||
*/
|
||||
class WC_Tests_Note extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Note extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Tests nonce data is added to the action.
|
|
@ -10,9 +10,9 @@ use \Automattic\WooCommerce\Admin\Notes\Note;
|
|||
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Marketing_Notes
|
||||
* Class WC_Admin_Tests_Marketing_Notes
|
||||
*/
|
||||
class WC_Tests_Customizing_Product_Catalog extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Customizing_Product_Catalog extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* @var CustomizingProductCatalog
|
|
@ -11,9 +11,9 @@ use \Automattic\WooCommerce\Admin\Notes\Notes;
|
|||
use \Automattic\WooCommerce\Internal\Admin\Notes\EmailNotification;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Email_Notes
|
||||
* Class WC_Admin_Tests_Email_Notes
|
||||
*/
|
||||
class WC_Tests_Email_Notes extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Email_Notes extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Setup test admin notes data. Called before every test.
|
|
@ -10,9 +10,9 @@ use \Automattic\WooCommerce\Admin\Notes\Note;
|
|||
use \Automattic\WooCommerce\Internal\Admin\Notes\WooCommercePayments;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Marketing_Notes
|
||||
* Class WC_Admin_Tests_Marketing_Notes
|
||||
*/
|
||||
class WC_Tests_Marketing_Notes extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Marketing_Notes extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Tests that a marketing note can be added.
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Notes\Notes;
|
|||
use Automattic\WooCommerce\Internal\Admin\Notes\NewSalesRecord;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_NewSalesRecord_Note
|
||||
* Class WC_Admin_Tests_NewSalesRecord_Note
|
||||
*/
|
||||
class WC_Tests_NewSalesRecord_Note extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_NewSalesRecord_Note extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* @var string
|
|
@ -10,9 +10,9 @@ use Automattic\WooCommerce\Admin\Notes\Note;
|
|||
use Automattic\WooCommerce\Admin\Notes\NoteTraits;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_NoteTraits
|
||||
* Class WC_Admin_Tests_NoteTraits
|
||||
*/
|
||||
class WC_Tests_NoteTraits extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_NoteTraits extends WC_Unit_Test_Case {
|
||||
|
||||
/** Host the traits class we are testing */
|
||||
use NoteTraits;
|
|
@ -9,9 +9,9 @@ use \Automattic\WooCommerce\Admin\Notes\Notes;
|
|||
use \Automattic\WooCommerce\Admin\Notes\Note;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Notes_Data_Store
|
||||
* Class WC_Admin_Tests_Notes_Data_Store
|
||||
*/
|
||||
class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Tests that the read data store method works as expected.
|
|
@ -8,9 +8,9 @@
|
|||
use \Automattic\WooCommerce\Admin\Notes\Note;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Notes_Note
|
||||
* Class WC_Admin_Tests_Notes_Note
|
||||
*/
|
||||
class WC_Tests_Notes_Note extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Notes_Note extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Tests a note can be created with timestamp.
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Notes\NotesUnavailableException;
|
|||
use Automattic\WooCommerce\Admin\Notes\Notes;
|
||||
|
||||
/**
|
||||
* Class WC_Tests_Notes
|
||||
* Class WC_Admin_Tests_Notes
|
||||
*/
|
||||
class WC_Tests_Notes extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_Notes extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* If the "admin-note" data store exists, the data store should be
|
|
@ -18,11 +18,11 @@ class WC_Admin_Tests_Plugin_Version extends WP_UnitTestCase {
|
|||
*/
|
||||
public function test_version_numbers() {
|
||||
// Get package.json version.
|
||||
$package_json = file_get_contents( 'package.json' );
|
||||
$package_json = file_get_contents( '../woocommerce-admin/package.json' );
|
||||
$package = json_decode( $package_json );
|
||||
|
||||
// Get main plugin file header version.
|
||||
$plugin = get_file_data( 'woocommerce-admin.php', array( 'Version' => 'Version' ) );
|
||||
$plugin = get_file_data( '../woocommerce-admin/woocommerce-admin.php', array( 'Version' => 'Version' ) );
|
||||
|
||||
// Get plugin DB version.
|
||||
$db_version = defined( 'WC_ADMIN_VERSION_NUMBER' ) ? constant( 'WC_ADMIN_VERSION_NUMBER' ) : false;
|
|
@ -33,8 +33,6 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase {
|
|||
public function test_get_plugin_path_from_slug() {
|
||||
|
||||
// Installed plugin checks.
|
||||
$wc_path = PluginsHelper::get_plugin_path_from_slug( 'woocommerce' );
|
||||
$this->assertEquals( 'woocommerce/woocommerce.php', $wc_path, 'Path returned is not as expected.' );
|
||||
$ak_path = PluginsHelper::get_plugin_path_from_slug( 'akismet' );
|
||||
$this->assertEquals( 'akismet/akismet.php', $ak_path, 'Path returned is not as expected.' );
|
||||
|
||||
|
@ -59,16 +57,16 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase {
|
|||
$this->assertEquals( array(), $active_slugs, 'Should not be any active slugs.' );
|
||||
|
||||
// Get facebook plugin path.
|
||||
$fb_path = PluginsHelper::get_plugin_path_from_slug( 'facebook-for-woocommerce' );
|
||||
$akismet_path = PluginsHelper::get_plugin_path_from_slug( 'akismet' );
|
||||
|
||||
// Activate facebook plugin.
|
||||
activate_plugin( $fb_path );
|
||||
activate_plugin( $akismet_path );
|
||||
|
||||
// Get active slugs.
|
||||
$active_slugs = PluginsHelper::get_active_plugin_slugs();
|
||||
|
||||
// Phpunit test environment active plugins option is empty.
|
||||
$this->assertEquals( array( 'facebook-for-woocommerce' ), $active_slugs, 'Facebook for WooCommerce should be listed as active.' );
|
||||
$this->assertEquals( array( 'akismet' ), $active_slugs, 'Akismet should be listed as active.' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,9 +74,9 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase {
|
|||
*/
|
||||
public function test_is_plugin_installed() {
|
||||
|
||||
// WooCommerce is installed in the test environment.
|
||||
$installed = PluginsHelper::is_plugin_installed( 'woocommerce' );
|
||||
$this->assertEquals( true, $installed, 'WooCommerce should be installed.' );
|
||||
// Akismet is installed in the test environment.
|
||||
$installed = PluginsHelper::is_plugin_installed( 'akismet' );
|
||||
$this->assertEquals( true, $installed, 'Akismet should be installed.' );
|
||||
|
||||
// Invalid plugin is not.
|
||||
$installed = PluginsHelper::is_plugin_installed( 'invalid-plugin' );
|
||||
|
@ -91,18 +89,18 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase {
|
|||
public function test_is_plugin_active() {
|
||||
|
||||
// Check if facebook is not active. Phpunit test environment active plugins option is empty.
|
||||
$active = PluginsHelper::is_plugin_active( 'facebook-for-woocommerce' );
|
||||
$active = PluginsHelper::is_plugin_active( 'akismet' );
|
||||
$this->assertEquals( false, $active, 'Should not be any active slugs.' );
|
||||
|
||||
// Get facebook plugin path.
|
||||
$fb_path = PluginsHelper::get_plugin_path_from_slug( 'facebook-for-woocommerce' );
|
||||
// Get Akismet plugin path.
|
||||
$akismet_path = PluginsHelper::get_plugin_path_from_slug( 'akismet' );
|
||||
|
||||
// Activate facebook plugin.
|
||||
activate_plugin( $fb_path );
|
||||
// Activate akismet plugin.
|
||||
activate_plugin( $akismet_path );
|
||||
|
||||
// Check if facebook is now active.
|
||||
$activated = PluginsHelper::is_plugin_active( 'facebook-for-woocommerce' );
|
||||
$this->assertEquals( true, $activated, 'Facebook for WooCommerce should be installed.' );
|
||||
// Check if akismet is now active.
|
||||
$activated = PluginsHelper::is_plugin_active( 'akismet' );
|
||||
$this->assertEquals( true, $activated, 'Akismet for WooCommerce should be installed.' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +108,7 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase {
|
|||
*/
|
||||
public function test_get_plugin_data() {
|
||||
|
||||
$actual_data = PluginsHelper::get_plugin_data( 'woocommerce' );
|
||||
$actual_data = PluginsHelper::get_plugin_data( 'akismet' );
|
||||
|
||||
$expected_keys = array(
|
||||
'WC requires at least',
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayColu
|
|||
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_Transformers_ArrayColumn
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayColumn
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_Transformers_ArrayColumn extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayColumn extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Test validate method returns false when 'key' argument is missing
|
||||
*/
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayFlatten;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_Transformers_ArrayKeys
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayKeys
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_Transformers_ArrayFlatten extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayFlatten extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Test it returns flatten array
|
||||
*/
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayKeys;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_Transformers_ArrayKeys
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayKeys
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_Transformers_ArrayKeys extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayKeys extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Test it returns array values.
|
||||
*/
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArraySearch;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_Transformers_ArraySearch
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArraySearch
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_Transformers_ArraySearch extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArraySearch extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Test validate method returns false when 'value' argument is missing
|
||||
*/
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayValues;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_Transformers_ArrayValues
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayValues
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_Transformers_ArrayValues extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayValues extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Test it returns array values.
|
||||
*/
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\Count;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_Transformers_ArrayValues
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayValues
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_Transformers_ArrayCount extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayCount extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Test it returns array count.
|
||||
*/
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\DotNotati
|
|||
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_Transformers_DotNotation
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_Transformers_DotNotation
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_Transformers_DotNotation extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_Transformers_DotNotation extends WC_Unit_Test_Case {
|
||||
|
||||
/**
|
||||
* Test validate method returns false when 'path' argument is missing
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\EvaluateAndGetStatus;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_EvaluateAndGetStatus
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_EvaluateAndGetStatus
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_EvaluateAndGetStatus extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_EvaluateAndGetStatus extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Build up a spec given the supplied parameters.
|
||||
*
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\GetRuleProcessor;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_GetRuleProcessor
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_GetRuleProcessor
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_GetRuleProcessor extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_GetRuleProcessor extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Tests that an unknown rule processor returns a FailRuleProcessor
|
||||
*
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\NotRuleProcessor;
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\RuleEvaluator;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_NotRuleProcessor
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_NotRuleProcessor
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_NotRuleProcessor extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_NotRuleProcessor extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* An empty operand evaluates to false, so negating that should
|
||||
* evaluate to true.
|
|
@ -8,9 +8,9 @@
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\OptionRuleProcessor;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_OptionRuleProcessor
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_OptionRuleProcessor
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_OptionRuleProcessor extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_OptionRuleProcessor extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* No default option resolves to false.
|
||||
*
|
|
@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\OrRuleProcessor;
|
|||
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\RuleEvaluator;
|
||||
|
||||
/**
|
||||
* class WC_Tests_RemoteInboxNotifications_OrRuleProcessor
|
||||
* class WC_Admin_Tests_RemoteInboxNotifications_OrRuleProcessor
|
||||
*/
|
||||
class WC_Tests_RemoteInboxNotifications_OrRuleProcessor extends WC_Unit_Test_Case {
|
||||
class WC_Admin_Tests_RemoteInboxNotifications_OrRuleProcessor extends WC_Unit_Test_Case {
|
||||
/**
|
||||
* Both operands evaluating to false and ORed together evaluates to false.
|
||||
*
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue