PhpSpreadsheet/tests/PhpSpreadsheetTests/Functional
oleibman 97a80f383c
Improve HTML Writer (#1464)
There are a number of situations where HTML write was producing
HTML which could not be validated. These include:

  - inconsistent use of backslash terminating META, IMG, and COL tags
  - @page style tags in body rather than header. Aside from being
    non-standard, HTML Reader treats those as spreadsheet data.
  - <div style="page-break-before:always" />, a construct which is
    usually better handled through css anyhow.
  - no alt tag for images (drawings and charts)

Other problems:

  - Windows file names not handled correctly for images
  - Memory drawings not handled in extendRowsForChartsAndImages
  - No handling of different values for showing gridlines
    for screen and print
  - Mpdf and Dompdf do not require the use of inline css.
    Tcpdf remains a holdout in the use of this inferior approach.
  - no need to chunk base64 encoding of embedded images
  - support for colors in number format was buggy (html tags
    run through htmlspecialchars)

Code has been refactored when practical to reduce the number of
very large functions.

Coverage is now 100% for the entire HTML Writer module,
from 75% lines and 39% methods beforehand.

All functions dealing only with charts
are bypassed for coverage because the version of Jpgraph available in
Composer is not suitable for PHP7. The code will, nevertheless,
run successfully, but with warning messages. I have confirmed that
the code is entirely covered, without warnings, when the current
version of Jpgraph is used in lieu of the one available in Composer.
I will be glad to revisit this when the Jpgraph problem is resolved.

Directory PhpSpreadsheetTests/Writer/Html was created to house
the new tests. It seemed logical to move HtmlCommentsTest to
the new directory from PhpSpreadsheetTests/Functional.

A function to generate all the HTML is useful, especially for testing,
but also in lieu of the multiple other generate* functions. I have
added and documented generateHTMLAll.

The documentation for the generate* functions (a) produces invalid html,
(b) produces html which cannot be handled correctly by HTML reader,
and (c) even if those were correct, does not actually affect
the display of the spreadsheet. The documentation has been replaced
by a valid, and more instructive, example.

The (undocumented) useEmbeddedCss property, and the functions
to test and set it are no longer needed. Rather than breaking
existing code by deleting them, I marked the functions deprecated.

This change borrows a change to LocaleFloatsTest from
pull request 1456, submitted a little over a week before this one.


## Improve NumberFormat Support

First phase of this change included correcting NumberFormat handling
in HTML Writer. Certain complex formats could not be handled without
changes to Style/NumberFormat, and I did not wish to combine those changes.

Once the original change had been pushed, I took this part of it back up.
HTML Writer can now handle conditions in formats like:
[Blue][>=3000.5]$#,##0.00;[Red][<0]$#,##0.00;$#,##0.00
In testing, I discovered several errors and omissions
in handling of some other formats.
These are now corrected, and tests added.
2020-05-18 12:43:18 +09:00
..
AbstractFunctional.php Read printing area correctly when skipping some sheets 2018-02-25 19:40:11 +01:00
ActiveSheetTest.php Fix for Xls writer wrong selected cells and active sheet 2020-03-02 17:50:46 +07:00
ColumnWidthTest.php Column dimensions are read by Reader\Xlsx 2018-08-06 10:33:27 +09:00
CommentsTest.php Fix Xlsx loaded an extra empty comment for each real comment 2018-05-26 11:19:12 +09:00
ConditionalStopIfTrueTest.php Adding option to stop at a conditional styling, if it matches 2018-01-07 22:45:51 +09:00
ConditionalTextTest.php Save Excel 2010+ Functions Properly 2020-05-18 12:37:35 +09:00
DrawingImageHyperlinkTest.php Remove unnecessary docs 2018-07-15 13:23:46 +09:00
EnclosureTest.php Test classes must ends with `Test` 2018-01-02 00:53:28 +09:00
FreezePaneTest.php Fix active cell when freeze pane is used 2020-03-02 18:11:37 +07:00
MergedCellsTest.php Test classes must ends with `Test` 2018-01-02 00:53:28 +09:00
PrintAreaTest.php Fix print area parser for XLSX reader 2018-10-28 14:37:05 +11:00
ReadBlankCellsTest.php CS Fixes (#962) 2019-04-15 22:49:51 +02:00
ReadFilterTest.php Xlsx reader do not read rows and columns filtered out in readFilter at all 2018-05-26 13:30:21 +09:00
SelectedCellsTest.php Fix for Xls writer wrong selected cells and active sheet 2020-03-02 17:50:46 +07:00
StreamTest.php All writers can write to stream 2020-05-16 20:12:28 +09:00
TypeAttributePreservationTest.php Allow to run an entire folder of tests 2020-05-17 18:35:55 +09:00
WorkbookViewAttributesTest.php Support workbook view attributes for Xlsx format 2018-06-24 20:15:38 +09:00