/** * Test legacy token functions. * * @since 2.7.0 * * @expectedDeprecated WC_Payment_Token::read * @expectedDeprecated WC_Payment_Token::create * @expectedDeprecated WC_Payment_Token::update */ public function test_wc_payment_token_legacy() { $token = WC_Helper_Payment_Token::create_stub_token(__FUNCTION__); $token_id = $token->get_id(); $token_read = new WC_Payment_Token_Stub(); $token_read->read($token_id); $this->assertEquals($token_id, $token_read->get_id()); $token = new WC_Payment_Token_Stub(); $token->set_token('blah'); $token->create(); $this->assertEquals('blah', $token->get_token()); $this->assertNotEmpty($token->get_id()); $token->set_token('blah2'); $token->update(); $this->assertEquals('blah2', $token->get_token()); }
/** * Test reading a token from the database. * @since 2.6.0 */ public function test_wc_payment_token_read() { $token = \WC_Helper_Payment_Token::create_stub_token(__FUNCTION__); $token_id = $token->get_id(); $token_read = new \WC_Payment_Token_Stub(); $token_read->read($token_id); $this->assertEquals($token->get_token(), $token_read->get_token()); $this->assertEquals($token->get_extra(), $token_read->get_extra()); }