You've already forked wc-composable-product
Add PHPUnit test suite, PSR-4 refactor, lint+test CI jobs (v1.3.1)
- 57 unit tests covering ProductType, StockManager, CartHandler, Plugin, Admin/ProductData, Admin/Settings using Brain Monkey + Mockery - WooCommerce class stubs for testing without WP installation - PHP lint and test jobs in release workflow (test gate blocks release) - PSR-4 namespace change: WC_Composable_Product -> Magdev\WcComposableProduct - PascalCase filenames for all classes under includes/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
33
tests/bootstrap.php
Normal file
33
tests/bootstrap.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit Bootstrap
|
||||
*
|
||||
* Sets up WooCommerce stubs, plugin constants, and the Composer autoloader
|
||||
* for running unit tests without a full WordPress installation.
|
||||
*
|
||||
* @package Magdev\WcComposableProduct\Tests
|
||||
*/
|
||||
|
||||
// Composer autoloader (loads Brain Monkey, Mockery, plugin classes)
|
||||
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
// Define WordPress constants that the plugin expects
|
||||
defined('ABSPATH') || define('ABSPATH', '/tmp/wordpress/');
|
||||
defined('WP_DEBUG') || define('WP_DEBUG', true);
|
||||
defined('DOING_AJAX') || define('DOING_AJAX', false);
|
||||
|
||||
// Define plugin constants
|
||||
defined('WC_COMPOSABLE_PRODUCT_VERSION') || define('WC_COMPOSABLE_PRODUCT_VERSION', '1.3.1');
|
||||
defined('WC_COMPOSABLE_PRODUCT_FILE') || define('WC_COMPOSABLE_PRODUCT_FILE', dirname(__DIR__) . '/wc-composable-product.php');
|
||||
defined('WC_COMPOSABLE_PRODUCT_PATH') || define('WC_COMPOSABLE_PRODUCT_PATH', dirname(__DIR__) . '/');
|
||||
defined('WC_COMPOSABLE_PRODUCT_URL') || define('WC_COMPOSABLE_PRODUCT_URL', 'https://example.com/wp-content/plugins/wc-composable-product/');
|
||||
defined('WC_COMPOSABLE_PRODUCT_BASENAME') || define('WC_COMPOSABLE_PRODUCT_BASENAME', 'wc-composable-product/wc-composable-product.php');
|
||||
|
||||
// Load WooCommerce class stubs (parent before child)
|
||||
require_once __DIR__ . '/stubs/class-wc-data.php';
|
||||
require_once __DIR__ . '/stubs/class-wc-product.php';
|
||||
require_once __DIR__ . '/stubs/class-wc-settings-page.php';
|
||||
require_once __DIR__ . '/stubs/class-wc-order.php';
|
||||
require_once __DIR__ . '/stubs/class-wc-order-item-product.php';
|
||||
require_once __DIR__ . '/stubs/class-wc-cart.php';
|
||||
require_once __DIR__ . '/stubs/class-wc-admin-settings.php';
|
||||
Reference in New Issue
Block a user