File tree 2 files changed +32
-0
lines changed
tests/PhpSpreadsheetTests/Calculation
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,18 @@ public function testCellWithFormulaTwoIndirect(): void
180
180
self ::assertEquals ('9 ' , $ cell3 ->getCalculatedValue ());
181
181
}
182
182
183
+ public function testCellWithStringNumeric (): void
184
+ {
185
+ $ spreadsheet = new Spreadsheet ();
186
+ $ workSheet = $ spreadsheet ->getActiveSheet ();
187
+ $ cell1 = $ workSheet ->getCell ('A1 ' );
188
+ $ cell1 ->setValue ('+2.5 ' );
189
+ $ cell2 = $ workSheet ->getCell ('B1 ' );
190
+ $ cell2 ->setValue ('=100*A1 ' );
191
+
192
+ self ::assertSame (250.0 , $ cell2 ->getCalculatedValue ());
193
+ }
194
+
183
195
public function testCellWithStringFraction (): void
184
196
{
185
197
$ spreadsheet = new Spreadsheet ();
Original file line number Diff line number Diff line change 7
7
8
8
class FormattedNumberTest extends TestCase
9
9
{
10
+ /**
11
+ * @dataProvider providerNumbers
12
+ *
13
+ * @param mixed $expected
14
+ */
15
+ public function testNumber ($ expected , string $ value ): void
16
+ {
17
+ FormattedNumber::convertToNumberIfFormatted ($ value );
18
+ self ::assertSame ($ expected , $ value );
19
+ }
20
+
21
+ public function providerNumbers (): array
22
+ {
23
+ return [
24
+ [-12.5 , '-12.5 ' ],
25
+ [-125.0 , '-1.25e2 ' ],
26
+ [0.125 , '12.5% ' ],
27
+ ];
28
+ }
29
+
10
30
/**
11
31
* @dataProvider providerFractions
12
32
*/
You can’t perform that action at this time.
0 commit comments