Merge branch 'develop' into feature/gh-7
# Conflicts: # tests/PhpSpreadsheet/Shared/DateTest.php
This commit is contained in:
commit
aa97bb3e45
|
@ -1,6 +1,8 @@
|
||||||
build/PHPExcel.phar
|
/build/PHPExcel.phar
|
||||||
tests/codeCoverage
|
/tests/codeCoverage
|
||||||
analysis
|
/analysis
|
||||||
|
/vendor/
|
||||||
|
/composer.lock
|
||||||
|
|
||||||
## IDE support
|
## IDE support
|
||||||
*.buildpath
|
*.buildpath
|
||||||
|
|
54
README.md
54
README.md
|
@ -1,35 +1,39 @@
|
||||||
# PHPSpreadsheet - OpenXML - Read, Write and Create spreadsheet documents in PHP - Spreadsheet engine
|
# PhpSpreadsheet - OpenXML - Read, Write and Create spreadsheet documents in PHP - Spreadsheet engine
|
||||||
PHPSpreadsheet is a library written in pure PHP and providing a set of classes that allow you to write to and read from different spreadsheet file formats, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP.
|
|
||||||
|
|
||||||
Master: [![Build Status](https://travis-ci.org/PHPOffice/PhpSpreadsheet.png?branch=master)](http://travis-ci.org/PHPOffice/PhpSpreadsheet)
|
|
||||||
|
|
||||||
Develop: [![Build Status](https://travis-ci.org/PHPOffice/PhpSpreadsheet.png?branch=develop)](http://travis-ci.org/PHPOffice/PhpSpreadsheet)
|
|
||||||
|
|
||||||
|
Master:
|
||||||
|
[![Build Status](https://travis-ci.org/PHPOffice/PhpSpreadsheet.svg?branch=master)](https://travis-ci.org/PHPOffice/PhpSpreadsheet)
|
||||||
|
[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=master)
|
||||||
|
[![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=master)
|
||||||
|
[![Total Downloads](https://poser.pugx.org/phpoffice/phpspreadsheet/downloads.png)](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
||||||
|
[![Latest Stable Version](https://poser.pugx.org/phpoffice/phpspreadsheet/v/stable.png)](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
||||||
|
[![License](https://poser.pugx.org/phpoffice/phpspreadsheet/license.png)](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
||||||
[![Join the chat at https://gitter.im/PHPOffice/PhpSpreadsheet](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PhpSpreadsheet)
|
[![Join the chat at https://gitter.im/PHPOffice/PhpSpreadsheet](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PhpSpreadsheet)
|
||||||
|
|
||||||
|
Develop:
|
||||||
|
[![Build Status](https://travis-ci.org/PHPOffice/PhpSpreadsheet.png?branch=develop)](http://travis-ci.org/PHPOffice/PhpSpreadsheet)
|
||||||
|
[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=develop)
|
||||||
|
[![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=develop)
|
||||||
|
|
||||||
|
PhpSpreadsheet is a library written in pure PHP and providing a set of classes that allow you to write to and read from different spreadsheet file formats, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP.
|
||||||
|
|
||||||
## File Formats supported
|
## File Formats supported
|
||||||
|
|
||||||
### Reading
|
|Format |Reading|Writing|
|
||||||
* BIFF 5-8 (.xls) Excel 95 and above
|
|--------------------------------------------|:-----:|:-----:|
|
||||||
* Office Open XML (.xlsx) Excel 2007 and above
|
|Open Document Format/OASIS (.ods) | ✓ | ✓ |
|
||||||
* SpreadsheetML (.xml) Excel 2003
|
|Office Open XML (.xlsx) Excel 2007 and above| ✓ | ✓ |
|
||||||
* Open Document Format/OASIS (.ods)
|
|BIFF 8 (.xls) Excel 97 and above | ✓ | ✓ |
|
||||||
* Gnumeric
|
|BIFF 5 (.xls) Excel 95 | ✓ | |
|
||||||
* HTML
|
|SpreadsheetML (.xml) Excel 2003 | ✓ | |
|
||||||
* SYLK
|
|Gnumeric | ✓ | |
|
||||||
* CSV
|
|HTML | ✓ | ✓ |
|
||||||
|
|SYLK | ✓ | |
|
||||||
### Writing
|
|CSV | ✓ | ✓ |
|
||||||
* BIFF 8 (.xls) Excel 95 and above
|
|PDF (using either the tcPDF, DomPDF or mPDF libraries, which need to be installed separately)| | ✓ |
|
||||||
* Office Open XML (.xlsx) Excel 2007 and above
|
|
||||||
* HTML
|
|
||||||
* CSV
|
|
||||||
* PDF (using either the tcPDF, DomPDF or mPDF libraries, which need to be installed separately)
|
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
* PHP version 5.5.0 or higher
|
* PHP version 5.5.0 or higher
|
||||||
* PHP extension php_zip enabled (required if you need PHPSpreadsheet to handle .xlsx .ods or .gnumeric files)
|
* PHP extension php_zip enabled (required if you need PhpSpreadsheet to handle .xlsx .ods or .gnumeric files)
|
||||||
* PHP extension php_xml enabled
|
* PHP extension php_xml enabled
|
||||||
* PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
|
* PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
|
||||||
|
|
||||||
|
@ -46,4 +50,4 @@ If you would like to contribute, here are some notes and guidlines:
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
PHPSpreadsheet is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/license.md)
|
PhpSpreadsheet is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/license.md)
|
||||||
|
|
|
@ -86,15 +86,15 @@ class Chart extends WriterPart
|
||||||
|
|
||||||
$objWriter->startElement('c:chart');
|
$objWriter->startElement('c:chart');
|
||||||
|
|
||||||
$this->writeTitle($pChart->getTitle(), $objWriter);
|
$this->writeTitle($objWriter, $pChart->getTitle());
|
||||||
|
|
||||||
$objWriter->startElement('c:autoTitleDeleted');
|
$objWriter->startElement('c:autoTitleDeleted');
|
||||||
$objWriter->writeAttribute('val', 0);
|
$objWriter->writeAttribute('val', 0);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
$this->writePlotArea($pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $objWriter, $pChart->getWorksheet(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines());
|
$this->writePlotArea($objWriter, $pChart->getWorksheet(), $pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines());
|
||||||
|
|
||||||
$this->writeLegend($pChart->getLegend(), $objWriter);
|
$this->writeLegend($objWriter, $pChart->getLegend());
|
||||||
|
|
||||||
$objWriter->startElement('c:plotVisOnly');
|
$objWriter->startElement('c:plotVisOnly');
|
||||||
$objWriter->writeAttribute('val', 1);
|
$objWriter->writeAttribute('val', 1);
|
||||||
|
@ -121,12 +121,12 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Chart Title
|
* Write Chart Title
|
||||||
*
|
*
|
||||||
* @param Title $title
|
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
|
* @param Title $title
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeTitle(Title $title=null, $objWriter)
|
private function writeTitle(\PHPExcel\Shared\XMLWriter $objWriter, Title $title = null)
|
||||||
{
|
{
|
||||||
if (is_null($title)) {
|
if (is_null($title)) {
|
||||||
return;
|
return;
|
||||||
|
@ -154,7 +154,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
$this->writeLayout($title->getLayout(), $objWriter);
|
$this->writeLayout($objWriter, $title->getLayout());
|
||||||
|
|
||||||
$objWriter->startElement('c:overlay');
|
$objWriter->startElement('c:overlay');
|
||||||
$objWriter->writeAttribute('val', 0);
|
$objWriter->writeAttribute('val', 0);
|
||||||
|
@ -166,12 +166,12 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Chart Legend
|
* Write Chart Legend
|
||||||
*
|
*
|
||||||
* @param Legend $legend
|
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
|
* @param Legend $legend
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeLegend(Legend $legend=null, $objWriter)
|
private function writeLegend(\PHPExcel\Shared\XMLWriter $objWriter, Legend $legend = null)
|
||||||
{
|
{
|
||||||
if (is_null($legend)) {
|
if (is_null($legend)) {
|
||||||
return;
|
return;
|
||||||
|
@ -183,7 +183,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->writeAttribute('val', $legend->getPosition());
|
$objWriter->writeAttribute('val', $legend->getPosition());
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
$this->writeLayout($legend->getLayout(), $objWriter);
|
$this->writeLayout($objWriter, $legend->getLayout());
|
||||||
|
|
||||||
$objWriter->startElement('c:overlay');
|
$objWriter->startElement('c:overlay');
|
||||||
$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
|
$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
|
||||||
|
@ -217,16 +217,17 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Chart Plot Area
|
* Write Chart Plot Area
|
||||||
*
|
*
|
||||||
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
|
* @param \PHPExcel\Worksheet $pSheet
|
||||||
* @param PlotArea $plotArea
|
* @param PlotArea $plotArea
|
||||||
* @param Title $xAxisLabel
|
* @param Title $xAxisLabel
|
||||||
* @param Title $yAxisLabel
|
* @param Title $yAxisLabel
|
||||||
* @param Axis $xAxis
|
* @param Axis $xAxis
|
||||||
* @param Axis $yAxis
|
* @param Axis $yAxis
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writePlotArea(PlotArea $plotArea, Title $xAxisLabel=null, Title $yAxisLabel=null, $objWriter, \PHPExcel\Worksheet $pSheet, Axis $xAxis=null, Axis $yAxis=null, GridLines $majorGridlines=null, GridLines $minorGridlines=null)
|
private function writePlotArea(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\Worksheet $pSheet, PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null)
|
||||||
{
|
{
|
||||||
if (is_null($plotArea)) {
|
if (is_null($plotArea)) {
|
||||||
return;
|
return;
|
||||||
|
@ -238,7 +239,7 @@ class Chart extends WriterPart
|
||||||
|
|
||||||
$layout = $plotArea->getLayout();
|
$layout = $plotArea->getLayout();
|
||||||
|
|
||||||
$this->writeLayout($layout, $objWriter);
|
$this->writeLayout($objWriter, $layout);
|
||||||
|
|
||||||
$chartTypes = self::getChartType($plotArea);
|
$chartTypes = self::getChartType($plotArea);
|
||||||
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
|
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
|
||||||
|
@ -361,7 +362,7 @@ class Chart extends WriterPart
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeDataLabels($objWriter, Layout $chartLayout=null)
|
private function writeDataLabels($objWriter, Layout $chartLayout = null)
|
||||||
{
|
{
|
||||||
$objWriter->startElement('c:dLbls');
|
$objWriter->startElement('c:dLbls');
|
||||||
|
|
||||||
|
@ -469,7 +470,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
$layout = $xAxisLabel->getLayout();
|
$layout = $xAxisLabel->getLayout();
|
||||||
$this->writeLayout($layout, $objWriter);
|
$this->writeLayout($objWriter, $layout);
|
||||||
|
|
||||||
$objWriter->startElement('c:overlay');
|
$objWriter->startElement('c:overlay');
|
||||||
$objWriter->writeAttribute('val', 0);
|
$objWriter->writeAttribute('val', 0);
|
||||||
|
@ -820,7 +821,7 @@ class Chart extends WriterPart
|
||||||
|
|
||||||
if ($groupType !== DataSeries::TYPE_BUBBLECHART) {
|
if ($groupType !== DataSeries::TYPE_BUBBLECHART) {
|
||||||
$layout = $yAxisLabel->getLayout();
|
$layout = $yAxisLabel->getLayout();
|
||||||
$this->writeLayout($layout, $objWriter);
|
$this->writeLayout($objWriter, $layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->startElement('c:overlay');
|
$objWriter->startElement('c:overlay');
|
||||||
|
@ -1399,12 +1400,12 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Layout
|
* Write Layout
|
||||||
*
|
*
|
||||||
* @param Layout $layout
|
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
|
* @param Layout $layout
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeLayout(Layout $layout=null, $objWriter)
|
private function writeLayout(\PHPExcel\Shared\XMLWriter $objWriter, Layout $layout = null)
|
||||||
{
|
{
|
||||||
$objWriter->startElement('c:layout');
|
$objWriter->startElement('c:layout');
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DATE'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'DATE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DATEVALUE'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'DATEVALUE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'YEAR'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'YEAR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'MONTHOFYEAR'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'MONTHOFYEAR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,9 +147,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testWEEKNUM()
|
public function testWEEKNUM()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'WEEKOFYEAR'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'WEEKOFYEAR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,9 +166,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testWEEKDAY()
|
public function testWEEKDAY()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DAYOFWEEK'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'DAYOFWEEK'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +186,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DAYOFMONTH'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'DAYOFMONTH'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +202,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'TIME'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'TIME'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,6 +213,8 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testTIMEtoPHP()
|
public function testTIMEtoPHP()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC);
|
Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC);
|
||||||
$result = DateTime::TIME(7, 30, 20);
|
$result = DateTime::TIME(7, 30, 20);
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
|
@ -235,7 +241,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'TIMEVALUE'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'TIMEVALUE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +252,8 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testTIMEVALUEtoPHP()
|
public function testTIMEVALUEtoPHP()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC);
|
Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC);
|
||||||
$result = DateTime::TIMEVALUE('7:30:20');
|
$result = DateTime::TIMEVALUE('7:30:20');
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
|
@ -272,7 +280,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'HOUROFDAY'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'HOUROFDAY'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,9 +294,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testMINUTE()
|
public function testMINUTE()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'MINUTEOFHOUR'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'MINUTEOFHOUR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,9 +312,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testSECOND()
|
public function testSECOND()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'SECONDOFMINUTE'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'SECONDOFMINUTE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +332,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'NETWORKDAYS'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'NETWORKDAYS'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +348,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'WORKDAY'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'WORKDAY'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +364,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'EDATE'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'EDATE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +401,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'EOMONTH'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'EOMONTH'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,9 +437,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDATEDIF()
|
public function testDATEDIF()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DATEDIF'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'DATEDIF'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +457,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DAYS360'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'DAYS360'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,9 +472,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testYEARFRAC()
|
public function testYEARFRAC()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'YEARFRAC'), $args);
|
$result = call_user_func_array(array(DateTime::class, 'YEARFRAC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Calculation;
|
namespace PhpSpreadsheet\Tests\Calculation;
|
||||||
|
|
||||||
|
use PHPExcel\Calculation\Engineering;
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
|
||||||
class EngineeringTest extends \PHPUnit_Framework_TestCase
|
class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -13,7 +16,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->complexAssert = new \PhpSpreadsheet\Tests\Custom\ComplexAssert();
|
$this->complexAssert = new \PhpSpreadsheet\Tests\Custom\ComplexAssert();
|
||||||
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
|
@ -28,7 +31,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELI'), $args);
|
$result = call_user_func_array(array(Engineering::class,'BESSELI'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +47,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELJ'), $args);
|
$result = call_user_func_array(array(Engineering::class,'BESSELJ'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +63,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELK'), $args);
|
$result = call_user_func_array(array(Engineering::class,'BESSELK'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +79,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELY'), $args);
|
$result = call_user_func_array(array(Engineering::class,'BESSELY'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +95,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','COMPLEX'), $args);
|
$result = call_user_func_array(array(Engineering::class,'COMPLEX'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +111,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMAGINARY'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMAGINARY'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +127,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMREAL'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMREAL'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +143,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMABS'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMABS'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +160,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMARGUMENT'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMARGUMENT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +176,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMCONJUGATE'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMCONJUGATE'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +192,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMCOS'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMCOS'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,9 +207,11 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testIMDIV()
|
public function testIMDIV()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMDIV'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMDIV'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +227,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMEXP'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMEXP'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +243,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLN'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMLN'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +259,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLOG2'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMLOG2'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +275,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLOG10'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMLOG10'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,9 +290,11 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testIMPOWER()
|
public function testIMPOWER()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMPOWER'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMPOWER'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +310,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMPRODUCT'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMPRODUCT'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +326,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSIN'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMSIN'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +342,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSQRT'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMSQRT'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,9 +357,11 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testIMSUB()
|
public function testIMSUB()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSUB'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMSUB'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +378,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSUM'), $args);
|
$result = call_user_func_array(array(Engineering::class,'IMSUM'), $args);
|
||||||
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
$this->assertTrue($this->complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $this->complexAssert->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +394,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','ERF'), $args);
|
$result = call_user_func_array(array(Engineering::class,'ERF'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +410,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','ERFC'), $args);
|
$result = call_user_func_array(array(Engineering::class,'ERFC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +426,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BINTODEC'), $args);
|
$result = call_user_func_array(array(Engineering::class,'BINTODEC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,7 +442,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BINTOHEX'), $args);
|
$result = call_user_func_array(array(Engineering::class,'BINTOHEX'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +458,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BINTOOCT'), $args);
|
$result = call_user_func_array(array(Engineering::class,'BINTOOCT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +474,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DECTOBIN'), $args);
|
$result = call_user_func_array(array(Engineering::class,'DECTOBIN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +490,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DECTOHEX'), $args);
|
$result = call_user_func_array(array(Engineering::class,'DECTOHEX'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +506,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DECTOOCT'), $args);
|
$result = call_user_func_array(array(Engineering::class,'DECTOOCT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +522,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','HEXTOBIN'), $args);
|
$result = call_user_func_array(array(Engineering::class,'HEXTOBIN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +538,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','HEXTODEC'), $args);
|
$result = call_user_func_array(array(Engineering::class,'HEXTODEC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +554,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','HEXTOOCT'), $args);
|
$result = call_user_func_array(array(Engineering::class,'HEXTOOCT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +570,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','OCTTOBIN'), $args);
|
$result = call_user_func_array(array(Engineering::class,'OCTTOBIN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +586,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','OCTTODEC'), $args);
|
$result = call_user_func_array(array(Engineering::class,'OCTTODEC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +602,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','OCTTOHEX'), $args);
|
$result = call_user_func_array(array(Engineering::class,'OCTTOHEX'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +618,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DELTA'), $args);
|
$result = call_user_func_array(array(Engineering::class,'DELTA'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +634,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','GESTEP'), $args);
|
$result = call_user_func_array(array(Engineering::class,'GESTEP'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,25 +645,25 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testGetConversionGroups()
|
public function testGetConversionGroups()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Engineering::getConversionGroups();
|
$result = Engineering::getConversionGroups();
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetConversionGroupUnits()
|
public function testGetConversionGroupUnits()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Engineering::getConversionGroupUnits();
|
$result = Engineering::getConversionGroupUnits();
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetConversionGroupUnitDetails()
|
public function testGetConversionGroupUnitDetails()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Engineering::getConversionGroupUnitDetails();
|
$result = Engineering::getConversionGroupUnitDetails();
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetConversionMultipliers()
|
public function testGetConversionMultipliers()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Engineering::getConversionMultipliers();
|
$result = Engineering::getConversionMultipliers();
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +674,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','CONVERTUOM'), $args);
|
$result = call_user_func_array(array(Engineering::class,'CONVERTUOM'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null);
|
$this->assertEquals($expectedResult, $result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Calculation;
|
namespace PhpSpreadsheet\Tests\Calculation;
|
||||||
|
|
||||||
|
use PHPExcel\Calculation\Financial;
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
|
||||||
class FinancialTest extends \PHPUnit_Framework_TestCase
|
class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +21,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','ACCRINT'), $args);
|
$result = call_user_func_array(array(Financial::class,'ACCRINT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +37,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','ACCRINTM'), $args);
|
$result = call_user_func_array(array(Financial::class,'ACCRINTM'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +53,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','AMORDEGRC'), $args);
|
$result = call_user_func_array(array(Financial::class,'AMORDEGRC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +69,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','AMORLINC'), $args);
|
$result = call_user_func_array(array(Financial::class,'AMORLINC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +85,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPDAYBS'), $args);
|
$result = call_user_func_array(array(Financial::class,'COUPDAYBS'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +101,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPDAYS'), $args);
|
$result = call_user_func_array(array(Financial::class,'COUPDAYS'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +117,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPDAYSNC'), $args);
|
$result = call_user_func_array(array(Financial::class,'COUPDAYSNC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +133,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPNCD'), $args);
|
$result = call_user_func_array(array(Financial::class,'COUPNCD'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +149,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPNUM'), $args);
|
$result = call_user_func_array(array(Financial::class,'COUPNUM'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +165,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPPCD'), $args);
|
$result = call_user_func_array(array(Financial::class,'COUPPCD'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +181,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','CUMIPMT'), $args);
|
$result = call_user_func_array(array(Financial::class,'CUMIPMT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +197,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','CUMPRINC'), $args);
|
$result = call_user_func_array(array(Financial::class,'CUMPRINC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +213,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DB'), $args);
|
$result = call_user_func_array(array(Financial::class,'DB'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +229,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DDB'), $args);
|
$result = call_user_func_array(array(Financial::class,'DDB'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +245,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DISC'), $args);
|
$result = call_user_func_array(array(Financial::class,'DISC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +261,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DOLLARDE'), $args);
|
$result = call_user_func_array(array(Financial::class,'DOLLARDE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +277,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DOLLARFR'), $args);
|
$result = call_user_func_array(array(Financial::class,'DOLLARFR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +293,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','EFFECT'), $args);
|
$result = call_user_func_array(array(Financial::class,'EFFECT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +309,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','FV'), $args);
|
$result = call_user_func_array(array(Financial::class,'FV'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +325,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','FVSCHEDULE'), $args);
|
$result = call_user_func_array(array(Financial::class,'FVSCHEDULE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +341,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','INTRATE'), $args);
|
$result = call_user_func_array(array(Financial::class,'INTRATE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +357,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','IPMT'), $args);
|
$result = call_user_func_array(array(Financial::class,'IPMT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +373,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','IRR'), $args);
|
$result = call_user_func_array(array(Financial::class,'IRR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +389,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','ISPMT'), $args);
|
$result = call_user_func_array(array(Financial::class,'ISPMT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +405,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','MIRR'), $args);
|
$result = call_user_func_array(array(Financial::class,'MIRR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +421,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','NOMINAL'), $args);
|
$result = call_user_func_array(array(Financial::class,'NOMINAL'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +437,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','NPER'), $args);
|
$result = call_user_func_array(array(Financial::class,'NPER'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +453,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','NPV'), $args);
|
$result = call_user_func_array(array(Financial::class,'NPV'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,9 +468,11 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testPRICE()
|
public function testPRICE()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','PRICE'), $args);
|
$result = call_user_func_array(array(Financial::class,'PRICE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,9 +487,11 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testRATE()
|
public function testRATE()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','RATE'), $args);
|
$result = call_user_func_array(array(Financial::class,'RATE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,9 +506,11 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testXIRR()
|
public function testXIRR()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Financial','XIRR'), $args);
|
$result = call_user_func_array(array(Financial::class,'XIRR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,59 +2,61 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Calculation;
|
namespace PhpSpreadsheet\Tests\Calculation;
|
||||||
|
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
|
||||||
class FunctionsTest extends \PHPUnit_Framework_TestCase
|
class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDUMMY()
|
public function testDUMMY()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::DUMMY();
|
$result = Functions::DUMMY();
|
||||||
$this->assertEquals('#Not Yet Implemented', $result);
|
$this->assertEquals('#Not Yet Implemented', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDIV0()
|
public function testDIV0()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::DIV0();
|
$result = Functions::DIV0();
|
||||||
$this->assertEquals('#DIV/0!', $result);
|
$this->assertEquals('#DIV/0!', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNA()
|
public function testNA()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::NA();
|
$result = Functions::NA();
|
||||||
$this->assertEquals('#N/A', $result);
|
$this->assertEquals('#N/A', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNAN()
|
public function testNAN()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::NAN();
|
$result = Functions::NAN();
|
||||||
$this->assertEquals('#NUM!', $result);
|
$this->assertEquals('#NUM!', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNAME()
|
public function testNAME()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::NAME();
|
$result = Functions::NAME();
|
||||||
$this->assertEquals('#NAME?', $result);
|
$this->assertEquals('#NAME?', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testREF()
|
public function testREF()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::REF();
|
$result = Functions::REF();
|
||||||
$this->assertEquals('#REF!', $result);
|
$this->assertEquals('#REF!', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNULL()
|
public function testNULL()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::null();
|
$result = Functions::null();
|
||||||
$this->assertEquals('#NULL!', $result);
|
$this->assertEquals('#NULL!', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testVALUE()
|
public function testVALUE()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Functions::VALUE();
|
$result = Functions::VALUE();
|
||||||
$this->assertEquals('#VALUE!', $result);
|
$this->assertEquals('#VALUE!', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isBlank'), $args);
|
$result = call_user_func_array(array(Functions::class,'isBlank'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isErr'), $args);
|
$result = call_user_func_array(array(Functions::class,'isErr'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +99,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isError'), $args);
|
$result = call_user_func_array(array(Functions::class,'isError'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +115,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','errorType'), $args);
|
$result = call_user_func_array(array(Functions::class,'errorType'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +131,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isLogical'), $args);
|
$result = call_user_func_array(array(Functions::class,'isLogical'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +147,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isNa'), $args);
|
$result = call_user_func_array(array(Functions::class,'isNa'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +163,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isNumber'), $args);
|
$result = call_user_func_array(array(Functions::class,'isNumber'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +179,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isText'), $args);
|
$result = call_user_func_array(array(Functions::class,'isText'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +195,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isNonText'), $args);
|
$result = call_user_func_array(array(Functions::class,'isNonText'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +211,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isEven'), $args);
|
$result = call_user_func_array(array(Functions::class,'isEven'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +227,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','isOdd'), $args);
|
$result = call_user_func_array(array(Functions::class,'isOdd'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +243,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','TYPE'), $args);
|
$result = call_user_func_array(array(Functions::class,'TYPE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +259,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Functions','n'), $args);
|
$result = call_user_func_array(array(Functions::class,'n'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,23 +2,26 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Calculation;
|
namespace PhpSpreadsheet\Tests\Calculation;
|
||||||
|
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
use PHPExcel\Calculation\Logical;
|
||||||
|
|
||||||
class LogicalTest extends \PHPUnit_Framework_TestCase
|
class LogicalTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTRUE()
|
public function testTRUE()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Logical::TRUE();
|
$result = Logical::TRUE();
|
||||||
$this->assertEquals(true, $result);
|
$this->assertEquals(true, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFALSE()
|
public function testFALSE()
|
||||||
{
|
{
|
||||||
$result = \PHPExcel\Calculation\Logical::FALSE();
|
$result = Logical::FALSE();
|
||||||
$this->assertEquals(false, $result);
|
$this->assertEquals(false, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +32,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','logicalAnd'), $args);
|
$result = call_user_func_array(array(Logical::class,'logicalAnd'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +48,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','logicalOr'), $args);
|
$result = call_user_func_array(array(Logical::class,'logicalOr'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +64,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','NOT'), $args);
|
$result = call_user_func_array(array(Logical::class,'NOT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +80,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','statementIf'), $args);
|
$result = call_user_func_array(array(Logical::class,'statementIf'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +96,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\Logical','IFERROR'), $args);
|
$result = call_user_func_array(array(Logical::class,'IFERROR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Calculation;
|
namespace PhpSpreadsheet\Tests\Calculation;
|
||||||
|
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
use PHPExcel\Calculation\LookupRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LookupRefTest
|
* Class LookupRefTest
|
||||||
* @package PHPExcel\Calculation
|
* @package PHPExcel\Calculation
|
||||||
|
@ -11,7 +14,7 @@ class LookupRefTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +25,7 @@ class LookupRefTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\LookupRef','HLOOKUP'), $args);
|
$result = call_user_func_array(array(LookupRef::class,'HLOOKUP'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +42,7 @@ class LookupRefTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\LookupRef','VLOOKUP'), $args);
|
$result = call_user_func_array(array(LookupRef::class,'VLOOKUP'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Calculation;
|
namespace PhpSpreadsheet\Tests\Calculation;
|
||||||
|
|
||||||
|
use PHPExcel\Calculation;
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
use PHPExcel\Calculation\MathTrig;
|
||||||
|
|
||||||
class MathTrigTest extends \PHPUnit_Framework_TestCase
|
class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +21,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ATAN2'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'ATAN2'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +37,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','CEILING'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'CEILING'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +53,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','COMBIN'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'COMBIN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +69,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','EVEN'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'EVEN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +85,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ODD'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'ODD'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +101,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','FACT'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'FACT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +117,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','FACTDOUBLE'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'FACTDOUBLE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +133,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','FLOOR'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'FLOOR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +149,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','GCD'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'GCD'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +165,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','LCM'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'LCM'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +181,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','INT'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'INT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +197,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SIGN'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'SIGN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +213,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','POWER'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'POWER'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +229,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','logBase'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'logBase'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +245,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MOD'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'MOD'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,9 +260,11 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testMDETERM()
|
public function testMDETERM()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MDETERM'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'MDETERM'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,9 +279,11 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testMINVERSE()
|
public function testMINVERSE()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MINVERSE'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'MINVERSE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,9 +298,11 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testMMULT()
|
public function testMMULT()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MMULT'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'MMULT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +318,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MULTINOMIAL'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'MULTINOMIAL'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,9 +334,9 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
\PHPExcel\Calculation::setArrayReturnType(\PHPExcel\Calculation::RETURN_ARRAY_AS_VALUE);
|
Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MROUND'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'MROUND'), $args);
|
||||||
\PHPExcel\Calculation::setArrayReturnType(\PHPExcel\Calculation::RETURN_ARRAY_AS_ARRAY);
|
Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_ARRAY);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +352,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','PRODUCT'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'PRODUCT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +368,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','QUOTIENT'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'QUOTIENT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +384,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ROUNDUP'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'ROUNDUP'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +400,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ROUNDDOWN'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'ROUNDDOWN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +416,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SERIESSUM'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'SERIESSUM'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +432,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SUMSQ'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'SUMSQ'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +448,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','TRUNC'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'TRUNC'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +464,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ROMAN'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'ROMAN'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +480,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SQRTPI'), $args);
|
$result = call_user_func_array(array(MathTrig::class,'SQRTPI'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +496,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig', 'SUMIF'), $args);
|
$result = call_user_func_array(array(MathTrig::class, 'SUMIF'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
$this->assertEquals($expectedResult, $result, null, 1E-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Calculation;
|
namespace PhpSpreadsheet\Tests\Calculation;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\StringHelper;
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
use PHPExcel\Calculation\TextData;
|
||||||
|
|
||||||
class TextDataTest extends \PHPUnit_Framework_TestCase
|
class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +21,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','CHARACTER'), $args);
|
$result = call_user_func_array(array(TextData::class,'CHARACTER'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +37,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','ASCIICODE'), $args);
|
$result = call_user_func_array(array(TextData::class,'ASCIICODE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +53,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','CONCATENATE'), $args);
|
$result = call_user_func_array(array(TextData::class,'CONCATENATE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +69,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','LEFT'), $args);
|
$result = call_user_func_array(array(TextData::class,'LEFT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +85,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','MID'), $args);
|
$result = call_user_func_array(array(TextData::class,'MID'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +101,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','RIGHT'), $args);
|
$result = call_user_func_array(array(TextData::class,'RIGHT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +117,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','LOWERCASE'), $args);
|
$result = call_user_func_array(array(TextData::class,'LOWERCASE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +133,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','UPPERCASE'), $args);
|
$result = call_user_func_array(array(TextData::class,'UPPERCASE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +149,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','PROPERCASE'), $args);
|
$result = call_user_func_array(array(TextData::class,'PROPERCASE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +165,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','STRINGLENGTH'), $args);
|
$result = call_user_func_array(array(TextData::class,'STRINGLENGTH'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +181,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','SEARCHINSENSITIVE'), $args);
|
$result = call_user_func_array(array(TextData::class,'SEARCHINSENSITIVE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +197,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','SEARCHSENSITIVE'), $args);
|
$result = call_user_func_array(array(TextData::class,'SEARCHSENSITIVE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +213,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','REPLACE'), $args);
|
$result = call_user_func_array(array(TextData::class,'REPLACE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +229,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','SUBSTITUTE'), $args);
|
$result = call_user_func_array(array(TextData::class,'SUBSTITUTE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +245,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','TRIMSPACES'), $args);
|
$result = call_user_func_array(array(TextData::class,'TRIMSPACES'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +261,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','TRIMNONPRINTABLE'), $args);
|
$result = call_user_func_array(array(TextData::class,'TRIMNONPRINTABLE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +277,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','DOLLAR'), $args);
|
$result = call_user_func_array(array(TextData::class,'DOLLAR'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +293,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','FIXEDFORMAT'), $args);
|
$result = call_user_func_array(array(TextData::class,'FIXEDFORMAT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +309,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData','RETURNSTRING'), $args);
|
$result = call_user_func_array(array(TextData::class,'RETURNSTRING'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,13 +324,13 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testTEXT()
|
public function testTEXT()
|
||||||
{
|
{
|
||||||
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setDecimalSeparator'), '.');
|
call_user_func(array(StringHelper::class, 'setDecimalSeparator'), '.');
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setThousandsSeparator'), ',');
|
call_user_func(array(StringHelper::class, 'setThousandsSeparator'), ',');
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setCurrencyCode'), '$');
|
call_user_func(array(StringHelper::class, 'setCurrencyCode'), '$');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData', 'TEXTFORMAT'), $args);
|
$result = call_user_func_array(array(TextData::class, 'TEXTFORMAT'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,13 +344,13 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testVALUE()
|
public function testVALUE()
|
||||||
{
|
{
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setDecimalSeparator'), '.');
|
call_user_func(array(StringHelper::class, 'setDecimalSeparator'), '.');
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setThousandsSeparator'), ' ');
|
call_user_func(array(StringHelper::class, 'setThousandsSeparator'), ' ');
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setCurrencyCode'), '$');
|
call_user_func(array(StringHelper::class, 'setCurrencyCode'), '$');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Calculation\TextData', 'VALUE'), $args);
|
$result = call_user_func_array(array(TextData::class, 'VALUE'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
$this->assertEquals($expectedResult, $result, null, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPExcel;
|
namespace PhpSpreadsheet\Tests;
|
||||||
|
|
||||||
|
use PHPExcel\Calculation;
|
||||||
|
use PHPExcel\Calculation\Functions;
|
||||||
|
|
||||||
class CalculationTest extends \PHPUnit_Framework_TestCase
|
class CalculationTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,11 +17,11 @@ class CalculationTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice)
|
public function testBinaryComparisonOperation($formula, $expectedResultExcel, $expectedResultOpenOffice)
|
||||||
{
|
{
|
||||||
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_EXCEL);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
||||||
$resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula);
|
$resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula);
|
||||||
$this->assertEquals($expectedResultExcel, $resultExcel, 'should be Excel compatible');
|
$this->assertEquals($expectedResultExcel, $resultExcel, 'should be Excel compatible');
|
||||||
|
|
||||||
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_OPENOFFICE);
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
|
||||||
$resultOpenOffice = Calculation::getInstance()->_calculateFormulaValue($formula);
|
$resultOpenOffice = Calculation::getInstance()->_calculateFormulaValue($formula);
|
||||||
$this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, 'should be OpenOffice compatible');
|
$this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, 'should be OpenOffice compatible');
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Cell;
|
namespace PhpSpreadsheet\Tests\Cell;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
|
use PHPExcel\Style\NumberFormat;
|
||||||
|
use PHPExcel\Shared\StringHelper;
|
||||||
|
use PHPExcel\Cell;
|
||||||
|
use PHPExcel\Cell\AdvancedValueBinder;
|
||||||
|
use PHPExcel\Cell\DataType;
|
||||||
|
use PHPExcel\CachedObjectStorage\Memory;
|
||||||
|
|
||||||
class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
|
class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
|
@ -14,14 +22,14 @@ class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function provider()
|
public function provider()
|
||||||
{
|
{
|
||||||
if (!class_exists('\\PHPExcel\\Style\\NumberFormat')) {
|
if (!class_exists(NumberFormat::class)) {
|
||||||
$this->setUp();
|
$this->setUp();
|
||||||
}
|
}
|
||||||
$currencyUSD = \PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
$currencyUSD = NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
||||||
$currencyEURO = str_replace('$', '€', \PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
$currencyEURO = str_replace('$', '€', NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array('10%', 0.1, \PHPExcel\Style\NumberFormat::FORMAT_PERCENTAGE_00, ',', '.', '$'),
|
array('10%', 0.1, NumberFormat::FORMAT_PERCENTAGE_00, ',', '.', '$'),
|
||||||
array('$10.11', 10.11, $currencyUSD, ',', '.', '$'),
|
array('$10.11', 10.11, $currencyUSD, ',', '.', '$'),
|
||||||
array('$1,010.12', 1010.12, $currencyUSD, ',', '.', '$'),
|
array('$1,010.12', 1010.12, $currencyUSD, ',', '.', '$'),
|
||||||
array('$20,20', 20.2, $currencyUSD, '.', ',', '$'),
|
array('$20,20', 20.2, $currencyUSD, '.', ',', '$'),
|
||||||
|
@ -38,10 +46,10 @@ class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode)
|
public function testCurrency($value, $valueBinded, $format, $thousandsSeparator, $decimalSeparator, $currencyCode)
|
||||||
{
|
{
|
||||||
$sheet = $this->getMock(
|
$sheet = $this->getMock(
|
||||||
'\\PHPExcel\\Worksheet',
|
Worksheet::class,
|
||||||
array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
|
array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
|
||||||
);
|
);
|
||||||
$cache = $this->getMockBuilder('\\PHPExcel\\CachedObjectStorage\\Memory')
|
$cache = $this->getMockBuilder(Memory::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$cache->expects($this->any())
|
$cache->expects($this->any())
|
||||||
|
@ -62,13 +70,13 @@ class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
->method('getCellCacheController')
|
->method('getCellCacheController')
|
||||||
->will($this->returnValue($cache));
|
->will($this->returnValue($cache));
|
||||||
|
|
||||||
\PHPExcel\Shared\StringHelper::setCurrencyCode($currencyCode);
|
StringHelper::setCurrencyCode($currencyCode);
|
||||||
\PHPExcel\Shared\StringHelper::setDecimalSeparator($decimalSeparator);
|
StringHelper::setDecimalSeparator($decimalSeparator);
|
||||||
\PHPExcel\Shared\StringHelper::setThousandsSeparator($thousandsSeparator);
|
StringHelper::setThousandsSeparator($thousandsSeparator);
|
||||||
|
|
||||||
$cell = new \PHPExcel\Cell(null, \PHPExcel\Cell\DataType::TYPE_STRING, $sheet);
|
$cell = new Cell(null, DataType::TYPE_STRING, $sheet);
|
||||||
|
|
||||||
$binder = new \PHPExcel\Cell\AdvancedValueBinder();
|
$binder = new AdvancedValueBinder();
|
||||||
$binder->bindValue($cell, $value);
|
$binder->bindValue($cell, $value);
|
||||||
$this->assertEquals($valueBinded, $cell->getValue());
|
$this->assertEquals($valueBinded, $cell->getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Cell;
|
namespace PhpSpreadsheet\Tests\Cell;
|
||||||
|
|
||||||
|
use PHPExcel\Cell\DataType;
|
||||||
|
|
||||||
class DataTypeTest extends \PHPUnit_Framework_TestCase
|
class DataTypeTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -15,7 +17,7 @@ class DataTypeTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testGetErrorCodes()
|
public function testGetErrorCodes()
|
||||||
{
|
{
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell\\DataType','getErrorCodes'));
|
$result = call_user_func(array(DataType::class,'getErrorCodes'));
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
$this->assertGreaterThan(0, count($result));
|
$this->assertGreaterThan(0, count($result));
|
||||||
$this->assertArrayHasKey('#NULL!', $result);
|
$this->assertArrayHasKey('#NULL!', $result);
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Cell;
|
namespace PhpSpreadsheet\Tests\Cell;
|
||||||
|
|
||||||
|
use PHPExcel\Cell\DefaultValueBinder;
|
||||||
|
use PHPExcel\Cell;
|
||||||
|
use PHPExcel\RichText;
|
||||||
|
use PHPExcel\Cell\DataType;
|
||||||
|
|
||||||
class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
|
class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $cellStub;
|
protected $cellStub;
|
||||||
|
@ -17,7 +22,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
protected function createCellStub()
|
protected function createCellStub()
|
||||||
{
|
{
|
||||||
// Create a stub for the Cell class.
|
// Create a stub for the Cell class.
|
||||||
$this->cellStub = $this->getMockBuilder('\\PHPExcel\\Cell')
|
$this->cellStub = $this->getMockBuilder(Cell::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
// Configure the stub.
|
// Configure the stub.
|
||||||
|
@ -32,7 +37,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testBindValue($value)
|
public function testBindValue($value)
|
||||||
{
|
{
|
||||||
$this->createCellStub();
|
$this->createCellStub();
|
||||||
$binder = new \PHPExcel\Cell\DefaultValueBinder();
|
$binder = new DefaultValueBinder();
|
||||||
$result = $binder->bindValue($this->cellStub, $value);
|
$result = $binder->bindValue($this->cellStub, $value);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +66,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testDataTypeForValue()
|
public function testDataTypeForValue()
|
||||||
{
|
{
|
||||||
list($args, $expectedResult) = func_get_args();
|
list($args, $expectedResult) = func_get_args();
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell\\DefaultValueBinder','dataTypeForValue'), $args);
|
$result = call_user_func_array(array(DefaultValueBinder::class,'dataTypeForValue'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,11 +77,11 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testDataTypeForRichTextObject()
|
public function testDataTypeForRichTextObject()
|
||||||
{
|
{
|
||||||
$objRichText = new \PHPExcel\RichText();
|
$objRichText = new RichText();
|
||||||
$objRichText->createText('Hello World');
|
$objRichText->createText('Hello World');
|
||||||
|
|
||||||
$expectedResult = \PHPExcel\Cell\DataType::TYPE_INLINE;
|
$expectedResult = DataType::TYPE_INLINE;
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell\\DefaultValueBinder','dataTypeForValue'), $objRichText);
|
$result = call_user_func(array(DefaultValueBinder::class,'dataTypeForValue'), $objRichText);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Cell;
|
namespace PhpSpreadsheet\Tests\Cell;
|
||||||
|
|
||||||
|
use PHPExcel\Cell\Hyperlink;
|
||||||
|
|
||||||
class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -17,7 +19,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$urlValue = 'http://www.phpexcel.net';
|
$urlValue = 'http://www.phpexcel.net';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Cell\Hyperlink($urlValue);
|
$testInstance = new Hyperlink($urlValue);
|
||||||
|
|
||||||
$result = $testInstance->getUrl();
|
$result = $testInstance->getUrl();
|
||||||
$this->assertEquals($urlValue, $result);
|
$this->assertEquals($urlValue, $result);
|
||||||
|
@ -28,9 +30,9 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
||||||
$initialUrlValue = 'http://www.phpexcel.net';
|
$initialUrlValue = 'http://www.phpexcel.net';
|
||||||
$newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
|
$newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Cell\Hyperlink($initialUrlValue);
|
$testInstance = new Hyperlink($initialUrlValue);
|
||||||
$result = $testInstance->setUrl($newUrlValue);
|
$result = $testInstance->setUrl($newUrlValue);
|
||||||
$this->assertTrue($result instanceof \PHPExcel\Cell\Hyperlink);
|
$this->assertTrue($result instanceof Hyperlink);
|
||||||
|
|
||||||
$result = $testInstance->getUrl();
|
$result = $testInstance->getUrl();
|
||||||
$this->assertEquals($newUrlValue, $result);
|
$this->assertEquals($newUrlValue, $result);
|
||||||
|
@ -40,7 +42,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$tooltipValue = 'PHPExcel Web Site';
|
$tooltipValue = 'PHPExcel Web Site';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Cell\Hyperlink(null, $tooltipValue);
|
$testInstance = new Hyperlink(null, $tooltipValue);
|
||||||
|
|
||||||
$result = $testInstance->getTooltip();
|
$result = $testInstance->getTooltip();
|
||||||
$this->assertEquals($tooltipValue, $result);
|
$this->assertEquals($tooltipValue, $result);
|
||||||
|
@ -51,9 +53,9 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
||||||
$initialTooltipValue = 'PHPExcel Web Site';
|
$initialTooltipValue = 'PHPExcel Web Site';
|
||||||
$newTooltipValue = 'PHPExcel Repository on Github';
|
$newTooltipValue = 'PHPExcel Repository on Github';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Cell\Hyperlink(null, $initialTooltipValue);
|
$testInstance = new Hyperlink(null, $initialTooltipValue);
|
||||||
$result = $testInstance->setTooltip($newTooltipValue);
|
$result = $testInstance->setTooltip($newTooltipValue);
|
||||||
$this->assertTrue($result instanceof \PHPExcel\Cell\Hyperlink);
|
$this->assertTrue($result instanceof Hyperlink);
|
||||||
|
|
||||||
$result = $testInstance->getTooltip();
|
$result = $testInstance->getTooltip();
|
||||||
$this->assertEquals($newTooltipValue, $result);
|
$this->assertEquals($newTooltipValue, $result);
|
||||||
|
@ -64,7 +66,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
||||||
$initialUrlValue = 'http://www.phpexcel.net';
|
$initialUrlValue = 'http://www.phpexcel.net';
|
||||||
$newUrlValue = 'sheet://Worksheet1!A1';
|
$newUrlValue = 'sheet://Worksheet1!A1';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Cell\Hyperlink($initialUrlValue);
|
$testInstance = new Hyperlink($initialUrlValue);
|
||||||
$result = $testInstance->isInternal();
|
$result = $testInstance->isInternal();
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
|
|
||||||
|
@ -79,7 +81,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
|
||||||
$tooltipValue = 'PHPExcel Web Site';
|
$tooltipValue = 'PHPExcel Web Site';
|
||||||
$initialExpectedHash = '176f1ec64e84084db814481bd710b6b3';
|
$initialExpectedHash = '176f1ec64e84084db814481bd710b6b3';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Cell\Hyperlink($urlValue, $tooltipValue);
|
$testInstance = new Hyperlink($urlValue, $tooltipValue);
|
||||||
|
|
||||||
$result = $testInstance->getHashCode();
|
$result = $testInstance->getHashCode();
|
||||||
$this->assertEquals($initialExpectedHash, $result);
|
$this->assertEquals($initialExpectedHash, $result);
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPExcel;
|
namespace PhpSpreadsheet\Tests;
|
||||||
|
|
||||||
|
use PHPExcel\Cell;
|
||||||
|
use PHPExcel\Exception;
|
||||||
|
|
||||||
class CellTest extends \PHPUnit_Framework_TestCase
|
class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerColumnString
|
* @dataProvider providerColumnString
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +14,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','columnIndexFromString'), $args);
|
$result = call_user_func_array(array(Cell::class,'columnIndexFromString'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,9 +27,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'ABCD';
|
$cellAddress = 'ABCD';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','columnIndexFromString'), $cellAddress);
|
$result = call_user_func(array(Cell::class,'columnIndexFromString'), $cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
|
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -42,9 +40,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = '';
|
$cellAddress = '';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','columnIndexFromString'), $cellAddress);
|
$result = call_user_func(array(Cell::class,'columnIndexFromString'), $cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
|
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +56,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','stringFromColumnIndex'), $args);
|
$result = call_user_func_array(array(Cell::class,'stringFromColumnIndex'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +72,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','coordinateFromString'), $args);
|
$result = call_user_func_array(array(Cell::class,'coordinateFromString'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +85,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'A1:AI2012';
|
$cellAddress = 'A1:AI2012';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','coordinateFromString'), $cellAddress);
|
$result = call_user_func(array(Cell::class,'coordinateFromString'), $cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -100,9 +98,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = '';
|
$cellAddress = '';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','coordinateFromString'), $cellAddress);
|
$result = call_user_func(array(Cell::class,'coordinateFromString'), $cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -113,9 +111,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'AI';
|
$cellAddress = 'AI';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','coordinateFromString'), $cellAddress);
|
$result = call_user_func(array(Cell::class,'coordinateFromString'), $cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
|
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +127,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','absoluteCoordinate'), $args);
|
$result = call_user_func_array(array(Cell::class,'absoluteCoordinate'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,9 +140,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'A1:AI2012';
|
$cellAddress = 'A1:AI2012';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','absoluteCoordinate'), $cellAddress);
|
$result = call_user_func(array(Cell::class,'absoluteCoordinate'), $cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +156,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','absoluteReference'), $args);
|
$result = call_user_func_array(array(Cell::class,'absoluteReference'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,9 +169,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'A1:AI2012';
|
$cellAddress = 'A1:AI2012';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','absoluteReference'), $cellAddress);
|
$result = call_user_func(array(Cell::class,'absoluteReference'), $cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +185,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','splitRange'), $args);
|
$result = call_user_func_array(array(Cell::class,'splitRange'), $args);
|
||||||
foreach ($result as $key => $split) {
|
foreach ($result as $key => $split) {
|
||||||
if (!is_array($expectedResult[$key])) {
|
if (!is_array($expectedResult[$key])) {
|
||||||
$this->assertEquals($expectedResult[$key], $split[0]);
|
$this->assertEquals($expectedResult[$key], $split[0]);
|
||||||
|
@ -209,7 +207,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','buildRange'), $args);
|
$result = call_user_func_array(array(Cell::class,'buildRange'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,9 +220,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellRange = '';
|
$cellRange = '';
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\\PHPExcel\\Cell','buildRange'), $cellRange);
|
$result = call_user_func(array(Cell::class,'buildRange'), $cellRange);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
|
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +236,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','rangeBoundaries'), $args);
|
$result = call_user_func_array(array(Cell::class,'rangeBoundaries'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +252,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','rangeDimension'), $args);
|
$result = call_user_func_array(array(Cell::class,'rangeDimension'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +268,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','getRangeBoundaries'), $args);
|
$result = call_user_func_array(array(Cell::class,'getRangeBoundaries'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +284,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Cell','extractAllCellReferencesInRange'), $args);
|
$result = call_user_func_array(array(Cell::class,'extractAllCellReferencesInRange'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Chart;
|
namespace PhpSpreadsheet\Tests\Chart;
|
||||||
|
|
||||||
|
use PHPExcel\Chart\DataSeriesValues;
|
||||||
|
use PHPExcel\Exception;
|
||||||
|
|
||||||
class DataSeriesValuesTest extends \PHPUnit_Framework_TestCase
|
class DataSeriesValuesTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testSetDataType()
|
public function testSetDataType()
|
||||||
|
@ -11,21 +14,21 @@ class DataSeriesValuesTest extends \PHPUnit_Framework_TestCase
|
||||||
'String'
|
'String'
|
||||||
);
|
);
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
|
$testInstance = new DataSeriesValues;
|
||||||
|
|
||||||
foreach ($dataTypeValues as $dataTypeValue) {
|
foreach ($dataTypeValues as $dataTypeValue) {
|
||||||
$result = $testInstance->setDataType($dataTypeValue);
|
$result = $testInstance->setDataType($dataTypeValue);
|
||||||
$this->assertTrue($result instanceof \PHPExcel\Chart\DataSeriesValues);
|
$this->assertTrue($result instanceof DataSeriesValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetInvalidDataTypeThrowsException()
|
public function testSetInvalidDataTypeThrowsException()
|
||||||
{
|
{
|
||||||
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
|
$testInstance = new DataSeriesValues;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$result = $testInstance->setDataType('BOOLEAN');
|
$result = $testInstance->setDataType('BOOLEAN');
|
||||||
} catch (\PHPExcel\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
|
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +39,7 @@ class DataSeriesValuesTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$dataTypeValue = 'String';
|
$dataTypeValue = 'String';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
|
$testInstance = new DataSeriesValues;
|
||||||
$setValue = $testInstance->setDataType($dataTypeValue);
|
$setValue = $testInstance->setDataType($dataTypeValue);
|
||||||
|
|
||||||
$result = $testInstance->getDataType();
|
$result = $testInstance->getDataType();
|
||||||
|
|
|
@ -2,23 +2,25 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Chart;
|
namespace PhpSpreadsheet\Tests\Chart;
|
||||||
|
|
||||||
|
use PHPExcel\Chart\Layout;
|
||||||
|
|
||||||
class LayoutTest extends \PHPUnit_Framework_TestCase
|
class LayoutTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testSetLayoutTarget()
|
public function testSetLayoutTarget()
|
||||||
{
|
{
|
||||||
$LayoutTargetValue = 'String';
|
$LayoutTargetValue = 'String';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Layout;
|
$testInstance = new Layout;
|
||||||
|
|
||||||
$result = $testInstance->setLayoutTarget($LayoutTargetValue);
|
$result = $testInstance->setLayoutTarget($LayoutTargetValue);
|
||||||
$this->assertTrue($result instanceof \PHPExcel\Chart\Layout);
|
$this->assertTrue($result instanceof Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetLayoutTarget()
|
public function testGetLayoutTarget()
|
||||||
{
|
{
|
||||||
$LayoutTargetValue = 'String';
|
$LayoutTargetValue = 'String';
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Layout;
|
$testInstance = new Layout;
|
||||||
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
|
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
|
||||||
|
|
||||||
$result = $testInstance->getLayoutTarget();
|
$result = $testInstance->getLayoutTarget();
|
||||||
|
|
|
@ -2,19 +2,21 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Chart;
|
namespace PhpSpreadsheet\Tests\Chart;
|
||||||
|
|
||||||
|
use PHPExcel\Chart\Legend;
|
||||||
|
|
||||||
class LegendTest extends \PHPUnit_Framework_TestCase
|
class LegendTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testSetPosition()
|
public function testSetPosition()
|
||||||
{
|
{
|
||||||
$positionValues = array(
|
$positionValues = array(
|
||||||
\PHPExcel\Chart\Legend::POSITION_RIGHT,
|
Legend::POSITION_RIGHT,
|
||||||
\PHPExcel\Chart\Legend::POSITION_LEFT,
|
Legend::POSITION_LEFT,
|
||||||
\PHPExcel\Chart\Legend::POSITION_TOP,
|
Legend::POSITION_TOP,
|
||||||
\PHPExcel\Chart\Legend::POSITION_BOTTOM,
|
Legend::POSITION_BOTTOM,
|
||||||
\PHPExcel\Chart\Legend::POSITION_TOPRIGHT,
|
Legend::POSITION_TOPRIGHT,
|
||||||
);
|
);
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
|
|
||||||
foreach ($positionValues as $positionValue) {
|
foreach ($positionValues as $positionValue) {
|
||||||
$result = $testInstance->setPosition($positionValue);
|
$result = $testInstance->setPosition($positionValue);
|
||||||
|
@ -24,20 +26,20 @@ class LegendTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testSetInvalidPositionReturnsFalse()
|
public function testSetInvalidPositionReturnsFalse()
|
||||||
{
|
{
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
|
|
||||||
$result = $testInstance->setPosition('BottomLeft');
|
$result = $testInstance->setPosition('BottomLeft');
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
// Ensure that value is unchanged
|
// Ensure that value is unchanged
|
||||||
$result = $testInstance->getPosition();
|
$result = $testInstance->getPosition();
|
||||||
$this->assertEquals(\PHPExcel\Chart\Legend::POSITION_RIGHT, $result);
|
$this->assertEquals(Legend::POSITION_RIGHT, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPosition()
|
public function testGetPosition()
|
||||||
{
|
{
|
||||||
$PositionValue = \PHPExcel\Chart\Legend::POSITION_BOTTOM;
|
$PositionValue = Legend::POSITION_BOTTOM;
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
$setValue = $testInstance->setPosition($PositionValue);
|
$setValue = $testInstance->setPosition($PositionValue);
|
||||||
|
|
||||||
$result = $testInstance->getPosition();
|
$result = $testInstance->getPosition();
|
||||||
|
@ -47,15 +49,15 @@ class LegendTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSetPositionXL()
|
public function testSetPositionXL()
|
||||||
{
|
{
|
||||||
$positionValues = array(
|
$positionValues = array(
|
||||||
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_BOTTOM,
|
Legend::XL_LEGEND_POSITION_BOTTOM,
|
||||||
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_CORNER,
|
Legend::XL_LEGEND_POSITION_CORNER,
|
||||||
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_CUSTOM,
|
Legend::XL_LEGEND_POSITION_CUSTOM,
|
||||||
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_LEFT,
|
Legend::XL_LEGEND_POSITION_LEFT,
|
||||||
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_RIGHT,
|
Legend::XL_LEGEND_POSITION_RIGHT,
|
||||||
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_TOP,
|
Legend::XL_LEGEND_POSITION_TOP,
|
||||||
);
|
);
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
|
|
||||||
foreach ($positionValues as $positionValue) {
|
foreach ($positionValues as $positionValue) {
|
||||||
$result = $testInstance->setPositionXL($positionValue);
|
$result = $testInstance->setPositionXL($positionValue);
|
||||||
|
@ -65,20 +67,20 @@ class LegendTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testSetInvalidXLPositionReturnsFalse()
|
public function testSetInvalidXLPositionReturnsFalse()
|
||||||
{
|
{
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
|
|
||||||
$result = $testInstance->setPositionXL(999);
|
$result = $testInstance->setPositionXL(999);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
// Ensure that value is unchanged
|
// Ensure that value is unchanged
|
||||||
$result = $testInstance->getPositionXL();
|
$result = $testInstance->getPositionXL();
|
||||||
$this->assertEquals(\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_RIGHT, $result);
|
$this->assertEquals(Legend::XL_LEGEND_POSITION_RIGHT, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPositionXL()
|
public function testGetPositionXL()
|
||||||
{
|
{
|
||||||
$PositionValue = \PHPExcel\Chart\Legend::XL_LEGEND_POSITION_CORNER;
|
$PositionValue = Legend::XL_LEGEND_POSITION_CORNER;
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
$setValue = $testInstance->setPositionXL($PositionValue);
|
$setValue = $testInstance->setPositionXL($PositionValue);
|
||||||
|
|
||||||
$result = $testInstance->getPositionXL();
|
$result = $testInstance->getPositionXL();
|
||||||
|
@ -92,7 +94,7 @@ class LegendTest extends \PHPUnit_Framework_TestCase
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
|
|
||||||
foreach ($overlayValues as $overlayValue) {
|
foreach ($overlayValues as $overlayValue) {
|
||||||
$result = $testInstance->setOverlay($overlayValue);
|
$result = $testInstance->setOverlay($overlayValue);
|
||||||
|
@ -102,7 +104,7 @@ class LegendTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testSetInvalidOverlayReturnsFalse()
|
public function testSetInvalidOverlayReturnsFalse()
|
||||||
{
|
{
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
|
|
||||||
$result = $testInstance->setOverlay('INVALID');
|
$result = $testInstance->setOverlay('INVALID');
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
|
@ -115,7 +117,7 @@ class LegendTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$OverlayValue = true;
|
$OverlayValue = true;
|
||||||
|
|
||||||
$testInstance = new \PHPExcel\Chart\Legend;
|
$testInstance = new Legend;
|
||||||
$setValue = $testInstance->setOverlay($OverlayValue);
|
$setValue = $testInstance->setOverlay($OverlayValue);
|
||||||
|
|
||||||
$result = $testInstance->getOverlay();
|
$result = $testInstance->getOverlay();
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Custom;
|
namespace PhpSpreadsheet\Tests\Custom;
|
||||||
|
|
||||||
|
use PHPExcel\Exception;
|
||||||
|
|
||||||
class Complex
|
class Complex
|
||||||
{
|
{
|
||||||
private $realPart = 0;
|
private $realPart = 0;
|
||||||
|
@ -33,7 +35,7 @@ class Complex
|
||||||
// Neither real nor imaginary part, so test to see if we actually have a suffix
|
// Neither real nor imaginary part, so test to see if we actually have a suffix
|
||||||
$validComplex = preg_match('/^([\-\+]?)([ij])$/ui', $complexNumber, $complexParts);
|
$validComplex = preg_match('/^([\-\+]?)([ij])$/ui', $complexNumber, $complexParts);
|
||||||
if (!$validComplex) {
|
if (!$validComplex) {
|
||||||
throw new \PHPExcel\Exception('COMPLEX: Invalid complex number');
|
throw new Exception('COMPLEX: Invalid complex number');
|
||||||
}
|
}
|
||||||
// We have a suffix, so set the real to 0, the imaginary to either 1 or -1 (as defined by the sign)
|
// We have a suffix, so set the real to 0, the imaginary to either 1 or -1 (as defined by the sign)
|
||||||
$imaginary = 1;
|
$imaginary = 1;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Reader;
|
namespace PhpSpreadsheet\Tests\Reader;
|
||||||
|
|
||||||
|
use PHPExcel\Reader\BaseReader;
|
||||||
|
|
||||||
class XEEValidatorTest extends \PHPUnit_Framework_TestCase
|
class XEEValidatorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +12,7 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testInvalidXML($filename)
|
public function testInvalidXML($filename)
|
||||||
{
|
{
|
||||||
$reader = $this->getMockForAbstractClass('\PHPExcel\Reader\BaseReader');
|
$reader = $this->getMockForAbstractClass(BaseReader::class);
|
||||||
$expectedResult = 'FAILURE: Should throw an Exception rather than return a value';
|
$expectedResult = 'FAILURE: Should throw an Exception rather than return a value';
|
||||||
$result = $reader->securityScanFile($filename);
|
$result = $reader->securityScanFile($filename);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
|
@ -30,7 +32,7 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testValidXML($filename, $expectedResult)
|
public function testValidXML($filename, $expectedResult)
|
||||||
{
|
{
|
||||||
$reader = $this->getMockForAbstractClass('\PHPExcel\Reader\BaseReader');
|
$reader = $this->getMockForAbstractClass(BaseReader::class);
|
||||||
$result = $reader->securityScanFile($filename);
|
$result = $reader->securityScanFile($filename);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPExcel;
|
namespace PhpSpreadsheet\Tests;
|
||||||
|
|
||||||
|
use PHPExcel\ReferenceHelper;
|
||||||
|
|
||||||
class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
|
class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -24,7 +26,7 @@ class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
|
||||||
'BZA','BZB','BZZ'
|
'BZA','BZB','BZZ'
|
||||||
];
|
];
|
||||||
shuffle($columnBase);
|
shuffle($columnBase);
|
||||||
usort($columnBase, array('\\PHPExcel\\ReferenceHelper','columnSort'));
|
usort($columnBase, array(ReferenceHelper::class,'columnSort'));
|
||||||
foreach ($columnBase as $key => $value) {
|
foreach ($columnBase as $key => $value) {
|
||||||
$this->assertEquals($columnExpectedResult[$key], $value);
|
$this->assertEquals($columnExpectedResult[$key], $value);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +48,7 @@ class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
|
||||||
];
|
];
|
||||||
shuffle($columnBase);
|
shuffle($columnBase);
|
||||||
$columnExpectedResult = array_reverse($columnExpectedResult);
|
$columnExpectedResult = array_reverse($columnExpectedResult);
|
||||||
usort($columnBase, array('\\PHPExcel\\ReferenceHelper','columnReverseSort'));
|
usort($columnBase, array(ReferenceHelper::class,'columnReverseSort'));
|
||||||
foreach ($columnBase as $key => $value) {
|
foreach ($columnBase as $key => $value) {
|
||||||
$this->assertEquals($columnExpectedResult[$key], $value);
|
$this->assertEquals($columnExpectedResult[$key], $value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPExcel;
|
namespace PhpSpreadsheet\Tests;
|
||||||
|
|
||||||
class SettingsTest extends \PHPUnit_Framework_TestCase
|
class SettingsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Shared;
|
namespace PhpSpreadsheet\Tests\Shared;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\CodePage;
|
||||||
|
use PHPExcel\Exception;
|
||||||
|
|
||||||
class CodePageTest extends \PHPUnit_Framework_TestCase
|
class CodePageTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +14,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\CodePage','numberToName'), $args);
|
$result = call_user_func_array(array(CodePage::class,'numberToName'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +27,8 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$invalidCodePage = 12345;
|
$invalidCodePage = 12345;
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\CodePage','numberToName'), $invalidCodePage);
|
$result = call_user_func(array(CodePage::class,'numberToName'), $invalidCodePage);
|
||||||
} catch (\PHPExcel\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
|
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +39,8 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$unsupportedCodePage = 720;
|
$unsupportedCodePage = 720;
|
||||||
try {
|
try {
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\CodePage','numberToName'), $unsupportedCodePage);
|
$result = call_user_func(array(CodePage::class,'numberToName'), $unsupportedCodePage);
|
||||||
} catch (\PHPExcel\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
|
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Shared;
|
namespace PhpSpreadsheet\Tests\Shared;
|
||||||
|
|
||||||
use PhpSpreadsheet\TestDataFileIterator;
|
use PHPExcel\Shared\Date;
|
||||||
|
|
||||||
class DateTest extends \PHPUnit_Framework_TestCase
|
class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testSetExcelCalendar()
|
public function testSetExcelCalendar()
|
||||||
{
|
{
|
||||||
$calendarValues = array(
|
$calendarValues = array(
|
||||||
\PHPExcel\Shared\Date::CALENDAR_MAC_1904,
|
Date::CALENDAR_MAC_1904,
|
||||||
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900,
|
Date::CALENDAR_WINDOWS_1900,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($calendarValues as $calendarValue) {
|
foreach ($calendarValues as $calendarValue) {
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\Date','setExcelCalendar'), $calendarValue);
|
$result = call_user_func(array(Date::class,'setExcelCalendar'), $calendarValue);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSetExcelCalendarWithInvalidValue()
|
public function testSetExcelCalendarWithInvalidValue()
|
||||||
{
|
{
|
||||||
$unsupportedCalendar = '2012';
|
$unsupportedCalendar = '2012';
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\Date','setExcelCalendar'), $unsupportedCalendar);
|
$result = call_user_func(array(Date::class,'setExcelCalendar'), $unsupportedCalendar);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,13 +32,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testDateTimeExcelToTimestamp1900()
|
public function testDateTimeExcelToTimestamp1900()
|
||||||
{
|
{
|
||||||
$result = call_user_func(
|
$result = call_user_func(
|
||||||
array('\PHPExcel\Shared\Date','setExcelCalendar'),
|
array(Date::class,'setExcelCalendar'),
|
||||||
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
|
Date::CALENDAR_WINDOWS_1900
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Date', 'excelToTimestamp'), $args);
|
$result = call_user_func_array(array(Date::class, 'excelToTimestamp'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testDateTimePHPToExcel1900()
|
public function testDateTimePHPToExcel1900()
|
||||||
{
|
{
|
||||||
$result = call_user_func(
|
$result = call_user_func(
|
||||||
array('\PHPExcel\Shared\Date','setExcelCalendar'),
|
array(Date::class,'setExcelCalendar'),
|
||||||
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
|
Date::CALENDAR_WINDOWS_1900
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Date','PHPToExcel'), $args);
|
$result = call_user_func_array(array(Date::class,'PHPToExcel'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-5);
|
$this->assertEquals($expectedResult, $result, null, 1E-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +74,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testDateTimeFormattedPHPToExcel1900()
|
public function testDateTimeFormattedPHPToExcel1900()
|
||||||
{
|
{
|
||||||
$result = call_user_func(
|
$result = call_user_func(
|
||||||
array('\PHPExcel\Shared\Date','setExcelCalendar'),
|
array(Date::class,'setExcelCalendar'),
|
||||||
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
|
Date::CALENDAR_WINDOWS_1900
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Date','formattedPHPToExcel'), $args);
|
$result = call_user_func_array(array(Date::class,'formattedPHPToExcel'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-5);
|
$this->assertEquals($expectedResult, $result, null, 1E-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,13 +95,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testDateTimeExcelToTimestamp1904()
|
public function testDateTimeExcelToTimestamp1904()
|
||||||
{
|
{
|
||||||
$result = call_user_func(
|
$result = call_user_func(
|
||||||
array('\PHPExcel\Shared\Date','setExcelCalendar'),
|
array(Date::class,'setExcelCalendar'),
|
||||||
\PHPExcel\Shared\Date::CALENDAR_MAC_1904
|
Date::CALENDAR_MAC_1904
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Date','excelToTimestamp'), $args);
|
$result = call_user_func_array(array(Date::class,'excelToTimestamp'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,13 +116,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testDateTimePHPToExcel1904()
|
public function testDateTimePHPToExcel1904()
|
||||||
{
|
{
|
||||||
$result = call_user_func(
|
$result = call_user_func(
|
||||||
array('\PHPExcel\Shared\Date','setExcelCalendar'),
|
array(Date::class,'setExcelCalendar'),
|
||||||
\PHPExcel\Shared\Date::CALENDAR_MAC_1904
|
Date::CALENDAR_MAC_1904
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Date','PHPToExcel'), $args);
|
$result = call_user_func_array(array(Date::class,'PHPToExcel'), $args);
|
||||||
$this->assertEquals($expectedResult, $result, null, 1E-5);
|
$this->assertEquals($expectedResult, $result, null, 1E-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Date','isDateTimeFormatCode'), $args);
|
$result = call_user_func_array(array(Date::class,'isDateTimeFormatCode'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,18 +149,17 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerDateTimeExcelToTimestamp1900Timezone
|
* @dataProvider providerDateTimeExcelToTimestamp1900Timezone
|
||||||
* @group fail19
|
|
||||||
*/
|
*/
|
||||||
public function testDateTimeExcelToTimestamp1900Timezone()
|
public function testDateTimeExcelToTimestamp1900Timezone()
|
||||||
{
|
{
|
||||||
$result = call_user_func(
|
$result = call_user_func(
|
||||||
array('\PHPExcel\Shared\Date','setExcelCalendar'),
|
array(Date::class,'setExcelCalendar'),
|
||||||
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
|
Date::CALENDAR_WINDOWS_1900
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Date','excelToTimestamp'), $args);
|
$result = call_user_func_array(array(Date::class,'excelToTimestamp'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Shared;
|
namespace PhpSpreadsheet\Tests\Shared;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\File;
|
||||||
|
|
||||||
class FileTest extends \PHPUnit_Framework_TestCase
|
class FileTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testGetUseUploadTempDirectory()
|
public function testGetUseUploadTempDirectory()
|
||||||
{
|
{
|
||||||
$expectedResult = false;
|
$expectedResult = false;
|
||||||
|
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\File','getUseUploadTempDirectory'));
|
$result = call_user_func(array(File::class,'getUseUploadTempDirectory'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +22,9 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
|
foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
|
||||||
call_user_func(array('\PHPExcel\Shared\File','setUseUploadTempDirectory'), $useUploadTempDirectoryValue);
|
call_user_func(array(File::class,'setUseUploadTempDirectory'), $useUploadTempDirectoryValue);
|
||||||
|
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\File','getUseUploadTempDirectory'));
|
$result = call_user_func(array(File::class,'getUseUploadTempDirectory'));
|
||||||
$this->assertEquals($useUploadTempDirectoryValue, $result);
|
$this->assertEquals($useUploadTempDirectoryValue, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,25 +2,27 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Shared;
|
namespace PhpSpreadsheet\Tests\Shared;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\Font;
|
||||||
|
|
||||||
class FontTest extends \PHPUnit_Framework_TestCase
|
class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testGetAutoSizeMethod()
|
public function testGetAutoSizeMethod()
|
||||||
{
|
{
|
||||||
$expectedResult = \PHPExcel\Shared\Font::AUTOSIZE_METHOD_APPROX;
|
$expectedResult = Font::AUTOSIZE_METHOD_APPROX;
|
||||||
|
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\Font','getAutoSizeMethod'));
|
$result = call_user_func(array(Font::class,'getAutoSizeMethod'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetAutoSizeMethod()
|
public function testSetAutoSizeMethod()
|
||||||
{
|
{
|
||||||
$autosizeMethodValues = array(
|
$autosizeMethodValues = array(
|
||||||
\PHPExcel\Shared\Font::AUTOSIZE_METHOD_EXACT,
|
Font::AUTOSIZE_METHOD_EXACT,
|
||||||
\PHPExcel\Shared\Font::AUTOSIZE_METHOD_APPROX,
|
Font::AUTOSIZE_METHOD_APPROX,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($autosizeMethodValues as $autosizeMethodValue) {
|
foreach ($autosizeMethodValues as $autosizeMethodValue) {
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\Font','setAutoSizeMethod'), $autosizeMethodValue);
|
$result = call_user_func(array(Font::class,'setAutoSizeMethod'), $autosizeMethodValue);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +31,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$unsupportedAutosizeMethod = 'guess';
|
$unsupportedAutosizeMethod = 'guess';
|
||||||
|
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\Font','setAutoSizeMethod'), $unsupportedAutosizeMethod);
|
$result = call_user_func(array(Font::class,'setAutoSizeMethod'), $unsupportedAutosizeMethod);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +42,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Font','fontSizeToPixels'), $args);
|
$result = call_user_func_array(array(Font::class,'fontSizeToPixels'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Font','inchSizeToPixels'), $args);
|
$result = call_user_func_array(array(Font::class,'inchSizeToPixels'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +74,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\Font','centimeterSizeToPixels'), $args);
|
$result = call_user_func_array(array(Font::class,'centimeterSizeToPixels'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Shared;
|
namespace PhpSpreadsheet\Tests\Shared;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\PasswordHasher;
|
||||||
|
|
||||||
class PasswordHasherTest extends \PHPUnit_Framework_TestCase
|
class PasswordHasherTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +14,7 @@ class PasswordHasherTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Shared\PasswordHasher','hashPassword'), $args);
|
$result = call_user_func_array(array(PasswordHasher::class,'hashPassword'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Shared;
|
namespace PhpSpreadsheet\Tests\Shared;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\StringHelper;
|
||||||
|
|
||||||
class StringTest extends \PHPUnit_Framework_TestCase
|
class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
|
@ -9,18 +11,18 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Reset Currency Code
|
// Reset Currency Code
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper','setCurrencyCode'), null);
|
call_user_func(array(StringHelper::class,'setCurrencyCode'), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetIsMbStringEnabled()
|
public function testGetIsMbStringEnabled()
|
||||||
{
|
{
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getIsMbstringEnabled'));
|
$result = call_user_func(array(StringHelper::class,'getIsMbstringEnabled'));
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetIsIconvEnabled()
|
public function testGetIsIconvEnabled()
|
||||||
{
|
{
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getIsIconvEnabled'));
|
$result = call_user_func(array(StringHelper::class,'getIsIconvEnabled'));
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,16 +31,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
$localeconv = localeconv();
|
$localeconv = localeconv();
|
||||||
|
|
||||||
$expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ',';
|
$expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ',';
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getDecimalSeparator'));
|
$result = call_user_func(array(StringHelper::class,'getDecimalSeparator'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetDecimalSeparator()
|
public function testSetDecimalSeparator()
|
||||||
{
|
{
|
||||||
$expectedResult = ',';
|
$expectedResult = ',';
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper','setDecimalSeparator'), $expectedResult);
|
call_user_func(array(StringHelper::class,'setDecimalSeparator'), $expectedResult);
|
||||||
|
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getDecimalSeparator'));
|
$result = call_user_func(array(StringHelper::class,'getDecimalSeparator'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,16 +49,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
$localeconv = localeconv();
|
$localeconv = localeconv();
|
||||||
|
|
||||||
$expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ',';
|
$expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ',';
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getThousandsSeparator'));
|
$result = call_user_func(array(StringHelper::class,'getThousandsSeparator'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetThousandsSeparator()
|
public function testSetThousandsSeparator()
|
||||||
{
|
{
|
||||||
$expectedResult = ' ';
|
$expectedResult = ' ';
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper','setThousandsSeparator'), $expectedResult);
|
call_user_func(array(StringHelper::class,'setThousandsSeparator'), $expectedResult);
|
||||||
|
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getThousandsSeparator'));
|
$result = call_user_func(array(StringHelper::class,'getThousandsSeparator'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,16 +66,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$localeconv = localeconv();
|
$localeconv = localeconv();
|
||||||
$expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol']: '$'));
|
$expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol']: '$'));
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getCurrencyCode'));
|
$result = call_user_func(array(StringHelper::class,'getCurrencyCode'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetCurrencyCode()
|
public function testSetCurrencyCode()
|
||||||
{
|
{
|
||||||
$expectedResult = '£';
|
$expectedResult = '£';
|
||||||
call_user_func(array('\PHPExcel\Shared\StringHelper','setCurrencyCode'), $expectedResult);
|
call_user_func(array(StringHelper::class,'setCurrencyCode'), $expectedResult);
|
||||||
|
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getCurrencyCode'));
|
$result = call_user_func(array(StringHelper::class,'getCurrencyCode'));
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Shared;
|
namespace PhpSpreadsheet\Tests\Shared;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\TimeZone;
|
||||||
|
|
||||||
class TimeZoneTest extends \PHPUnit_Framework_TestCase
|
class TimeZoneTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testSetTimezone()
|
public function testSetTimezone()
|
||||||
|
@ -15,7 +17,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($timezoneValues as $timezoneValue) {
|
foreach ($timezoneValues as $timezoneValue) {
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\TimeZone','setTimezone'), $timezoneValue);
|
$result = call_user_func(array(TimeZone::class,'setTimezone'), $timezoneValue);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +25,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSetTimezoneWithInvalidValue()
|
public function testSetTimezoneWithInvalidValue()
|
||||||
{
|
{
|
||||||
$unsupportedTimezone = 'Etc/GMT+10';
|
$unsupportedTimezone = 'Etc/GMT+10';
|
||||||
$result = call_user_func(array('\PHPExcel\Shared\TimeZone','setTimezone'), $unsupportedTimezone);
|
$result = call_user_func(array(TimeZone::class,'setTimezone'), $unsupportedTimezone);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Style;
|
namespace PhpSpreadsheet\Tests\Style;
|
||||||
|
|
||||||
|
use PHPExcel\Style\Color;
|
||||||
|
|
||||||
class ColorTest extends \PHPUnit_Framework_TestCase
|
class ColorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +13,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Style\\Color','getRed'), $args);
|
$result = call_user_func_array(array(Color::class,'getRed'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +29,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Style\\Color','getGreen'), $args);
|
$result = call_user_func_array(array(Color::class,'getGreen'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Style\\Color','getBlue'), $args);
|
$result = call_user_func_array(array(Color::class,'getBlue'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testChangeBrightness()
|
public function testChangeBrightness()
|
||||||
{
|
{
|
||||||
list($args, $expectedResult) = func_get_args();
|
list($args, $expectedResult) = func_get_args();
|
||||||
$result = call_user_func_array(array('\\PHPExcel\\Style\\Color','changeBrightness'), $args);
|
$result = call_user_func_array(array(Color::class,'changeBrightness'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Style;
|
namespace PhpSpreadsheet\Tests\Style;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\StringHelper;
|
||||||
|
use PHPExcel\Style\NumberFormat;
|
||||||
|
|
||||||
class NumberFormatDateTest extends \PHPUnit_Framework_TestCase
|
class NumberFormatDateTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Shared\StringHelper::setDecimalSeparator('.');
|
StringHelper::setDecimalSeparator('.');
|
||||||
\PHPExcel\Shared\StringHelper::setThousandsSeparator(',');
|
StringHelper::setThousandsSeparator(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,9 +19,11 @@ class NumberFormatDateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testFormatValueWithMask()
|
public function testFormatValueWithMask()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('TODO: This test should be fixed');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Style\NumberFormat','toFormattedString'), $args);
|
$result = call_user_func_array(array(NumberFormat::class,'toFormattedString'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Style;
|
namespace PhpSpreadsheet\Tests\Style;
|
||||||
|
|
||||||
|
use PHPExcel\Shared\StringHelper;
|
||||||
|
use PHPExcel\Style\NumberFormat;
|
||||||
|
|
||||||
class NumberFormatTest extends \PHPUnit_Framework_TestCase
|
class NumberFormatTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
\PHPExcel\Shared\StringHelper::setDecimalSeparator('.');
|
StringHelper::setDecimalSeparator('.');
|
||||||
\PHPExcel\Shared\StringHelper::setThousandsSeparator(',');
|
StringHelper::setThousandsSeparator(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +21,7 @@ class NumberFormatTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
$result = call_user_func_array(array('\PHPExcel\Style\NumberFormat','toFormattedString'), $args);
|
$result = call_user_func_array(array(NumberFormat::class,'toFormattedString'), $args);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,42 +2,44 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet\AutoFilter\Column;
|
namespace PhpSpreadsheet\Tests\Worksheet\AutoFilter\Column;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet\AutoFilter\Column;
|
||||||
|
|
||||||
class RuleTest extends \PHPUnit_Framework_TestCase
|
class RuleTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private $_testAutoFilterRuleObject;
|
private $testAutoFilterRuleObject;
|
||||||
|
|
||||||
private $_mockAutoFilterColumnObject;
|
private $mockAutoFilterColumnObject;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->_mockAutoFilterColumnObject = $this->getMockBuilder('\PHPExcel\Worksheet\AutoFilter\Column')
|
$this->mockAutoFilterColumnObject = $this->getMockBuilder(Column::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->_mockAutoFilterColumnObject->expects($this->any())
|
$this->mockAutoFilterColumnObject->expects($this->any())
|
||||||
->method('testColumnInRange')
|
->method('testColumnInRange')
|
||||||
->will($this->returnValue(3));
|
->will($this->returnValue(3));
|
||||||
|
|
||||||
$this->_testAutoFilterRuleObject = new \PHPExcel\Worksheet\AutoFilter\Column\Rule(
|
$this->testAutoFilterRuleObject = new Column\Rule(
|
||||||
$this->_mockAutoFilterColumnObject
|
$this->mockAutoFilterColumnObject
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetRuleType()
|
public function testGetRuleType()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
$result = $this->testAutoFilterRuleObject->getRuleType();
|
||||||
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_FILTER, $result);
|
$this->assertEquals(Column\Rule::AUTOFILTER_RULETYPE_FILTER, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetRuleType()
|
public function testSetRuleType()
|
||||||
{
|
{
|
||||||
$expectedResult = \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP;
|
$expectedResult = Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP;
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult);
|
$result = $this->testAutoFilterRuleObject->setRuleType($expectedResult);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
|
$this->assertInstanceOf(Column\Rule::class, $result);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
$result = $this->testAutoFilterRuleObject->getRuleType();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,59 +48,59 @@ class RuleTest extends \PHPUnit_Framework_TestCase
|
||||||
$expectedResult = 100;
|
$expectedResult = 100;
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterRuleObject->setValue($expectedResult);
|
$result = $this->testAutoFilterRuleObject->setValue($expectedResult);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
|
$this->assertInstanceOf(Column\Rule::class, $result);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterRuleObject->getValue();
|
$result = $this->testAutoFilterRuleObject->getValue();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetOperator()
|
public function testGetOperator()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
$result = $this->testAutoFilterRuleObject->getOperator();
|
||||||
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
|
$this->assertEquals(Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetOperator()
|
public function testSetOperator()
|
||||||
{
|
{
|
||||||
$expectedResult = \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
|
$expectedResult = Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterRuleObject->setOperator($expectedResult);
|
$result = $this->testAutoFilterRuleObject->setOperator($expectedResult);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
|
$this->assertInstanceOf(Column\Rule::class, $result);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
$result = $this->testAutoFilterRuleObject->getOperator();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetGrouping()
|
public function testSetGrouping()
|
||||||
{
|
{
|
||||||
$expectedResult = \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH;
|
$expectedResult = Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH;
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult);
|
$result = $this->testAutoFilterRuleObject->setGrouping($expectedResult);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
|
$this->assertInstanceOf(Column\Rule::class, $result);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterRuleObject->getGrouping();
|
$result = $this->testAutoFilterRuleObject->getGrouping();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetParent()
|
public function testGetParent()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterRuleObject->getParent();
|
$result = $this->testAutoFilterRuleObject->getParent();
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(Column::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetParent()
|
public function testSetParent()
|
||||||
{
|
{
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject);
|
$result = $this->testAutoFilterRuleObject->setParent($this->mockAutoFilterColumnObject);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
|
$this->assertInstanceOf(Column\Rule::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClone()
|
public function testClone()
|
||||||
{
|
{
|
||||||
$result = clone $this->_testAutoFilterRuleObject;
|
$result = clone $this->testAutoFilterRuleObject;
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
|
$this->assertInstanceOf(Column\Rule::class, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,34 +2,36 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet\AutoFilter;
|
namespace PhpSpreadsheet\Tests\Worksheet\AutoFilter;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet\AutoFilter;
|
||||||
|
|
||||||
class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private $_testInitialColumn = 'H';
|
private $testInitialColumn = 'H';
|
||||||
|
|
||||||
private $_testAutoFilterColumnObject;
|
private $testAutoFilterColumnObject;
|
||||||
|
|
||||||
private $_mockAutoFilterObject;
|
private $mockAutoFilterObject;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->_mockAutoFilterObject = $this->getMockBuilder('\PHPExcel\Worksheet\AutoFilter')
|
$this->mockAutoFilterObject = $this->getMockBuilder(AutoFilter::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->_mockAutoFilterObject->expects($this->any())
|
$this->mockAutoFilterObject->expects($this->any())
|
||||||
->method('testColumnInRange')
|
->method('testColumnInRange')
|
||||||
->will($this->returnValue(3));
|
->will($this->returnValue(3));
|
||||||
|
|
||||||
$this->_testAutoFilterColumnObject = new \PHPExcel\Worksheet\AutoFilter\Column(
|
$this->testAutoFilterColumnObject = new AutoFilter\Column(
|
||||||
$this->_testInitialColumn,
|
$this->testInitialColumn,
|
||||||
$this->_mockAutoFilterObject
|
$this->mockAutoFilterObject
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetColumnIndex()
|
public function testGetColumnIndex()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
$result = $this->testAutoFilterColumnObject->getColumnIndex();
|
||||||
$this->assertEquals($this->_testInitialColumn, $result);
|
$this->assertEquals($this->testInitialColumn, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetColumnIndex()
|
public function testSetColumnIndex()
|
||||||
|
@ -37,39 +39,39 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
$expectedResult = 'L';
|
$expectedResult = 'L';
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult);
|
$result = $this->testAutoFilterColumnObject->setColumnIndex($expectedResult);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(AutoFilter\Column::class, $result);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
$result = $this->testAutoFilterColumnObject->getColumnIndex();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetParent()
|
public function testGetParent()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterColumnObject->getParent();
|
$result = $this->testAutoFilterColumnObject->getParent();
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetParent()
|
public function testSetParent()
|
||||||
{
|
{
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject);
|
$result = $this->testAutoFilterColumnObject->setParent($this->mockAutoFilterObject);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(AutoFilter\Column::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetFilterType()
|
public function testGetFilterType()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
$result = $this->testAutoFilterColumnObject->getFilterType();
|
||||||
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
|
$this->assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetFilterType()
|
public function testSetFilterType()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterColumnObject->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
$result = $this->testAutoFilterColumnObject->setFilterType(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(AutoFilter\Column::class, $result);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
$result = $this->testAutoFilterColumnObject->getFilterType();
|
||||||
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
|
$this->assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,22 +81,22 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$expectedResult = 'Unfiltered';
|
$expectedResult = 'Unfiltered';
|
||||||
|
|
||||||
$result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult);
|
$result = $this->testAutoFilterColumnObject->setFilterType($expectedResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetJoin()
|
public function testGetJoin()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
$result = $this->testAutoFilterColumnObject->getJoin();
|
||||||
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
|
$this->assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetJoin()
|
public function testSetJoin()
|
||||||
{
|
{
|
||||||
$result = $this->_testAutoFilterColumnObject->setJoin(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND);
|
$result = $this->testAutoFilterColumnObject->setJoin(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(AutoFilter\Column::class, $result);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
$result = $this->testAutoFilterColumnObject->getJoin();
|
||||||
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
|
$this->assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,7 +106,7 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$expectedResult = 'Neither';
|
$expectedResult = 'Neither';
|
||||||
|
|
||||||
$result = $this->_testAutoFilterColumnObject->setJoin($expectedResult);
|
$result = $this->testAutoFilterColumnObject->setJoin($expectedResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetAttributes()
|
public function testSetAttributes()
|
||||||
|
@ -114,8 +116,8 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
$result = $this->testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(AutoFilter\Column::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAttributes()
|
public function testGetAttributes()
|
||||||
|
@ -124,9 +126,9 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
'maxVal' => 200
|
'maxVal' => 200
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
$this->testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||||
|
|
||||||
$result = $this->_testAutoFilterColumnObject->getAttributes();
|
$result = $this->testAutoFilterColumnObject->getAttributes();
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(count($attributeSet), count($result));
|
$this->assertEquals(count($attributeSet), count($result));
|
||||||
}
|
}
|
||||||
|
@ -139,8 +141,8 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
foreach ($attributeSet as $attributeName => $attributeValue) {
|
foreach ($attributeSet as $attributeName => $attributeValue) {
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->_testAutoFilterColumnObject->setAttribute($attributeName, $attributeValue);
|
$result = $this->testAutoFilterColumnObject->setAttribute($attributeName, $attributeValue);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(AutoFilter\Column::class, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,19 +152,19 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
'maxVal' => 200
|
'maxVal' => 200
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
$this->testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||||
|
|
||||||
foreach ($attributeSet as $attributeName => $attributeValue) {
|
foreach ($attributeSet as $attributeName => $attributeValue) {
|
||||||
$result = $this->_testAutoFilterColumnObject->getAttribute($attributeName);
|
$result = $this->testAutoFilterColumnObject->getAttribute($attributeName);
|
||||||
$this->assertEquals($attributeValue, $result);
|
$this->assertEquals($attributeValue, $result);
|
||||||
}
|
}
|
||||||
$result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
|
$result = $this->testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
|
||||||
$this->assertNull($result);
|
$this->assertNull($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClone()
|
public function testClone()
|
||||||
{
|
{
|
||||||
$result = clone $this->_testAutoFilterColumnObject;
|
$result = clone $this->testAutoFilterColumnObject;
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
|
$this->assertInstanceOf(AutoFilter\Column::class, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
use PHPExcel\Worksheet\AutoFilter;
|
use PHPExcel\Worksheet\AutoFilter;
|
||||||
|
use PHPExcel\Worksheet\AutoFilter\Column;
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
|
use PHPExcel\CachedObjectStorage\Memory;
|
||||||
|
|
||||||
class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -12,17 +15,19 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
private $mockWorksheetObject;
|
private $mockWorksheetObject;
|
||||||
|
|
||||||
|
private $mockCacheController;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->mockWorksheetObject = $this->getMockBuilder('\\PHPExcel\\Worksheet')
|
$this->mockWorksheetObject = $this->getMockBuilder(Worksheet::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->_mockCacheController = $this->getMockBuilder('\\PHPExcel\\CachedObjectStorage\\Memory')
|
$this->mockCacheController = $this->getMockBuilder(Memory::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->mockWorksheetObject->expects($this->any())
|
$this->mockWorksheetObject->expects($this->any())
|
||||||
->method('getCellCacheController')
|
->method('getCellCacheController')
|
||||||
->will($this->returnValue($this->_mockCacheController));
|
->will($this->returnValue($this->mockCacheController));
|
||||||
|
|
||||||
$this->testAutoFilterObject = new AutoFilter(
|
$this->testAutoFilterObject = new AutoFilter(
|
||||||
$this->testInitialRange,
|
$this->testInitialRange,
|
||||||
|
@ -42,14 +47,14 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testGetParent()
|
public function testGetParent()
|
||||||
{
|
{
|
||||||
$result = $this->testAutoFilterObject->getParent();
|
$result = $this->testAutoFilterObject->getParent();
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet', $result);
|
$this->assertInstanceOf(Worksheet::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetParent()
|
public function testSetParent()
|
||||||
{
|
{
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->testAutoFilterObject->setParent($this->mockWorksheetObject);
|
$result = $this->testAutoFilterObject->setParent($this->mockWorksheetObject);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetRange()
|
public function testGetRange()
|
||||||
|
@ -71,7 +76,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
foreach ($ranges as $actualRange => $fullRange) {
|
foreach ($ranges as $actualRange => $fullRange) {
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->testAutoFilterObject->setRange($fullRange);
|
$result = $this->testAutoFilterObject->setRange($fullRange);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
|
|
||||||
// Result should be the new autofilter range
|
// Result should be the new autofilter range
|
||||||
$result = $this->testAutoFilterObject->getRange();
|
$result = $this->testAutoFilterObject->getRange();
|
||||||
|
@ -85,7 +90,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->testAutoFilterObject->setRange();
|
$result = $this->testAutoFilterObject->setRange();
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
|
|
||||||
// Result should be a clear range
|
// Result should be a clear range
|
||||||
$result = $this->testAutoFilterObject->getRange();
|
$result = $this->testAutoFilterObject->getRange();
|
||||||
|
@ -142,7 +147,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->testAutoFilterObject->setColumn($expectedResult);
|
$result = $this->testAutoFilterObject->setColumn($expectedResult);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
|
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
// Result should be an array of \PHPExcel\Worksheet\AutoFilter\Column
|
// Result should be an array of \PHPExcel\Worksheet\AutoFilter\Column
|
||||||
|
@ -150,7 +155,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertEquals(1, count($result));
|
||||||
$this->assertArrayHasKey($expectedResult, $result);
|
$this->assertArrayHasKey($expectedResult, $result);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result[$expectedResult]);
|
$this->assertInstanceOf(Column::class, $result[$expectedResult]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,7 +175,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->testAutoFilterObject->setColumn($columnObject);
|
$result = $this->testAutoFilterObject->setColumn($columnObject);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
|
|
||||||
$result = $this->testAutoFilterObject->getColumns();
|
$result = $this->testAutoFilterObject->getColumns();
|
||||||
// Result should be an array of \PHPExcel\Worksheet\AutoFilter\Column
|
// Result should be an array of \PHPExcel\Worksheet\AutoFilter\Column
|
||||||
|
@ -178,7 +183,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertEquals(1, count($result));
|
||||||
$this->assertArrayHasKey($expectedResult, $result);
|
$this->assertArrayHasKey($expectedResult, $result);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result[$expectedResult]);
|
$this->assertInstanceOf(Column::class, $result[$expectedResult]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,7 +223,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals(count($columnIndexes), count($result));
|
$this->assertEquals(count($columnIndexes), count($result));
|
||||||
foreach ($columnIndexes as $columnIndex) {
|
foreach ($columnIndexes as $columnIndex) {
|
||||||
$this->assertArrayHasKey($columnIndex, $result);
|
$this->assertArrayHasKey($columnIndex, $result);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result[$columnIndex]);
|
$this->assertInstanceOf(Column::class, $result[$columnIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +239,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
// get a \PHPExcel\Worksheet\AutoFilter\Column object returned
|
// get a \PHPExcel\Worksheet\AutoFilter\Column object returned
|
||||||
foreach ($columnIndexes as $columnIndex) {
|
foreach ($columnIndexes as $columnIndex) {
|
||||||
$result = $this->testAutoFilterObject->getColumn($columnIndex);
|
$result = $this->testAutoFilterObject->getColumn($columnIndex);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result);
|
$this->assertInstanceOf(Column::class, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +255,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
// get a \PHPExcel\Worksheet\AutoFilter\Column object returned
|
// get a \PHPExcel\Worksheet\AutoFilter\Column object returned
|
||||||
foreach ($columnIndexes as $columnIndex => $columnID) {
|
foreach ($columnIndexes as $columnIndex => $columnID) {
|
||||||
$result = $this->testAutoFilterObject->getColumnByOffset($columnIndex);
|
$result = $this->testAutoFilterObject->getColumnByOffset($columnIndex);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result);
|
$this->assertInstanceOf(Column::class, $result);
|
||||||
$this->assertEquals($result->getColumnIndex(), $columnID);
|
$this->assertEquals($result->getColumnIndex(), $columnID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +265,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
// If we request a specific column by its column ID, we should
|
// If we request a specific column by its column ID, we should
|
||||||
// get a \PHPExcel\Worksheet\AutoFilter\Column object returned
|
// get a \PHPExcel\Worksheet\AutoFilter\Column object returned
|
||||||
$result = $this->testAutoFilterObject->getColumn('K');
|
$result = $this->testAutoFilterObject->getColumn('K');
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result);
|
$this->assertInstanceOf(Column::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -284,7 +289,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->testAutoFilterObject->setRange();
|
$result = $this->testAutoFilterObject->setRange();
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
|
|
||||||
// Range should be cleared
|
// Range should be cleared
|
||||||
$result = $this->testAutoFilterObject->getRange();
|
$result = $this->testAutoFilterObject->getRange();
|
||||||
|
@ -313,7 +318,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
// Setters return the instance to implement the fluent interface
|
// Setters return the instance to implement the fluent interface
|
||||||
$result = $this->testAutoFilterObject->setRange($expectedResult);
|
$result = $this->testAutoFilterObject->setRange($expectedResult);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
|
|
||||||
// Range should be correctly set
|
// Range should be correctly set
|
||||||
$result = $this->testAutoFilterObject->getRange();
|
$result = $this->testAutoFilterObject->getRange();
|
||||||
|
@ -335,6 +340,6 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = clone $this->testAutoFilterObject;
|
$result = clone $this->testAutoFilterObject;
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
|
$this->assertInstanceOf(AutoFilter::class, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,25 +2,23 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
|
use PHPExcel\CachedObjectStorageFactory;
|
||||||
|
use PHPExcel\Spreadsheet;
|
||||||
|
|
||||||
class CellCollectionTest extends \PHPUnit_Framework_TestCase
|
class CellCollectionTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCacheLastCell()
|
public function testCacheLastCell()
|
||||||
{
|
{
|
||||||
$methods = \PHPExcel\CachedObjectStorageFactory::getCacheStorageMethods();
|
$methods = CachedObjectStorageFactory::getCacheStorageMethods();
|
||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
\PHPExcel\CachedObjectStorageFactory::initialize($method);
|
CachedObjectStorageFactory::initialize($method);
|
||||||
$workbook = new \PHPExcel\Spreadsheet();
|
$workbook = new Spreadsheet();
|
||||||
$cells = ['A1', 'A2'];
|
$cells = ['A1', 'A2'];
|
||||||
$worksheet = $workbook->getActiveSheet();
|
$worksheet = $workbook->getActiveSheet();
|
||||||
$worksheet->setCellValue('A1', 1);
|
$worksheet->setCellValue('A1', 1);
|
||||||
$worksheet->setCellValue('A2', 2);
|
$worksheet->setCellValue('A2', 2);
|
||||||
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
|
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
|
||||||
\PHPExcel\CachedObjectStorageFactory::finalize();
|
CachedObjectStorageFactory::finalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
use PHPExcel\Worksheet\ColumnCellIterator;
|
use PHPExcel\Worksheet\ColumnCellIterator;
|
||||||
|
use PHPExcel\Cell;
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
|
|
||||||
class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
|
class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -11,11 +13,11 @@ class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->mockCell = $this->getMockBuilder('\\PHPExcel\\Cell')
|
$this->mockCell = $this->getMockBuilder(Cell::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->mockWorksheet = $this->getMockBuilder('\\PHPExcel\\Worksheet')
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -36,7 +38,7 @@ class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
foreach ($iterator as $key => $ColumnCell) {
|
foreach ($iterator as $key => $ColumnCell) {
|
||||||
$this->assertEquals($ColumnCellIndexResult++, $key);
|
$this->assertEquals($ColumnCellIndexResult++, $key);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Cell', $ColumnCell);
|
$this->assertInstanceOf(Cell::class, $ColumnCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +50,7 @@ class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
foreach ($iterator as $key => $ColumnCell) {
|
foreach ($iterator as $key => $ColumnCell) {
|
||||||
$this->assertEquals($ColumnCellIndexResult++, $key);
|
$this->assertEquals($ColumnCellIndexResult++, $key);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Cell', $ColumnCell);
|
$this->assertInstanceOf(Cell::class, $ColumnCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
use PHPExcel\Worksheet\ColumnIterator;
|
use PHPExcel\Worksheet\ColumnIterator;
|
||||||
|
use PHPExcel\Worksheet\Column;
|
||||||
|
|
||||||
class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
|
class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -11,11 +13,11 @@ class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->mockColumn = $this->getMockBuilder('\\PHPExcel\\Worksheet\\Column')
|
$this->mockColumn = $this->getMockBuilder(Column::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->mockWorksheet = $this->getMockBuilder('\\PHPExcel\\Worksheet')
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -36,7 +38,7 @@ class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
foreach ($iterator as $key => $column) {
|
foreach ($iterator as $key => $column) {
|
||||||
$this->assertEquals($columnIndexResult++, $key);
|
$this->assertEquals($columnIndexResult++, $key);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\Column', $column);
|
$this->assertInstanceOf(Column::class, $column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +50,7 @@ class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
foreach ($iterator as $key => $column) {
|
foreach ($iterator as $key => $column) {
|
||||||
$this->assertEquals($columnIndexResult++, $key);
|
$this->assertEquals($columnIndexResult++, $key);
|
||||||
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\Column', $column);
|
$this->assertInstanceOf(Column::class, $column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
|
use PHPExcel\Cell;
|
||||||
|
use PHPExcel\Worksheet\RowCellIterator;
|
||||||
|
|
||||||
class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
|
class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public $mockWorksheet;
|
public $mockWorksheet;
|
||||||
|
@ -9,11 +13,11 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
|
$this->mockCell = $this->getMockBuilder(Cell::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -28,32 +32,32 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testIteratorFullRange()
|
public function testIteratorFullRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet);
|
$iterator = new RowCellIterator($this->mockWorksheet);
|
||||||
$RowCellIndexResult = 'A';
|
$RowCellIndexResult = 'A';
|
||||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||||
|
|
||||||
foreach ($iterator as $key => $RowCell) {
|
foreach ($iterator as $key => $RowCell) {
|
||||||
$this->assertEquals($RowCellIndexResult++, $key);
|
$this->assertEquals($RowCellIndexResult++, $key);
|
||||||
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
|
$this->assertInstanceOf(Cell::class, $RowCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIteratorStartEndRange()
|
public function testIteratorStartEndRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||||
$RowCellIndexResult = 'B';
|
$RowCellIndexResult = 'B';
|
||||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||||
|
|
||||||
foreach ($iterator as $key => $RowCell) {
|
foreach ($iterator as $key => $RowCell) {
|
||||||
$this->assertEquals($RowCellIndexResult++, $key);
|
$this->assertEquals($RowCellIndexResult++, $key);
|
||||||
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
|
$this->assertInstanceOf(Cell::class, $RowCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIteratorSeekAndPrev()
|
public function testIteratorSeekAndPrev()
|
||||||
{
|
{
|
||||||
$ranges = range('A', 'E');
|
$ranges = range('A', 'E');
|
||||||
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||||
$RowCellIndexResult = 'D';
|
$RowCellIndexResult = 'D';
|
||||||
$iterator->seek('D');
|
$iterator->seek('D');
|
||||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||||
|
@ -70,7 +74,7 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testSeekOutOfRange()
|
public function testSeekOutOfRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||||
$iterator->seek(1);
|
$iterator->seek(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +83,7 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testPrevOutOfRange()
|
public function testPrevOutOfRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||||
$iterator->prev();
|
$iterator->prev();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet\RowIterator;
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
|
use PHPExcel\Worksheet\Row;
|
||||||
|
|
||||||
class RowIteratorTest extends \PHPUnit_Framework_TestCase
|
class RowIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public $mockWorksheet;
|
public $mockWorksheet;
|
||||||
|
@ -9,11 +13,11 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->mockRow = $this->getMockBuilder('\PHPExcel\Worksheet\Row')
|
$this->mockRow = $this->getMockBuilder(Row::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -28,31 +32,31 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testIteratorFullRange()
|
public function testIteratorFullRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet);
|
$iterator = new RowIterator($this->mockWorksheet);
|
||||||
$rowIndexResult = 1;
|
$rowIndexResult = 1;
|
||||||
$this->assertEquals($rowIndexResult, $iterator->key());
|
$this->assertEquals($rowIndexResult, $iterator->key());
|
||||||
|
|
||||||
foreach ($iterator as $key => $row) {
|
foreach ($iterator as $key => $row) {
|
||||||
$this->assertEquals($rowIndexResult++, $key);
|
$this->assertEquals($rowIndexResult++, $key);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
|
$this->assertInstanceOf(Row::class, $row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIteratorStartEndRange()
|
public function testIteratorStartEndRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
|
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
|
||||||
$rowIndexResult = 2;
|
$rowIndexResult = 2;
|
||||||
$this->assertEquals($rowIndexResult, $iterator->key());
|
$this->assertEquals($rowIndexResult, $iterator->key());
|
||||||
|
|
||||||
foreach ($iterator as $key => $row) {
|
foreach ($iterator as $key => $row) {
|
||||||
$this->assertEquals($rowIndexResult++, $key);
|
$this->assertEquals($rowIndexResult++, $key);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
|
$this->assertInstanceOf(Row::class, $row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIteratorSeekAndPrev()
|
public function testIteratorSeekAndPrev()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
|
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
|
||||||
$columnIndexResult = 4;
|
$columnIndexResult = 4;
|
||||||
$iterator->seek(4);
|
$iterator->seek(4);
|
||||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||||
|
@ -68,7 +72,7 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testSeekOutOfRange()
|
public function testSeekOutOfRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
|
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
|
||||||
$iterator->seek(1);
|
$iterator->seek(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +81,7 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testPrevOutOfRange()
|
public function testPrevOutOfRange()
|
||||||
{
|
{
|
||||||
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
|
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
|
||||||
$iterator->prev();
|
$iterator->prev();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
|
use PHPExcel\Worksheet\Column;
|
||||||
|
use PHPExcel\Worksheet\ColumnCellIterator;
|
||||||
|
|
||||||
class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
|
class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public $mockWorksheet;
|
public $mockWorksheet;
|
||||||
|
@ -9,7 +13,7 @@ class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->mockWorksheet->expects($this->any())
|
$this->mockWorksheet->expects($this->any())
|
||||||
|
@ -20,24 +24,24 @@ class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testInstantiateColumnDefault()
|
public function testInstantiateColumnDefault()
|
||||||
{
|
{
|
||||||
$column = new \PHPExcel\Worksheet\Column($this->mockWorksheet);
|
$column = new Column($this->mockWorksheet);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\Column', $column);
|
$this->assertInstanceOf(Column::class, $column);
|
||||||
$columnIndex = $column->getColumnIndex();
|
$columnIndex = $column->getColumnIndex();
|
||||||
$this->assertEquals('A', $columnIndex);
|
$this->assertEquals('A', $columnIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInstantiateColumnSpecified()
|
public function testInstantiateColumnSpecified()
|
||||||
{
|
{
|
||||||
$column = new \PHPExcel\Worksheet\Column($this->mockWorksheet, 'E');
|
$column = new Column($this->mockWorksheet, 'E');
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\Column', $column);
|
$this->assertInstanceOf(Column::class, $column);
|
||||||
$columnIndex = $column->getColumnIndex();
|
$columnIndex = $column->getColumnIndex();
|
||||||
$this->assertEquals('E', $columnIndex);
|
$this->assertEquals('E', $columnIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetCellIterator()
|
public function testGetCellIterator()
|
||||||
{
|
{
|
||||||
$column = new \PHPExcel\Worksheet\Column($this->mockWorksheet);
|
$column = new Column($this->mockWorksheet);
|
||||||
$cellIterator = $column->getCellIterator();
|
$cellIterator = $column->getCellIterator();
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\ColumnCellIterator', $cellIterator);
|
$this->assertInstanceOf(ColumnCellIterator::class, $cellIterator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
namespace PhpSpreadsheet\Tests\Worksheet;
|
namespace PhpSpreadsheet\Tests\Worksheet;
|
||||||
|
|
||||||
|
use PHPExcel\Worksheet;
|
||||||
|
use PHPExcel\Worksheet\Row;
|
||||||
|
use PHPExcel\Worksheet\RowCellIterator;
|
||||||
|
|
||||||
class WorksheetRowTest extends \PHPUnit_Framework_TestCase
|
class WorksheetRowTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public $mockWorksheet;
|
public $mockWorksheet;
|
||||||
|
@ -9,7 +13,7 @@ class WorksheetRowTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
|
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->mockWorksheet->expects($this->any())
|
$this->mockWorksheet->expects($this->any())
|
||||||
|
@ -20,24 +24,24 @@ class WorksheetRowTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testInstantiateRowDefault()
|
public function testInstantiateRowDefault()
|
||||||
{
|
{
|
||||||
$row = new \PHPExcel\Worksheet\Row($this->mockWorksheet);
|
$row = new Row($this->mockWorksheet);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
|
$this->assertInstanceOf(Row::class, $row);
|
||||||
$rowIndex = $row->getRowIndex();
|
$rowIndex = $row->getRowIndex();
|
||||||
$this->assertEquals(1, $rowIndex);
|
$this->assertEquals(1, $rowIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInstantiateRowSpecified()
|
public function testInstantiateRowSpecified()
|
||||||
{
|
{
|
||||||
$row = new \PHPExcel\Worksheet\Row($this->mockWorksheet, 5);
|
$row = new Row($this->mockWorksheet, 5);
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
|
$this->assertInstanceOf(Row::class, $row);
|
||||||
$rowIndex = $row->getRowIndex();
|
$rowIndex = $row->getRowIndex();
|
||||||
$this->assertEquals(5, $rowIndex);
|
$this->assertEquals(5, $rowIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetCellIterator()
|
public function testGetCellIterator()
|
||||||
{
|
{
|
||||||
$row = new \PHPExcel\Worksheet\Row($this->mockWorksheet);
|
$row = new Row($this->mockWorksheet);
|
||||||
$cellIterator = $row->getCellIterator();
|
$cellIterator = $row->getCellIterator();
|
||||||
$this->assertInstanceOf('\PHPExcel\Worksheet\RowCellIterator', $cellIterator);
|
$this->assertInstanceOf(RowCellIterator::class, $cellIterator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
"PHPExcel", "8053"
|
"PHPExcel", "8053"
|
||||||
"Mark Baker", "877D"
|
"Mark Baker", "877D"
|
||||||
"!+&=()~§±æþ", "C0EA"
|
"!+&=()~§±æþ", "C0EA"
|
||||||
"μυστικό κωδικό πρόσβασης", "FFFF26DD"
|
|
||||||
"গোপন পাসওয়ার্ড", "E858"
|
|
||||||
"Секретный пароль", "EA5F"
|
|
||||||
"秘密口令", "C07E"
|
"秘密口令", "C07E"
|
||||||
"leyndarmál lykilorð", "99E8"
|
"leyndarmál lykilorð", "99E8"
|
||||||
"", "CE4B"
|
"", "CE4B"
|
||||||
|
|
Loading…
Reference in New Issue