mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Improved OldRequireTest: explanation and new test added (#128)
This commit is contained in:
@@ -22,7 +22,7 @@ Date: 3-March-2018
|
|||||||
guesses the type of each column.
|
guesses the type of each column.
|
||||||
|
|
||||||
- MIME: output() sends correct MIME type to browser
|
- 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
|
- Added support for mb_convert_encoding() instead of
|
||||||
iconv() - see issue #109.
|
iconv() - see issue #109.
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ namespace ParseCsv\tests\methods;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
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 {
|
class OldRequireTest extends TestCase {
|
||||||
|
|
||||||
protected function setUp() {
|
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() {
|
public function testOldLibWithoutComposer() {
|
||||||
|
|
||||||
@@ -25,4 +30,16 @@ class OldRequireTest extends TestCase {
|
|||||||
$this->assertEquals($output, []);
|
$this->assertEquals($output, []);
|
||||||
$this->assertEquals(0, $return_var);
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user