forked from mpdf/mpdf
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIssue491Test.php
More file actions
83 lines (76 loc) · 1.42 KB
/
Issue491Test.php
File metadata and controls
83 lines (76 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
namespace Issues;
use Mpdf\Mpdf;
class Issue491Test extends \Mpdf\BaseMpdfTest
{
public function htmlProvider()
{
return [
[
'<table>
<tbody>
<tr><td>4</td></tr>
<tr><td>6</td></tr>
</tbody>
<tfoot>
<tr>
<td>#SUM#{colsum0}#SUM#</td>
</tr>
</tfoot>
</table>',
'10'
], [
'<table>
<tbody>
<tr><td>12,54</td></tr>
<tr><td>0,12</td></tr>
</tbody>
<tfoot>
<tr>
<td>#SUM#{colsum2}#SUM#</td>
</tr>
</tfoot>
</table>',
'12.66'
], [
'<table>
<tbody>
<tr><td>1.999,39€</td></tr>
<tr><td>3.214,01€</td></tr>
</tbody>
<tfoot>
<tr>
<td>#SUM#{colsum2}#SUM#</td>
</tr>
</tfoot>
</table>',
'5213.40'
], [
'<table>
<tbody>
<tr><td>1 215 951,21 €</td></tr>
<tr><td>US$ 2,104,092.99</td></tr>
</tbody>
<tfoot>
<tr>
<td>#SUM#{colsum0}#SUM#</td>
</tr>
</tfoot>
</table>',
'3320044'
]
];
}
/**
* @dataProvider htmlProvider
*/
public function testColsumInt($html, $expected)
{
$this->mpdf->setCompression(false);
$this->mpdf->WriteHtml($html);
$out = $this->mpdf->Output('', 'S');
$iMatchCnt = preg_match('/#SUM#(.*)#SUM#/', $out, $aMatches);
$this->assertEquals(1, $iMatchCnt, "could not find colsum for '".$html."'");
$this->assertEquals($expected, $aMatches[1]);
}
}