Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishgurung committed Oct 3, 2024
1 parent 5ea31e1 commit 2629c53
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 40 deletions.
18 changes: 0 additions & 18 deletions assets/javascripts/omise-payment-credit-card.js

This file was deleted.

14 changes: 1 addition & 13 deletions includes/gateway/class-omise-payment-creditcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
defined( 'ABSPATH' ) or die( 'No direct script access allowed.' );

class Omise_Payment_Creditcard extends Omise_Payment_Base_Card {

public function __construct()
{
parent::__construct();
Expand All @@ -28,8 +29,6 @@ public function __construct()
$this->payment_action = $this->get_option( 'payment_action' );
$this->restricted_countries = array( 'TH', 'JP', 'SG', 'MY' );

$this->register_omise_credit_card_scripts();

add_action( 'woocommerce_api_' . $this->id . '_callback', 'Omise_Callback::execute' );
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'omise_scripts' ) );
Expand Down Expand Up @@ -84,7 +83,6 @@ function init_form_fields() {
),
'desc_tip' => true
),

'card_form_theme' => [
'title' => __( 'Secure form theme', 'omise' ),
'type' => 'select',
Expand Down Expand Up @@ -144,16 +142,6 @@ function init_form_fields() {
);
}

private function register_omise_credit_card_scripts() {
wp_enqueue_script(
'omise-credit-card',
plugins_url( '../assets/javascripts/omise-payment-credit-card.js', dirname( __FILE__ ) ),
array( 'jquery' ),
WC_VERSION,
true
);
}

/**
* @see WC_Payment_Gateway::payment_fields()
* @see woocommerce/includes/abstracts/abstract-wc-payment-gateway.php
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/includes/blocks/gateways/traits/mock-gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public function get_existing_cards() {
return ['user_logged_in' => false];
}

// public function get_secure_form_config() {
// return ['secure_form_enabled' => false];
// }
public function get_secure_form_config() {
return [];
}

public function get_view_data() {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ protected function setUp(): void
}

Monkey\Functions\expect('add_action')->andReturn(null);
Monkey\Functions\expect('wp_enqueue_script');
Monkey\Functions\expect('wp_kses')
->times(3)
->andReturn(
Expand All @@ -64,8 +63,6 @@ protected function tearDown(): void
*/
public function test_class_is_initialized_properly()
{
Monkey\Functions\expect('plugins_url');

$creditCard = new Omise_Payment_Creditcard;

$this->assertEquals('credit_card', $creditCard->source_type);
Expand All @@ -88,8 +85,6 @@ public function get_secure_form_config() {
$cardFormCustomization->shouldReceive('get_instance')->andReturn($cardFormCustomization);
$cardFormCustomization->shouldReceive('get_design_setting')->andReturn(['abc' => ['xyz']]);

Monkey\Functions\expect('plugins_url');

$creditCard = new Omise_Payment_Creditcard;

$config = $creditCard->get_secure_form_config();
Expand All @@ -105,7 +100,6 @@ public function get_secure_form_config() {
public function get_existing_cards_for_user_logged_in() {
Monkey\Functions\expect('is_user_logged_in')->andReturn(true);
Monkey\Functions\expect('wp_get_current_user')->andReturn((object)['test_omise_customer_id' => 1]);
Monkey\Functions\expect('plugins_url');

$customerCard = Mockery::mock('alias:OmiseCustomerCard');
$customerCard->shouldReceive('get')->andReturn(1);
Expand Down

0 comments on commit 2629c53

Please sign in to comment.