You've already forked wc-composable-product
- 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>
36 lines
751 B
PHP
36 lines
751 B
PHP
<?php
|
|
/**
|
|
* Minimal WC_Data stub for unit testing.
|
|
*/
|
|
class WC_Data {
|
|
protected $id = 0;
|
|
protected $data = [];
|
|
protected $meta_data = [];
|
|
|
|
public function __construct($id = 0) {
|
|
if (is_numeric($id) && $id > 0) {
|
|
$this->id = (int) $id;
|
|
}
|
|
}
|
|
|
|
public function get_id() {
|
|
return $this->id;
|
|
}
|
|
|
|
public function set_id($id) {
|
|
$this->id = (int) $id;
|
|
}
|
|
|
|
public function get_meta($key, $single = true, $context = 'view') {
|
|
return $this->meta_data[$key] ?? ($single ? '' : []);
|
|
}
|
|
|
|
public function update_meta_data($key, $value, $meta_id = 0) {
|
|
$this->meta_data[$key] = $value;
|
|
}
|
|
|
|
public function save() {
|
|
return $this->get_id();
|
|
}
|
|
}
|