Remove tests that include tcPDF and DomPDF libraries when running against PHP8, because neither library is yet PHP8-ready
This commit is contained in:
parent
87a909aaf8
commit
ee13533db3
|
@ -12,10 +12,12 @@ $spreadsheet = $reader->load(__DIR__ . '/../templates/26template.xlsx');
|
||||||
// at this point, we could do some manipulations with the template, but we skip this step
|
// at this point, we could do some manipulations with the template, but we skip this step
|
||||||
$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']);
|
$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']);
|
||||||
|
|
||||||
// Export to PDF (.pdf)
|
if (\PHP_VERSION_ID < 80000) {
|
||||||
$helper->log('Write to PDF format');
|
// Export to PDF (.pdf)
|
||||||
IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class);
|
$helper->log('Write to PDF format');
|
||||||
$helper->write($spreadsheet, __FILE__, ['Pdf']);
|
IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class);
|
||||||
|
$helper->write($spreadsheet, __FILE__, ['Pdf']);
|
||||||
|
}
|
||||||
|
|
||||||
// Remove first two rows with field headers before exporting to CSV
|
// Remove first two rows with field headers before exporting to CSV
|
||||||
$helper->log('Removing first two heading rows for CSV export');
|
$helper->log('Removing first two heading rows for CSV export');
|
||||||
|
|
|
@ -32,11 +32,13 @@ $spreadsheet->getActiveSheet()->setShowGridLines(false);
|
||||||
$helper->log('Set orientation to landscape');
|
$helper->log('Set orientation to landscape');
|
||||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
|
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
|
||||||
|
|
||||||
$helper->log('Write to Dompdf');
|
if (\PHP_VERSION_ID < 80000) {
|
||||||
$writer = new Dompdf($spreadsheet);
|
$helper->log('Write to Dompdf');
|
||||||
$filename = $helper->getFileName('21b_Pdf_dompdf.xlsx', 'pdf');
|
$writer = new Dompdf($spreadsheet);
|
||||||
$writer->setEditHtmlCallback('replaceBody');
|
$filename = $helper->getFileName('21b_Pdf_dompdf.xlsx', 'pdf');
|
||||||
$writer->save($filename);
|
$writer->setEditHtmlCallback('replaceBody');
|
||||||
|
$writer->save($filename);
|
||||||
|
}
|
||||||
|
|
||||||
$helper->log('Write to Mpdf');
|
$helper->log('Write to Mpdf');
|
||||||
$writer = new Mpdf($spreadsheet);
|
$writer = new Mpdf($spreadsheet);
|
||||||
|
@ -44,8 +46,10 @@ $filename = $helper->getFileName('21b_Pdf_mpdf.xlsx', 'pdf');
|
||||||
$writer->setEditHtmlCallback('replaceBody');
|
$writer->setEditHtmlCallback('replaceBody');
|
||||||
$writer->save($filename);
|
$writer->save($filename);
|
||||||
|
|
||||||
$helper->log('Write to Tcpdf');
|
if (\PHP_VERSION_ID < 80000) {
|
||||||
$writer = new Tcpdf($spreadsheet);
|
$helper->log('Write to Tcpdf');
|
||||||
$filename = $helper->getFileName('21b_Pdf_tcpdf.xlsx', 'pdf');
|
$writer = new Tcpdf($spreadsheet);
|
||||||
$writer->setEditHtmlCallback('replaceBody');
|
$filename = $helper->getFileName('21b_Pdf_tcpdf.xlsx', 'pdf');
|
||||||
$writer->save($filename);
|
$writer->setEditHtmlCallback('replaceBody');
|
||||||
|
$writer->save($filename);
|
||||||
|
}
|
|
@ -10,16 +10,23 @@ class StreamTest extends TestCase
|
||||||
{
|
{
|
||||||
public function providerFormats(): array
|
public function providerFormats(): array
|
||||||
{
|
{
|
||||||
return [
|
$providerFormats = [
|
||||||
['Xls'],
|
['Xls'],
|
||||||
['Xlsx'],
|
['Xlsx'],
|
||||||
['Ods'],
|
['Ods'],
|
||||||
['Csv'],
|
['Csv'],
|
||||||
['Html'],
|
['Html'],
|
||||||
['Tcpdf'],
|
|
||||||
['Dompdf'],
|
|
||||||
['Mpdf'],
|
['Mpdf'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (\PHP_VERSION_ID < 80000) {
|
||||||
|
$providerFormats = array_merge(
|
||||||
|
$providerFormats,
|
||||||
|
[['Tcpdf'],['Dompdf']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $providerFormats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,16 @@ class SampleTest extends TestCase
|
||||||
'Chart/32_Chart_read_write_PDF.php', // Unfortunately JpGraph is not up to date for latest PHP and raise many warnings
|
'Chart/32_Chart_read_write_PDF.php', // Unfortunately JpGraph is not up to date for latest PHP and raise many warnings
|
||||||
'Chart/32_Chart_read_write_HTML.php', // idem
|
'Chart/32_Chart_read_write_HTML.php', // idem
|
||||||
];
|
];
|
||||||
|
// TCPDF and DomPDF libraries don't support PHP8 yet
|
||||||
|
if (\PHP_VERSION_ID >= 80000) {
|
||||||
|
$skipped = array_merge(
|
||||||
|
$skipped,
|
||||||
|
[
|
||||||
|
'Pdf/21_Pdf_Domdf.php',
|
||||||
|
'Pdf/21_Pdf_TCPDF.php',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Unfortunately some tests are too long be ran with code-coverage
|
// Unfortunately some tests are too long be ran with code-coverage
|
||||||
// analysis on Travis, so we need to exclude them
|
// analysis on Travis, so we need to exclude them
|
||||||
|
|
Loading…
Reference in New Issue