Skip to content

Commit 2b478b1

Browse files
authored
Merge pull request #315 from ruscoe/unit-tests
Fix class name in payment token unit test, add unit test for set_nickname() function
2 parents 90ab62e + 73b4986 commit 2b478b1

File tree

1 file changed

+38
-22
lines changed

1 file changed

+38
-22
lines changed

tests/unit/payment-gateway-payment-token.php

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Payment_Gateway_Payment_Token extends Test_Case {
1414

1515

1616
/**
17-
* Tests for \SV_WC_Payment_Gateway_Helper::__construct()
17+
* Tests for \SV_WC_Payment_Gateway_Payment_Token::__construct()
1818
*
1919
* Simply tests that the token ID and data are set.
2020
*
@@ -34,7 +34,7 @@ public function test__construct() {
3434

3535

3636
/**
37-
* Tests for \SV_WC_Payment_Gateway_Helper::__construct()
37+
* Tests for \SV_WC_Payment_Gateway_Payment_Token::__construct()
3838
*
3939
* Tests that the card type is correctly set in all situations.
4040
*
@@ -68,9 +68,9 @@ public function provider_test__construct_set_card_type() {
6868

6969

7070
/**
71-
* Tests \SV_WC_Payment_Gateway_Helper::set_default()
71+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_default()
7272
*
73-
* Also provides coverage for \SV_WC_Payment_Gateway_Helper::is_default()
73+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::is_default()
7474
*
7575
* @since 4.5.0
7676
*/
@@ -87,7 +87,7 @@ public function test_set_default() {
8787

8888

8989
/**
90-
* Tests true for \SV_WC_Payment_Gateway_Helper::is_credit_card()
90+
* Tests true for \SV_WC_Payment_Gateway_Payment_Token::is_credit_card()
9191
*
9292
* @since 4.5.0
9393
*/
@@ -102,7 +102,7 @@ public function test_is_credit_card_true() {
102102

103103

104104
/**
105-
* Tests false for \SV_WC_Payment_Gateway_Helper::is_credit_card()
105+
* Tests false for \SV_WC_Payment_Gateway_Payment_Token::is_credit_card()
106106
*
107107
* @since 4.5.0
108108
*/
@@ -117,7 +117,7 @@ public function test_is_credit_card_false() {
117117

118118

119119
/**
120-
* Tests true for \SV_WC_Payment_Gateway_Helper::is_echeck()
120+
* Tests true for \SV_WC_Payment_Gateway_Payment_Token::is_echeck()
121121
*
122122
* @since 4.5.0
123123
*/
@@ -132,7 +132,7 @@ public function test_is_echeck_true() {
132132

133133

134134
/**
135-
* Tests false for \SV_WC_Payment_Gateway_Helper::is_check()
135+
* Tests false for \SV_WC_Payment_Gateway_Payment_Token::is_check()
136136
*
137137
* @since 4.5.0
138138
*/
@@ -147,9 +147,9 @@ public function test_is_echeck_false() {
147147

148148

149149
/**
150-
* Tests \SV_WC_Payment_Gateway_Helper::set_card_type()
150+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_card_type()
151151
*
152-
* Also provides coverage for \SV_WC_Payment_Gateway_Helper::get_account_type()
152+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::get_account_type()
153153
*
154154
* @since 4.5.0
155155
*/
@@ -166,9 +166,9 @@ public function test_set_card_type() {
166166

167167

168168
/**
169-
* Tests \SV_WC_Payment_Gateway_Helper::set_account_type()
169+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_account_type()
170170
*
171-
* Also provides coverage for \SV_WC_Payment_Gateway_Helper::get_account_type()
171+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::get_account_type()
172172
*
173173
* @since 4.5.0
174174
*/
@@ -185,7 +185,7 @@ public function test_set_account_type() {
185185

186186

187187
/**
188-
* Tests for \SV_WC_Payment_Gateway_Helper::get_type_full()
188+
* Tests for \SV_WC_Payment_Gateway_Payment_Token::get_type_full()
189189
*
190190
* @since 4.5.0
191191
* @dataProvider provider_test_get_type_full
@@ -221,9 +221,9 @@ public function provider_test_get_type_full() {
221221

222222

223223
/**
224-
* Tests \SV_WC_Payment_Gateway_Helper::set_last_four()
224+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_last_four()
225225
*
226-
* Also provides coverage for \SV_WC_Payment_Gateway_Helper::get_last_four()
226+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::get_last_four()
227227
*
228228
* @since 4.5.0
229229
*/
@@ -240,9 +240,9 @@ public function test_set_last_four() {
240240

241241

242242
/**
243-
* Tests \SV_WC_Payment_Gateway_Helper::set_exp_month()
243+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_exp_month()
244244
*
245-
* Also provides coverage for \SV_WC_Payment_Gateway_Helper::get_exp_month()
245+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::get_exp_month()
246246
*
247247
* @since 4.5.0
248248
*/
@@ -259,9 +259,9 @@ public function test_set_exp_month() {
259259

260260

261261
/**
262-
* Tests \SV_WC_Payment_Gateway_Helper::set_exp_year()
262+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_exp_year()
263263
*
264-
* Also provides coverage for \SV_WC_Payment_Gateway_Helper::get_exp_year()
264+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::get_exp_year()
265265
*
266266
* @since 4.5.0
267267
*/
@@ -278,7 +278,7 @@ public function test_set_exp_year() {
278278

279279

280280
/**
281-
* Tests \SV_WC_Payment_Gateway_Helper::get_exp_date()
281+
* Tests \SV_WC_Payment_Gateway_Payment_Token::get_exp_date()
282282
*
283283
* @since 4.5.0
284284
*/
@@ -294,9 +294,9 @@ public function test_get_exp_date() {
294294

295295

296296
/**
297-
* Tests \SV_WC_Payment_Gateway_Helper::set_image_url()
297+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_image_url()
298298
*
299-
* Also provides coverage for \SV_WC_Payment_Gateway_Helper::get_image_url()
299+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::get_image_url()
300300
*
301301
* @since 4.5.0
302302
*/
@@ -309,5 +309,21 @@ public function test_set_image_url() {
309309
$this->assertEquals( 'http://example.com/1234.jpg', $token->get_image_url() );
310310
}
311311

312+
/**
313+
* Tests \SV_WC_Payment_Gateway_Payment_Token::set_nickname()
314+
*
315+
* Also provides coverage for \SV_WC_Payment_Gateway_Payment_Token::get_nickname()
316+
*
317+
* @since 5.2.1
318+
*/
319+
public function test_set_nickname() {
320+
321+
$token = new PluginFramework\SV_WC_Payment_Gateway_Payment_Token( 'mock-token', array() );
322+
323+
$token->set_nickname( 'new-payment-method' );
324+
325+
$this->assertEquals( 'new-payment-method', $token->get_nickname() );
326+
}
327+
312328

313329
}

0 commit comments

Comments
 (0)