Improved OldRequireTest: explanation and new test added (#128)

This commit is contained in:
Fonata
2018-03-17 12:37:54 +01:00
committed by GitHub
parent e4c9fed6cf
commit 42b5d30d66
2 changed files with 19 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ Date: 3-March-2018
guesses the type of each column.
- MIME: output() sends correct MIME type to browser
if the separator is a tab tab (Issue #79).
if the separator is a tab char (Issue #79).
- Added support for mb_convert_encoding() instead of
iconv() - see issue #109.

View File

@@ -4,6 +4,11 @@ namespace ParseCsv\tests\methods;
use PHPUnit\Framework\TestCase;
/**
* This test checks for backwards compatibility: Does it work to
* - require the old "parsecsv.lib.php" instead of composer autoloading?
* - use the old class name "parseCSV"?
*/
class OldRequireTest extends TestCase {
protected function setUp() {
@@ -15,7 +20,7 @@ class OldRequireTest extends TestCase {
}
/**
* @runInSeparateProcess because download.php uses header()
* @runInSeparateProcess so that disabled autoloading has an effect
*/
public function testOldLibWithoutComposer() {
@@ -25,4 +30,16 @@ class OldRequireTest extends TestCase {
$this->assertEquals($output, []);
$this->assertEquals(0, $return_var);
}
/**
* @runInSeparateProcess so that disabled autoloading has an effect
*/
public function testOldLibWithOldClassName() {
file_put_contents('__eval.php', '<?php require "parsecsv.lib.php"; new parseCSV;');
exec("php __eval.php", $output, $return_var);
unlink('__eval.php');
$this->assertEquals($output, []);
$this->assertEquals(0, $return_var);
}
}