Updates to 3rd party libraries
Add Dockerfile and specific docker-php.ini
This commit is contained in:
33
inc/vendor/phpoffice/phpspreadsheet/tests/PhpSpreadsheetTests/Helper/HtmlTest.php
vendored
Normal file
33
inc/vendor/phpoffice/phpspreadsheet/tests/PhpSpreadsheetTests/Helper/HtmlTest.php
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheetTests\Helper;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Helper\Html;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class HtmlTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider providerUtf8EncodingSupport
|
||||
*
|
||||
* @param mixed $expected
|
||||
* @param mixed $input
|
||||
*/
|
||||
public function testUtf8EncodingSupport($expected, $input)
|
||||
{
|
||||
$html = new Html();
|
||||
$actual = $html->toRichTextObject($input);
|
||||
|
||||
self::assertSame($expected, $actual->getPlainText());
|
||||
}
|
||||
|
||||
public function providerUtf8EncodingSupport()
|
||||
{
|
||||
return [
|
||||
['foo', 'foo'],
|
||||
['können', 'können'],
|
||||
['русский', 'русский'],
|
||||
["foo\nbar", '<p>foo</p><p>bar</p>'],
|
||||
];
|
||||
}
|
||||
}
|
88
inc/vendor/phpoffice/phpspreadsheet/tests/PhpSpreadsheetTests/Helper/MigratorTest.php
vendored
Normal file
88
inc/vendor/phpoffice/phpspreadsheet/tests/PhpSpreadsheetTests/Helper/MigratorTest.php
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheetTests\Helper;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Helper\Migrator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class MigratorTest extends TestCase
|
||||
{
|
||||
public function testMappingOnlyContainExistingClasses()
|
||||
{
|
||||
$migrator = new Migrator();
|
||||
|
||||
foreach ($migrator->getMapping() as $classname) {
|
||||
if (substr_count($classname, '\\')) {
|
||||
self::assertTrue(class_exists($classname) || interface_exists($classname), 'mapping is wrong, class does not exists in project: ' . $classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testReplace()
|
||||
{
|
||||
$input = <<<'STRING'
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
|
||||
use PHPExcel;
|
||||
use PHPExcel_Worksheet;
|
||||
|
||||
class Bar
|
||||
{
|
||||
/**
|
||||
* @param PHPExcel $workbook
|
||||
* @param PHPExcel_Worksheet $sheet
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function baz(PHPExcel $workbook, PHPExcel_Worksheet $sheet)
|
||||
{
|
||||
PHPExcel::class;
|
||||
\PHPExcel::class;
|
||||
$PHPExcel->do();
|
||||
$fooobjPHPExcel->do();
|
||||
$objPHPExcel->do();
|
||||
$this->objPHPExcel->do();
|
||||
$this->PHPExcel->do();
|
||||
|
||||
return \PHPExcel_Cell::stringFromColumnIndex(9);
|
||||
}
|
||||
}
|
||||
STRING;
|
||||
|
||||
$expected = <<<'STRING'
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
|
||||
use \PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
class Bar
|
||||
{
|
||||
/**
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $workbook
|
||||
* @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheet
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function baz(\PhpOffice\PhpSpreadsheet\Spreadsheet $workbook, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheet)
|
||||
{
|
||||
\PhpOffice\PhpSpreadsheet\Spreadsheet::class;
|
||||
\PhpOffice\PhpSpreadsheet\Spreadsheet::class;
|
||||
$PHPExcel->do();
|
||||
$fooobjPHPExcel->do();
|
||||
$objPHPExcel->do();
|
||||
$this->objPHPExcel->do();
|
||||
$this->PHPExcel->do();
|
||||
|
||||
return \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex(9);
|
||||
}
|
||||
}
|
||||
STRING;
|
||||
|
||||
$migrator = new Migrator();
|
||||
self::assertSame($expected, $migrator->replace($input));
|
||||
}
|
||||
}
|
62
inc/vendor/phpoffice/phpspreadsheet/tests/PhpSpreadsheetTests/Helper/SampleTest.php
vendored
Normal file
62
inc/vendor/phpoffice/phpspreadsheet/tests/PhpSpreadsheetTests/Helper/SampleTest.php
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheetTests\Helper;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Helper\Sample;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @dataProvider providerSample
|
||||
*
|
||||
* @param mixed $sample
|
||||
*/
|
||||
public function testSample($sample)
|
||||
{
|
||||
// Suppress output to console
|
||||
$this->setOutputCallback(function () {
|
||||
});
|
||||
|
||||
require $sample;
|
||||
}
|
||||
|
||||
public function providerSample()
|
||||
{
|
||||
$skipped = [
|
||||
'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
|
||||
];
|
||||
|
||||
// TCPDF does not support PHP 7.2
|
||||
if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
|
||||
$skipped[] = 'Pdf/21_Pdf_TCPDF.php';
|
||||
}
|
||||
|
||||
// Unfortunately some tests are too long be ran with code-coverage
|
||||
// analysis on Travis, so we need to exclude them
|
||||
global $argv;
|
||||
if (in_array('--coverage-clover', $argv)) {
|
||||
$tooLongToBeCovered = [
|
||||
'Basic/06_Largescale.php',
|
||||
'Basic/13_CalculationCyclicFormulae.php',
|
||||
];
|
||||
$skipped = array_merge($skipped, $tooLongToBeCovered);
|
||||
}
|
||||
|
||||
$helper = new Sample();
|
||||
$result = [];
|
||||
foreach ($helper->getSamples() as $samples) {
|
||||
foreach ($samples as $sample) {
|
||||
if (!in_array($sample, $skipped)) {
|
||||
$file = '../samples/' . $sample;
|
||||
$result[] = [$file];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user