Skip to content

Commit 3ec00c9

Browse files
committed
fix percentage formatter test assertions
1 parent 9347495 commit 3ec00c9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/integration/HelperTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public function provider_get_escaped_id_list() : array {
101101
*
102102
* @param float|int|string $number the number to format as percentage
103103
* @param string $expected result
104-
*
104+
* @param int|bool|null $decimal_points optional, the number of decimal points to use
105105
*/
106-
public function test_format_percentage( $number, string $expected ) {
106+
public function test_format_percentage( $number, string $expected, $decimal_points = false ) {
107107

108-
$this->assertSame( $expected, Framework\SV_WC_Helper::format_percentage( $number ) );
108+
$this->assertSame( $expected, Framework\SV_WC_Helper::format_percentage( $number, $decimal_points ) );
109109
}
110110

111111

@@ -121,7 +121,9 @@ public function provider_format_percentage() {
121121
[ '0.5', '50%' ],
122122
[ 0, '0%' ],
123123
[ 1, '100%' ],
124-
[ 1.333333, '133.33%' ],
124+
[ 1.333333, '133.3333%' ],
125+
[ 1.333333, '133.33%', 2 ],
126+
[ 1.333333, '133%', null ],
125127
];
126128
}
127129

0 commit comments

Comments
 (0)