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