2019-03-13 12:31:37 -04:00
|
|
|
<?php
|
|
|
|
|
namespace Helper;
|
|
|
|
|
|
|
|
|
|
// here you can define custom actions
|
|
|
|
|
// all public methods declared in helper class will be available in $I
|
2019-03-21 21:43:24 -04:00
|
|
|
class Wpunit extends \Codeception\Module {
|
2019-04-05 14:46:59 -04:00
|
|
|
/**
|
|
|
|
|
* HOOK:
|
|
|
|
|
* triggered after module is created and configuration is loaded
|
|
|
|
|
*/
|
|
|
|
|
public function _initialize()
|
|
|
|
|
{
|
2019-04-15 23:24:54 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/wcg-helper.php';
|
2019-04-05 14:46:59 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/customer.php';
|
2019-04-14 01:59:03 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/coupon.php';
|
2019-04-05 14:46:59 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/product.php';
|
2019-04-16 17:48:39 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/product-variation.php';
|
2019-04-14 01:59:03 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/shipping-method.php';
|
2019-04-14 04:59:13 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/tax-rate.php';
|
2019-04-16 17:48:39 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/order-item.php';
|
2019-04-14 01:59:03 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/order.php';
|
2019-04-05 14:46:59 -04:00
|
|
|
require_once __DIR__ . '/crud-helpers/refund.php';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function coupon() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \CouponHelper::instance();
|
2019-04-05 14:46:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function customer() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \CustomerHelper::instance();
|
2019-04-05 14:46:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function order() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \OrderHelper::instance();
|
2019-04-05 14:46:59 -04:00
|
|
|
}
|
|
|
|
|
|
2019-04-16 17:48:39 -04:00
|
|
|
public function item() {
|
|
|
|
|
return \OrderItemHelper::instance();
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-05 14:46:59 -04:00
|
|
|
public function product() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \ProductHelper::instance();
|
2019-04-05 14:46:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function product_variation() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \ProductVariationHelper::instance();
|
2019-04-05 14:46:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function refund() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \RefundHelper::instance();
|
2019-04-14 01:59:03 -04:00
|
|
|
}
|
2019-04-05 14:46:59 -04:00
|
|
|
|
2019-04-14 01:59:03 -04:00
|
|
|
public function shipping_method() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \ShippingMethodHelper::instance();
|
2019-04-05 14:46:59 -04:00
|
|
|
}
|
|
|
|
|
|
2019-04-14 04:59:13 -04:00
|
|
|
public function tax_rate() {
|
2019-04-15 23:24:54 -04:00
|
|
|
return \TaxRateHelper::instance();
|
2019-04-14 04:59:13 -04:00
|
|
|
}
|
|
|
|
|
|
2019-04-05 14:46:59 -04:00
|
|
|
public function get_nodes( $ids, $crud ) {
|
|
|
|
|
$nodes = array();
|
|
|
|
|
foreach( $ids as $id ) {
|
|
|
|
|
$nodes[] = $crud->get_query_data( $id );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return array( 'nodes' => $nodes );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function clear_loader_cache( $loader_name ) {
|
|
|
|
|
$loader = \WPGraphQL::get_app_context()->getLoader( $loader_name );
|
|
|
|
|
$loader->clearAll();
|
|
|
|
|
}
|
2019-03-13 12:31:37 -04:00
|
|
|
}
|