2016-08-31 16:15:54 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
namespace PhpOffice\PhpSpreadsheetTests;
|
2016-08-31 16:15:54 +00:00
|
|
|
|
|
|
|
class SampleTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @runInSeparateProcess
|
|
|
|
* @preserveGlobalState disabled
|
|
|
|
* @dataProvider providerSample
|
|
|
|
*/
|
|
|
|
public function testSample($sample)
|
|
|
|
{
|
2016-09-01 02:19:42 +00:00
|
|
|
// Suppress output to console
|
|
|
|
$this->setOutputCallback(function () {
|
|
|
|
});
|
|
|
|
|
2016-08-31 16:15:54 +00:00
|
|
|
require $sample;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function providerSample()
|
|
|
|
{
|
|
|
|
$skipped = [
|
2016-10-06 11:39:10 +00:00
|
|
|
'07 Reader PCLZip', // Xlsx cannot load file, leading to OpenOffice trying to and crashing. This is a bug that should be fixed
|
2016-10-06 12:07:57 +00:00
|
|
|
'20 Read Ods with PCLZip', // Crash: Call to undefined method \PhpOffice\PhpSpreadsheet\Shared\ZipArchive::statName()
|
2016-08-31 16:15:54 +00:00
|
|
|
'21 Pdf', // for now we don't have 3rdparty libs to tests PDF, but it should be added
|
2016-12-14 13:39:58 +00:00
|
|
|
'06 Largescale with cellcaching sqlite3', // Travis started crashing after they upgraded from PHP 7.0.13 to 7.0.14, so we disable it for now
|
2016-08-31 16:15:54 +00:00
|
|
|
];
|
2016-09-08 16:26:46 +00:00
|
|
|
|
|
|
|
// 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 = [
|
|
|
|
'06 Largescale',
|
|
|
|
'06 Largescale with cellcaching',
|
|
|
|
'06 Largescale with cellcaching sqlite',
|
|
|
|
'06 Largescale with cellcaching sqlite3',
|
2016-09-09 02:58:12 +00:00
|
|
|
'13 CalculationCyclicFormulae',
|
2016-09-08 16:26:46 +00:00
|
|
|
];
|
|
|
|
$skipped = array_merge($skipped, $tooLongToBeCovered);
|
|
|
|
}
|
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
$helper = new \PhpOffice\PhpSpreadsheet\Helper\Sample();
|
2016-08-31 16:15:54 +00:00
|
|
|
$samples = [];
|
|
|
|
foreach ($helper->getSamples() as $name => $sample) {
|
|
|
|
if (!in_array($name, $skipped)) {
|
|
|
|
$samples[$name] = [$sample];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $samples;
|
|
|
|
}
|
|
|
|
}
|