/** * 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 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(1, array('token' => $raw_token, 'gateway_id' => 'paypal')); $token->set_extra('woocommerce'); $data = $token->get_data(); $this->assertEquals($raw_token, $data['token']); $this->assertEquals('paypal', $data['gateway_id']); $this->assertEquals('stub', $data['type']); $this->assertEquals('woocommerce', $data['meta']['extra']); }