mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 21:36:05 +03:00
Merge pull request #90 from Slamdunk/hotfix/ci-5.2
Make tests compatible with PHP 5.2
This commit is contained in:
commit
818fba7a16
@ -36,7 +36,7 @@ if (ini_get('phar.readonly')) {
|
||||
$pharName = 'PHPExcel.phar';
|
||||
|
||||
// target folder
|
||||
$sourceDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Classes' . DIRECTORY_SEPARATOR;
|
||||
$sourceDir = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Classes' . DIRECTORY_SEPARATOR;
|
||||
|
||||
// default meta information
|
||||
$metaData = array(
|
||||
|
@ -48,7 +48,7 @@ $inputFileNames = 'templates/32readwrite*[0-9].xlsx';
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
$inputFileNames = array();
|
||||
for($i = 1; $i < $argc; ++$i) {
|
||||
$inputFileNames[] = __DIR__ . '/templates/' . $argv[$i];
|
||||
$inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
|
||||
}
|
||||
} else {
|
||||
$inputFileNames = glob($inputFileNames);
|
||||
|
@ -68,7 +68,7 @@ $inputFileNames = 'templates/32readwrite*[0-9].xlsx';
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
$inputFileNames = array();
|
||||
for($i = 1; $i < $argc; ++$i) {
|
||||
$inputFileNames[] = __DIR__ . '/templates/' . $argv[$i];
|
||||
$inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
|
||||
}
|
||||
} else {
|
||||
$inputFileNames = glob($inputFileNames);
|
||||
|
@ -68,7 +68,7 @@ $inputFileNames = 'templates/36write*.xlsx';
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
$inputFileNames = array();
|
||||
for($i = 1; $i < $argc; ++$i) {
|
||||
$inputFileNames[] = __DIR__ . '/templates/' . $argv[$i];
|
||||
$inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
|
||||
}
|
||||
} else {
|
||||
$inputFileNames = glob($inputFileNames);
|
||||
|
@ -91,7 +91,7 @@ $inputFileNames = 'templates/36write*.xlsx';
|
||||
if ((isset($argc)) && ($argc > 1)) {
|
||||
$inputFileNames = array();
|
||||
for($i = 1; $i < $argc; ++$i) {
|
||||
$inputFileNames[] = __DIR__ . '/templates/' . $argv[$i];
|
||||
$inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
|
||||
}
|
||||
} else {
|
||||
$inputFileNames = glob($inputFileNames);
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
include_once __DIR__.'/Complex.php';
|
||||
include_once dirname(__FILE__).'/Complex.php';
|
||||
|
||||
|
||||
class complexAssert {
|
||||
|
@ -57,7 +57,7 @@ class testDataFileIterator implements Iterator
|
||||
list($testData) = explode('//',$testDataRow);
|
||||
|
||||
// Split data into an array of individual values and a result
|
||||
$dataSet = str_getcsv($testData,',',"'");
|
||||
$dataSet = $this->_getcsv($testData, ',', "'");
|
||||
foreach($dataSet as &$dataValue) {
|
||||
$dataValue = $this->_parseDataValue($dataValue);
|
||||
}
|
||||
@ -66,6 +66,25 @@ class testDataFileIterator implements Iterator
|
||||
return $dataSet;
|
||||
}
|
||||
|
||||
private function _getcsv($input, $delimiter, $enclosure)
|
||||
{
|
||||
if (function_exists('str_getcsv')) {
|
||||
return str_getcsv($input, $delimiter, $enclosure);
|
||||
}
|
||||
|
||||
$temp = fopen('php://memory', 'rw');
|
||||
fwrite($temp, $input);
|
||||
rewind($temp);
|
||||
$data = fgetcsv($temp, strlen($input), $delimiter, $enclosure);
|
||||
fclose($temp);
|
||||
|
||||
if ($data === false) {
|
||||
$data = array(null);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function _parseDataValue($dataValue) {
|
||||
// discard any white space
|
||||
$dataValue = trim($dataValue);
|
||||
|
Loading…
Reference in New Issue
Block a user