#401 : PHPUnit Fixes (Calculation > LookupRef)
This commit is contained in:
parent
6faed3bd58
commit
36a9068b38
|
@ -768,7 +768,7 @@ class LookupRef
|
||||||
} else {
|
} else {
|
||||||
$f = array_keys($lookup_array);
|
$f = array_keys($lookup_array);
|
||||||
$firstRow = array_pop($f);
|
$firstRow = array_pop($f);
|
||||||
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
if ((!is_array($lookup_array[$firstRow])) || ($index_number - 1 > count($lookup_array[$firstRow]))) {
|
||||||
return Functions::REF();
|
return Functions::REF();
|
||||||
} else {
|
} else {
|
||||||
$columnKeys = array_keys($lookup_array[$firstRow]);
|
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||||
|
@ -781,7 +781,6 @@ class LookupRef
|
||||||
if (!$not_exact_match) {
|
if (!$not_exact_match) {
|
||||||
$firstRowH = asort($lookup_array[$firstColumn]);
|
$firstRowH = asort($lookup_array[$firstColumn]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rowNumber = $rowValue = false;
|
$rowNumber = $rowValue = false;
|
||||||
foreach ($lookup_array[$firstColumn] as $rowKey => $rowData) {
|
foreach ($lookup_array[$firstColumn] as $rowKey => $rowData) {
|
||||||
if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
|
if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
|
||||||
|
|
|
@ -4,6 +4,10 @@ namespace PHPExcel\Calculation;
|
||||||
|
|
||||||
require_once 'testDataFileIterator.php';
|
require_once 'testDataFileIterator.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LookupRefTest
|
||||||
|
* @package PHPExcel\Calculation
|
||||||
|
*/
|
||||||
class LookupRefTest extends \PHPUnit_Framework_TestCase
|
class LookupRefTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
1, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 2, FALSE, 2.17
|
1, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 2, FALSE, "#N/A"
|
||||||
1, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 3, TRUE, 100
|
1, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 3, TRUE, 100
|
||||||
.7, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 3, FALSE, "#N/A"
|
.7, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 3, FALSE, "#N/A"
|
||||||
0.1, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 2, TRUE, "#N/A"
|
0.1, {"Density"|"Viscosity"|"Temperature";0.457|3.55|500;0.525|3.25|400;0.616|2.93|300;0.675|2.75|250;0.746|2.57|200;0.835|2.38|150;0.946|2.17|100;1.09|1.95|50;1.29|1.71|0}, 2, TRUE, "#N/A"
|
||||||
|
|
Loading…
Reference in New Issue