Make sure the code examples run without syntax or runtime errors.

This commit is contained in:
Christian Bläul
2018-02-21 19:15:38 +01:00
parent d3a084d973
commit 3968659b9f

View File

@@ -1,18 +1,18 @@
<?php <?php
namespace ParseCsv\tests\methods; namespace ParseCsv\tests\methods;
use ParseCsv\Csv; use ParseCsv\Csv;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class ConstructTest extends TestCase class ConstructTest extends TestCase {
{
/** /**
* CSV * CSV
* The Csv object * The Csv object
* *
* @access protected * @access protected
* @var [Csv] * @var Csv
*/ */
protected $csv = null; protected $csv = null;
@@ -71,4 +71,16 @@ class ConstructTest extends TestCase
$this->assertTrue(is_string($this->csv->file_data)); $this->assertTrue(is_string($this->csv->file_data));
$this->assertEquals($csv, $this->csv->file_data); $this->assertEquals($csv, $this->csv->file_data);
} }
/**
* @runInSeparateProcess because download.php uses header()
*
* @see https://github.com/sebastianbergmann/phpunit/issues/720#issuecomment-10421092
*/
public function testCodeExamples() {
foreach (glob('examples/*.php') as $script_file) {
/** @noinspection PhpIncludeInspection */
require $script_file;
}
}
} }