2922a13764
This introduce a helper class that should be used to log things, avoiding a lot of boilerplate code. Also all output are made in /tmp folder instead of beside the script itself. This is because there is a high chance that the folder containing the script is not writtable by webserver. So using the /tmp folder makes it more likely to works in a variety of setup.
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace PhpSpreadsheetTests;
|
|
|
|
class SampleTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @runInSeparateProcess
|
|
* @preserveGlobalState disabled
|
|
* @dataProvider providerSample
|
|
*/
|
|
public function testSample($sample)
|
|
{
|
|
// Suppress output to console
|
|
$this->setOutputCallback(function () {
|
|
});
|
|
|
|
require $sample;
|
|
}
|
|
|
|
public function providerSample()
|
|
{
|
|
$skipped = [
|
|
'07 Reader PCLZip', // Excel2007 cannot load file, leading to OpenOffice trying to and crashing. This is a bug that should be fixed
|
|
'20 Read OOCalc with PCLZip', // Crash: Call to undefined method PhpSpreadsheet\Shared\ZipArchive::statName()
|
|
'21 Pdf', // for now we don't have 3rdparty libs to tests PDF, but it should be added
|
|
];
|
|
$helper = new \PhpSpreadsheet\Helper\Sample();
|
|
$samples = [];
|
|
foreach ($helper->getSamples() as $name => $sample) {
|
|
if (!in_array($name, $skipped)) {
|
|
$samples[$name] = [$sample];
|
|
}
|
|
}
|
|
|
|
return $samples;
|
|
}
|
|
}
|