mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-22 16:19:19 +00:00
ec4098c8fd
While we might never be able to have 100% of our code strict, we can at the very least do it for all of our tests. This ensures that our tests are using our API with the types as intended by the test author, and not silently be cast to what our API requires.
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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
|
|
{
|
|
ob_start();
|
|
require $sample;
|
|
ob_end_clean();
|
|
|
|
self::assertTrue(true);
|
|
}
|
|
|
|
public static 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;
|
|
}
|
|
}
|