/** * Test that get_data returns the correct internal representation for a token. * @since 2.6.0 */ public function test_wc_payment_token_get_data() { $raw_token = time() . ' ' . __FUNCTION__; $token = new WC_Payment_Token_Stub(); $token->set_token($raw_token); $token->set_gateway_id('paypal'); $token->set_extra('woocommerce'); $this->assertEquals($raw_token, $token->get_token()); $this->assertEquals('paypal', $token->get_gateway_id()); $this->assertEquals('stub', $token->get_type()); $data = $token->get_data(); $this->assertEquals('extra', $data['meta_data'][0]->key); $this->assertEquals('woocommerce', $data['meta_data'][0]->value); }
/** * Test set the gateway ID. * @since 2.6.0 */ public function test_wc_payment_set_gateway_id() { $token = new \WC_Payment_Token_Stub(1); $token->set_gateway_id('paypal'); $this->assertEquals('paypal', $token->get_gateway_id()); }