Issue2029Test.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Reader\Html;
  3. use PhpOffice\PhpSpreadsheet\Reader\Html;
  4. use PHPUnit\Framework\TestCase;
  5. class Issue2029Test extends TestCase
  6. {
  7. public function testIssue2029(): void
  8. {
  9. $content = <<<'EOF'
  10. <!DOCTYPE html>
  11. <html>
  12. <head>
  13. <meta charset='utf-8'>
  14. <title>Declaracion en Linea</title>
  15. </head>
  16. <body>
  17. <table>
  18. <tr>
  19. <td>
  20. <table>
  21. <tr>
  22. <td>
  23. <table>
  24. <tbody>
  25. <tr>
  26. <td>CUIT:</td>
  27. <td><label id="lblCUIT" class="text-left">30-53914190-9</label></td>
  28. </tr>
  29. <tr>
  30. <td>Per&iacute;odo</td>
  31. <td><label id="lblPeriodo" class="text-left">02 2021</label></td>
  32. </tr>
  33. <tr>
  34. <td>Secuencia:</td>
  35. <td><label id="lblSecuencia" class="text-left">0 - Original</label></td>
  36. </tr>
  37. <tr>
  38. <td>Contribuyente:</td>
  39. <td><label id="lblContribuyente">SIND DE TRABAJADORES DE IND DE LA ALIMENTACION</label></td>
  40. <td><label id="lblFechaHoy"></label></td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </td>
  45. </tr>
  46. </table>
  47. </td>
  48. </tr>
  49. </table>
  50. <table border="1px">
  51. <tr>
  52. <th class="text-center">
  53. CUIL
  54. </th>
  55. <th class="text-center">
  56. Apellido y Nombre
  57. </th>
  58. <th class="text-center">
  59. Obra Social
  60. </th>
  61. <th class="text-center">
  62. Corresponde Reducci&oacute;n?
  63. </th>
  64. </tr>
  65. <tr>
  66. <td class="text-center">
  67. 12345678901
  68. </td>
  69. <td class="text-center">
  70. EMILIANO ZAPATA SALAZAR
  71. </td>
  72. <td class="text-center">
  73. 101208
  74. </td>
  75. <td class="text-center">
  76. Yes
  77. </td>
  78. </tr>
  79. <tr>
  80. <td class="text-center">
  81. 23456789012
  82. </td>
  83. <td class="text-center">
  84. FRANCISCO PANCHO VILLA
  85. </td>
  86. <td class="text-center">
  87. 101208
  88. </td>
  89. <td class="text-center">
  90. No
  91. </td>
  92. </tr>
  93. </table>
  94. </body>
  95. </html>
  96. EOF;
  97. $reader = new Html();
  98. $spreadsheet = $reader->loadFromString($content);
  99. $sheet = $spreadsheet->getActiveSheet();
  100. self::assertSame('CUIT:', $sheet->getCell('A1')->getValue());
  101. self::assertSame('30-53914190-9', $sheet->getCell('B1')->getValue());
  102. self::assertSame('Contribuyente:', $sheet->getCell('A4')->getValue());
  103. self::assertSame('Apellido y Nombre', $sheet->getCell('B9')->getValue());
  104. self::assertEquals('101208', $sheet->getCell('C10')->getValue());
  105. self::assertEquals('Yes', $sheet->getCell('D10')->getValue());
  106. self::assertEquals('23456789012', $sheet->getCell('A11')->getValue());
  107. self::assertEquals('No', $sheet->getCell('D11')->getValue());
  108. }
  109. }