mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-25 05:18:17 +00:00
53e0828d49
When I cloned this morning, composer gave me a message that the lock file was not up to date with the latest changes in composer.json. I do not understand why, but it suggested to run `composer update`, which I did. This led to a handful of problems with php-cs-fixer, all fixed with changes to doc-blocks, and phpstan (only Writer/Xls/Worksheet required a change to code). We would presumably have had these problems at the start of next month when dependabot did its thing, so fix them now.
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Helper;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Helper\Sample;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SampleTest extends TestCase
|
|
{
|
|
/**
|
|
* @runInSeparateProcess
|
|
*
|
|
* @preserveGlobalState disabled
|
|
*
|
|
* @dataProvider providerSample
|
|
*/
|
|
public function testSample(string $sample): void
|
|
{
|
|
// Suppress output to console
|
|
$this->setOutputCallback(function (): void {
|
|
});
|
|
|
|
require $sample;
|
|
|
|
self::assertTrue(true);
|
|
}
|
|
|
|
public function providerSample(): array
|
|
{
|
|
$skipped = [
|
|
];
|
|
|
|
// Unfortunately some tests are too long to run with code-coverage
|
|
// analysis on GitHub Actions, 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[$sample] = [$file];
|
|
}
|
|
}
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
}
|