2016-08-31 16:15:54 +00:00
|
|
|
<?php
|
|
|
|
|
2017-11-25 10:26:41 +00:00
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Helper;
|
2016-08-31 16:15:54 +00:00
|
|
|
|
2017-05-17 22:02:17 +00:00
|
|
|
use PhpOffice\PhpSpreadsheet\Helper\Sample;
|
2017-11-08 15:48:01 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2017-05-17 22:02:17 +00:00
|
|
|
|
2017-11-08 15:48:01 +00:00
|
|
|
class SampleTest extends TestCase
|
2016-08-31 16:15:54 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @runInSeparateProcess
|
|
|
|
* @preserveGlobalState disabled
|
|
|
|
* @dataProvider providerSample
|
2016-12-22 14:43:37 +00:00
|
|
|
*
|
|
|
|
* @param mixed $sample
|
2016-08-31 16:15:54 +00:00
|
|
|
*/
|
|
|
|
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;
|
2019-07-25 06:45:43 +00:00
|
|
|
|
|
|
|
self::assertTrue(true);
|
2016-08-31 16:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerSample()
|
|
|
|
{
|
2017-10-28 16:58:42 +00:00
|
|
|
$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
|
|
|
|
];
|
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 = [
|
2017-10-28 16:58:42 +00:00
|
|
|
'Basic/06_Largescale.php',
|
|
|
|
'Basic/13_CalculationCyclicFormulae.php',
|
2016-09-08 16:26:46 +00:00
|
|
|
];
|
|
|
|
$skipped = array_merge($skipped, $tooLongToBeCovered);
|
|
|
|
}
|
|
|
|
|
2017-05-17 22:02:17 +00:00
|
|
|
$helper = new Sample();
|
2017-10-01 08:48:59 +00:00
|
|
|
$result = [];
|
|
|
|
foreach ($helper->getSamples() as $samples) {
|
2017-10-28 16:58:42 +00:00
|
|
|
foreach ($samples as $sample) {
|
|
|
|
if (!in_array($sample, $skipped)) {
|
2017-10-01 08:48:59 +00:00
|
|
|
$file = '../samples/' . $sample;
|
|
|
|
$result[] = [$file];
|
|
|
|
}
|
2016-08-31 16:15:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-01 08:48:59 +00:00
|
|
|
return $result;
|
2016-08-31 16:15:54 +00:00
|
|
|
}
|
|
|
|
}
|