Completed
Push — develop ( 08525a...2922a1 )
by Adrien
22:42
created

SampleTest::testSample()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 9.4285
1
<?php
2
3
namespace PhpSpreadsheetTests;
4
5
class SampleTest extends \PHPUnit_Framework_TestCase
6
{
7
    /**
8
     * @runInSeparateProcess
9
     * @preserveGlobalState disabled
10
     * @dataProvider providerSample
11
     */
12
    public function testSample($sample)
13
    {
14
        // Suppress output to console
15
        $this->setOutputCallback(function () {
16
        });
17
18
        require $sample;
19
    }
20
21
    public function providerSample()
22
    {
23
        $skipped = [
24
            '07 Reader PCLZip', // Excel2007 cannot load file, leading to OpenOffice trying to and crashing. This is a bug that should be fixed
25
            '20 Read OOCalc with PCLZip', // Crash: Call to undefined method PhpSpreadsheet\Shared\ZipArchive::statName()
26
            '21 Pdf', // for now we don't have 3rdparty libs to tests PDF, but it should be added
27
        ];
28
        $helper = new \PhpSpreadsheet\Helper\Sample();
29
        $samples = [];
30
        foreach ($helper->getSamples() as $name => $sample) {
31
            if (!in_array($name, $skipped)) {
32
                $samples[$name] = [$sample];
33
            }
34
        }
35
36
        return $samples;
37
    }
38
}
39