function appthemes_load_options() { extract(appthemes_payments_get_args(), EXTR_SKIP); if (is_admin()) { APP_Connected_Post_Orders::add_post_type($items_post_types); } if ($options) { APP_Gateway_Registry::register_options($options); } else { $defaults = array('currency_code' => 'USD', 'currency_identifier' => 'symbol', 'currency_position' => 'left', 'thousands_separator' => ',', 'decimal_separator' => '.', 'tax_charge' => 0, 'gateways' => array('enabled' => array())); $options = new scbOptions('app_payments', false, $defaults); APP_Gateway_Registry::register_options($options); } }
/** * @depends test_gateway_creation * @depends test_anonymous_process_fail */ public function test_anonymous_process_success($gateway) { $order = appthemes_new_order(); $order->add_item('mock-process-test-item', 5, $order->get_id()); $old_options = APP_Gateway_Registry::get_options(); // Create new options object with gateway enabled $options = new stdClass(); $options->gateways = array('enabled' => array('mock-gateway' => true)); APP_Gateway_Registry::register_options($options); // Gateway should be enabled $this->assertTrue(APP_Gateway_Registry::is_gateway_enabled('mock-gateway')); // After enabled, it should pass $status = appthemes_process_gateway('mock-gateway', $order); $this->assertTrue($status); // Processing should call the gateway $this->assertTrue($gateway->process_called()); APP_Gateway_Registry::register_options($old_options); }