PhpSpreadsheet/tests/PhpSpreadsheetTests/SampleTest.php

55 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace PhpOffice\PhpSpreadsheetTests;
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PHPUnit_Framework_TestCase;
class SampleTest extends PHPUnit_Framework_TestCase
{
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
* @dataProvider providerSample
2016-12-22 14:43:37 +00:00
*
* @param mixed $sample
*/
public function testSample($sample)
{
// Suppress output to console
$this->setOutputCallback(function () {
});
require $sample;
}
public function providerSample()
{
$skipped = [];
// 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',
2016-09-09 02:58:12 +00:00
'13 CalculationCyclicFormulae',
];
$skipped = array_merge($skipped, $tooLongToBeCovered);
}
$helper = new Sample();
2017-10-01 08:48:59 +00:00
$result = [];
foreach ($helper->getSamples() as $samples) {
foreach ($samples as $name => $sample) {
if (!in_array($name, $skipped) && preg_match('~21_Pdf_mPDF~', $sample)) {
$file = '../samples/' . $sample;
$result[] = [$file];
}
}
}
2017-10-01 08:48:59 +00:00
return $result;
}
}