Merge branch 'develop' into feature/gh-7

# Conflicts:
#	tests/PhpSpreadsheet/Shared/DateTest.php
This commit is contained in:
MarkBaker 2016-08-14 15:41:50 +01:00
commit aa97bb3e45
45 changed files with 690 additions and 550 deletions

8
.gitignore vendored
View File

@ -1,6 +1,8 @@
build/PHPExcel.phar
tests/codeCoverage
analysis
/build/PHPExcel.phar
/tests/codeCoverage
/analysis
/vendor/
/composer.lock
## IDE support
*.buildpath

View File

@ -1,35 +1,39 @@
# 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)
# PhpSpreadsheet - OpenXML - Read, Write and Create spreadsheet documents in PHP - Spreadsheet engine
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)
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
### Reading
* BIFF 5-8 (.xls) Excel 95 and above
* Office Open XML (.xlsx) Excel 2007 and above
* SpreadsheetML (.xml) Excel 2003
* Open Document Format/OASIS (.ods)
* Gnumeric
* HTML
* SYLK
* CSV
### Writing
* BIFF 8 (.xls) Excel 95 and above
* 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)
|Format |Reading|Writing|
|--------------------------------------------|:-----:|:-----:|
|Open Document Format/OASIS (.ods) | ✓ | ✓ |
|Office Open XML (.xlsx) Excel 2007 and above| ✓ | ✓ |
|BIFF 8 (.xls) Excel 97 and above | ✓ | ✓ |
|BIFF 5 (.xls) Excel 95 | ✓ | |
|SpreadsheetML (.xml) Excel 2003 | ✓ | |
|Gnumeric | ✓ | |
|HTML | ✓ | ✓ |
|SYLK | ✓ | |
|CSV | ✓ | ✓ |
|PDF (using either the tcPDF, DomPDF or mPDF libraries, which need to be installed separately)| | ✓ |
## Requirements
* 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_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
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)

View File

@ -86,15 +86,15 @@ class Chart extends WriterPart
$objWriter->startElement('c:chart');
$this->writeTitle($pChart->getTitle(), $objWriter);
$this->writeTitle($objWriter, $pChart->getTitle());
$objWriter->startElement('c:autoTitleDeleted');
$objWriter->writeAttribute('val', 0);
$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->writeAttribute('val', 1);
@ -121,12 +121,12 @@ class Chart extends WriterPart
/**
* Write Chart Title
*
* @param Title $title
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
* @param Title $title
*
* @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)) {
return;
@ -154,7 +154,7 @@ class Chart extends WriterPart
$objWriter->endElement();
$objWriter->endElement();
$this->writeLayout($title->getLayout(), $objWriter);
$this->writeLayout($objWriter, $title->getLayout());
$objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', 0);
@ -166,12 +166,12 @@ class Chart extends WriterPart
/**
* Write Chart Legend
*
* @param Legend $legend
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
* @param Legend $legend
*
* @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)) {
return;
@ -183,7 +183,7 @@ class Chart extends WriterPart
$objWriter->writeAttribute('val', $legend->getPosition());
$objWriter->endElement();
$this->writeLayout($legend->getLayout(), $objWriter);
$this->writeLayout($objWriter, $legend->getLayout());
$objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
@ -217,16 +217,17 @@ class Chart extends WriterPart
/**
* Write Chart Plot Area
*
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
* @param \PHPExcel\Worksheet $pSheet
* @param PlotArea $plotArea
* @param Title $xAxisLabel
* @param Title $yAxisLabel
* @param Axis $xAxis
* @param Axis $yAxis
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
*
* @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)) {
return;
@ -238,7 +239,7 @@ class Chart extends WriterPart
$layout = $plotArea->getLayout();
$this->writeLayout($layout, $objWriter);
$this->writeLayout($objWriter, $layout);
$chartTypes = self::getChartType($plotArea);
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
@ -469,7 +470,7 @@ class Chart extends WriterPart
$objWriter->endElement();
$layout = $xAxisLabel->getLayout();
$this->writeLayout($layout, $objWriter);
$this->writeLayout($objWriter, $layout);
$objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', 0);
@ -820,7 +821,7 @@ class Chart extends WriterPart
if ($groupType !== DataSeries::TYPE_BUBBLECHART) {
$layout = $yAxisLabel->getLayout();
$this->writeLayout($layout, $objWriter);
$this->writeLayout($objWriter, $layout);
}
$objWriter->startElement('c:overlay');
@ -1399,12 +1400,12 @@ class Chart extends WriterPart
/**
* Write Layout
*
* @param Layout $layout
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
* @param Layout $layout
*
* @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');

View File

@ -26,7 +26,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -79,7 +79,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -116,7 +116,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -132,7 +132,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -147,9 +147,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
*/
public function testWEEKNUM()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -164,9 +166,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
*/
public function testWEEKDAY()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -182,7 +186,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -198,7 +202,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -209,6 +213,8 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
public function testTIMEtoPHP()
{
$this->markTestIncomplete('TODO: This test should be fixed');
Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC);
$result = DateTime::TIME(7, 30, 20);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -235,7 +241,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -246,6 +252,8 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
public function testTIMEVALUEtoPHP()
{
$this->markTestIncomplete('TODO: This test should be fixed');
Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC);
$result = DateTime::TIMEVALUE('7:30:20');
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -272,7 +280,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -286,9 +294,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
*/
public function testMINUTE()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -302,9 +312,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
*/
public function testSECOND()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -320,7 +332,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -336,7 +348,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -352,7 +364,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -389,7 +401,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -425,9 +437,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
*/
public function testDATEDIF()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -443,7 +457,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -458,9 +472,11 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase
*/
public function testYEARFRAC()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}

View File

@ -2,6 +2,9 @@
namespace PhpSpreadsheet\Tests\Calculation;
use PHPExcel\Calculation\Engineering;
use PHPExcel\Calculation\Functions;
class EngineeringTest extends \PHPUnit_Framework_TestCase
{
@ -13,7 +16,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->complexAssert = new \PhpSpreadsheet\Tests\Custom\ComplexAssert();
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
public function tearDown()
@ -28,7 +31,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -44,7 +47,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -60,7 +63,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -76,7 +79,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -92,7 +95,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -108,7 +111,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -124,7 +127,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -140,7 +143,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -157,7 +160,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -173,7 +176,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -189,7 +192,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -204,9 +207,11 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
*/
public function testIMDIV()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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());
}
@ -222,7 +227,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -238,7 +243,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -254,7 +259,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -270,7 +275,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -285,9 +290,11 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
*/
public function testIMPOWER()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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());
}
@ -303,7 +310,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -319,7 +326,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -335,7 +342,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -350,9 +357,11 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
*/
public function testIMSUB()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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());
}
@ -369,7 +378,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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());
}
@ -385,7 +394,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -401,7 +410,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -417,7 +426,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -433,7 +442,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -449,7 +458,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -465,7 +474,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -481,7 +490,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -497,7 +506,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -513,7 +522,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -529,7 +538,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -545,7 +554,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -561,7 +570,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -577,7 +586,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -593,7 +602,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -609,7 +618,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -625,7 +634,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -636,25 +645,25 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
public function testGetConversionGroups()
{
$result = \PHPExcel\Calculation\Engineering::getConversionGroups();
$result = Engineering::getConversionGroups();
$this->assertInternalType('array', $result);
}
public function testGetConversionGroupUnits()
{
$result = \PHPExcel\Calculation\Engineering::getConversionGroupUnits();
$result = Engineering::getConversionGroupUnits();
$this->assertInternalType('array', $result);
}
public function testGetConversionGroupUnitDetails()
{
$result = \PHPExcel\Calculation\Engineering::getConversionGroupUnitDetails();
$result = Engineering::getConversionGroupUnitDetails();
$this->assertInternalType('array', $result);
}
public function testGetConversionMultipliers()
{
$result = \PHPExcel\Calculation\Engineering::getConversionMultipliers();
$result = Engineering::getConversionMultipliers();
$this->assertInternalType('array', $result);
}
@ -665,7 +674,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,12 +2,15 @@
namespace PhpSpreadsheet\Tests\Calculation;
use PHPExcel\Calculation\Financial;
use PHPExcel\Calculation\Functions;
class FinancialTest extends \PHPUnit_Framework_TestCase
{
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();
$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);
}
@ -34,7 +37,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -50,7 +53,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -66,7 +69,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -82,7 +85,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -98,7 +101,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -114,7 +117,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -130,7 +133,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -146,7 +149,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -162,7 +165,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -178,7 +181,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -194,7 +197,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -210,7 +213,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -226,7 +229,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -242,7 +245,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -258,7 +261,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -274,7 +277,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -290,7 +293,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -306,7 +309,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -322,7 +325,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -338,7 +341,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -354,7 +357,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -370,7 +373,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -386,7 +389,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -402,7 +405,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -418,7 +421,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -434,7 +437,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -450,7 +453,7 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -465,9 +468,11 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
*/
public function testPRICE()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -482,9 +487,11 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
*/
public function testRATE()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -499,9 +506,11 @@ class FinancialTest extends \PHPUnit_Framework_TestCase
*/
public function testXIRR()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}

View File

@ -2,59 +2,61 @@
namespace PhpSpreadsheet\Tests\Calculation;
use PHPExcel\Calculation\Functions;
class FunctionsTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
public function testDUMMY()
{
$result = \PHPExcel\Calculation\Functions::DUMMY();
$result = Functions::DUMMY();
$this->assertEquals('#Not Yet Implemented', $result);
}
public function testDIV0()
{
$result = \PHPExcel\Calculation\Functions::DIV0();
$result = Functions::DIV0();
$this->assertEquals('#DIV/0!', $result);
}
public function testNA()
{
$result = \PHPExcel\Calculation\Functions::NA();
$result = Functions::NA();
$this->assertEquals('#N/A', $result);
}
public function testNAN()
{
$result = \PHPExcel\Calculation\Functions::NAN();
$result = Functions::NAN();
$this->assertEquals('#NUM!', $result);
}
public function testNAME()
{
$result = \PHPExcel\Calculation\Functions::NAME();
$result = Functions::NAME();
$this->assertEquals('#NAME?', $result);
}
public function testREF()
{
$result = \PHPExcel\Calculation\Functions::REF();
$result = Functions::REF();
$this->assertEquals('#REF!', $result);
}
public function testNULL()
{
$result = \PHPExcel\Calculation\Functions::null();
$result = Functions::null();
$this->assertEquals('#NULL!', $result);
}
public function testVALUE()
{
$result = \PHPExcel\Calculation\Functions::VALUE();
$result = Functions::VALUE();
$this->assertEquals('#VALUE!', $result);
}
@ -65,7 +67,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -81,7 +83,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -97,7 +99,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -113,7 +115,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -129,7 +131,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -145,7 +147,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -161,7 +163,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -177,7 +179,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -193,7 +195,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -209,7 +211,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -225,7 +227,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -241,7 +243,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -257,7 +259,7 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,23 +2,26 @@
namespace PhpSpreadsheet\Tests\Calculation;
use PHPExcel\Calculation\Functions;
use PHPExcel\Calculation\Logical;
class LogicalTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
\PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL);
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
public function testTRUE()
{
$result = \PHPExcel\Calculation\Logical::TRUE();
$result = Logical::TRUE();
$this->assertEquals(true, $result);
}
public function testFALSE()
{
$result = \PHPExcel\Calculation\Logical::FALSE();
$result = Logical::FALSE();
$this->assertEquals(false, $result);
}
@ -29,7 +32,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -45,7 +48,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -61,7 +64,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -77,7 +80,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -93,7 +96,7 @@ class LogicalTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,6 +2,9 @@
namespace PhpSpreadsheet\Tests\Calculation;
use PHPExcel\Calculation\Functions;
use PHPExcel\Calculation\LookupRef;
/**
* Class LookupRefTest
* @package PHPExcel\Calculation
@ -11,7 +14,7 @@ class LookupRefTest extends \PHPUnit_Framework_TestCase
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();
$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);
}
@ -39,7 +42,7 @@ class LookupRefTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,12 +2,16 @@
namespace PhpSpreadsheet\Tests\Calculation;
use PHPExcel\Calculation;
use PHPExcel\Calculation\Functions;
use PHPExcel\Calculation\MathTrig;
class MathTrigTest extends \PHPUnit_Framework_TestCase
{
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();
$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);
}
@ -33,7 +37,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -49,7 +53,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -65,7 +69,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -81,7 +85,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -97,7 +101,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -113,7 +117,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -129,7 +133,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -145,7 +149,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -161,7 +165,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -177,7 +181,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -193,7 +197,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -209,7 +213,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -225,7 +229,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -241,7 +245,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -256,9 +260,11 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
*/
public function testMDETERM()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -273,9 +279,11 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
*/
public function testMINVERSE()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -290,9 +298,11 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
*/
public function testMMULT()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}
@ -308,7 +318,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -324,9 +334,9 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
\PHPExcel\Calculation::setArrayReturnType(\PHPExcel\Calculation::RETURN_ARRAY_AS_VALUE);
$result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MROUND'), $args);
\PHPExcel\Calculation::setArrayReturnType(\PHPExcel\Calculation::RETURN_ARRAY_AS_ARRAY);
Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE);
$result = call_user_func_array(array(MathTrig::class,'MROUND'), $args);
Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_ARRAY);
$this->assertEquals($expectedResult, $result, null, 1E-12);
}
@ -342,7 +352,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -358,7 +368,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -374,7 +384,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -390,7 +400,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -406,7 +416,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -422,7 +432,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -438,7 +448,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -454,7 +464,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -470,7 +480,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -486,7 +496,7 @@ class MathTrigTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,12 +2,16 @@
namespace PhpSpreadsheet\Tests\Calculation;
use PHPExcel\Shared\StringHelper;
use PHPExcel\Calculation\Functions;
use PHPExcel\Calculation\TextData;
class TextDataTest extends \PHPUnit_Framework_TestCase
{
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();
$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);
}
@ -33,7 +37,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -49,7 +53,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -65,7 +69,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -81,7 +85,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -97,7 +101,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -113,7 +117,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -129,7 +133,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -145,7 +149,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -161,7 +165,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -177,7 +181,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -193,7 +197,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -209,7 +213,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -225,7 +229,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -241,7 +245,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -257,7 +261,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -273,7 +277,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -289,7 +293,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -305,7 +309,7 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -320,13 +324,13 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
public function testTEXT()
{
// 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('\PHPExcel\Shared\StringHelper', 'setThousandsSeparator'), ',');
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setCurrencyCode'), '$');
call_user_func(array(StringHelper::class, 'setDecimalSeparator'), '.');
call_user_func(array(StringHelper::class, 'setThousandsSeparator'), ',');
call_user_func(array(StringHelper::class, 'setCurrencyCode'), '$');
$args = func_get_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);
}
@ -340,13 +344,13 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
*/
public function testVALUE()
{
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setDecimalSeparator'), '.');
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setThousandsSeparator'), ' ');
call_user_func(array('\PHPExcel\Shared\StringHelper', 'setCurrencyCode'), '$');
call_user_func(array(StringHelper::class, 'setDecimalSeparator'), '.');
call_user_func(array(StringHelper::class, 'setThousandsSeparator'), ' ');
call_user_func(array(StringHelper::class, 'setCurrencyCode'), '$');
$args = func_get_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);
}

View File

@ -1,12 +1,15 @@
<?php
namespace PHPExcel;
namespace PhpSpreadsheet\Tests;
use PHPExcel\Calculation;
use PHPExcel\Calculation\Functions;
class CalculationTest extends \PHPUnit_Framework_TestCase
{
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)
{
Calculation\Functions::setCompatibilityMode(Calculation\Functions::COMPATIBILITY_EXCEL);
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
$resultExcel = Calculation::getInstance()->_calculateFormulaValue($formula);
$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);
$this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, 'should be OpenOffice compatible');
}

View File

@ -2,6 +2,14 @@
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
{
public function setUp()
@ -14,14 +22,14 @@ class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
public function provider()
{
if (!class_exists('\\PHPExcel\\Style\\NumberFormat')) {
if (!class_exists(NumberFormat::class)) {
$this->setUp();
}
$currencyUSD = \PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
$currencyEURO = str_replace('$', '€', \PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$currencyUSD = NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
$currencyEURO = str_replace('$', '€', NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
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('$1,010.12', 1010.12, $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)
{
$sheet = $this->getMock(
'\\PHPExcel\\Worksheet',
Worksheet::class,
array('getStyle', 'getNumberFormat', 'setFormatCode','getCellCacheController')
);
$cache = $this->getMockBuilder('\\PHPExcel\\CachedObjectStorage\\Memory')
$cache = $this->getMockBuilder(Memory::class)
->disableOriginalConstructor()
->getMock();
$cache->expects($this->any())
@ -62,13 +70,13 @@ class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
->method('getCellCacheController')
->will($this->returnValue($cache));
\PHPExcel\Shared\StringHelper::setCurrencyCode($currencyCode);
\PHPExcel\Shared\StringHelper::setDecimalSeparator($decimalSeparator);
\PHPExcel\Shared\StringHelper::setThousandsSeparator($thousandsSeparator);
StringHelper::setCurrencyCode($currencyCode);
StringHelper::setDecimalSeparator($decimalSeparator);
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);
$this->assertEquals($valueBinded, $cell->getValue());
}

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Cell;
use PHPExcel\Cell\DataType;
class DataTypeTest extends \PHPUnit_Framework_TestCase
{
@ -15,7 +17,7 @@ class DataTypeTest extends \PHPUnit_Framework_TestCase
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->assertGreaterThan(0, count($result));
$this->assertArrayHasKey('#NULL!', $result);

View File

@ -2,6 +2,11 @@
namespace PhpSpreadsheet\Tests\Cell;
use PHPExcel\Cell\DefaultValueBinder;
use PHPExcel\Cell;
use PHPExcel\RichText;
use PHPExcel\Cell\DataType;
class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
{
protected $cellStub;
@ -17,7 +22,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
protected function createCellStub()
{
// Create a stub for the Cell class.
$this->cellStub = $this->getMockBuilder('\\PHPExcel\\Cell')
$this->cellStub = $this->getMockBuilder(Cell::class)
->disableOriginalConstructor()
->getMock();
// Configure the stub.
@ -32,7 +37,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
public function testBindValue($value)
{
$this->createCellStub();
$binder = new \PHPExcel\Cell\DefaultValueBinder();
$binder = new DefaultValueBinder();
$result = $binder->bindValue($this->cellStub, $value);
$this->assertTrue($result);
}
@ -61,7 +66,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
public function testDataTypeForValue()
{
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);
}
@ -72,11 +77,11 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
public function testDataTypeForRichTextObject()
{
$objRichText = new \PHPExcel\RichText();
$objRichText = new RichText();
$objRichText->createText('Hello World');
$expectedResult = \PHPExcel\Cell\DataType::TYPE_INLINE;
$result = call_user_func(array('\\PHPExcel\\Cell\\DefaultValueBinder','dataTypeForValue'), $objRichText);
$expectedResult = DataType::TYPE_INLINE;
$result = call_user_func(array(DefaultValueBinder::class,'dataTypeForValue'), $objRichText);
$this->assertEquals($expectedResult, $result);
}
}

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Cell;
use PHPExcel\Cell\Hyperlink;
class HyperlinkTest extends \PHPUnit_Framework_TestCase
{
@ -17,7 +19,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
{
$urlValue = 'http://www.phpexcel.net';
$testInstance = new \PHPExcel\Cell\Hyperlink($urlValue);
$testInstance = new Hyperlink($urlValue);
$result = $testInstance->getUrl();
$this->assertEquals($urlValue, $result);
@ -28,9 +30,9 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
$initialUrlValue = 'http://www.phpexcel.net';
$newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
$testInstance = new \PHPExcel\Cell\Hyperlink($initialUrlValue);
$testInstance = new Hyperlink($initialUrlValue);
$result = $testInstance->setUrl($newUrlValue);
$this->assertTrue($result instanceof \PHPExcel\Cell\Hyperlink);
$this->assertTrue($result instanceof Hyperlink);
$result = $testInstance->getUrl();
$this->assertEquals($newUrlValue, $result);
@ -40,7 +42,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
{
$tooltipValue = 'PHPExcel Web Site';
$testInstance = new \PHPExcel\Cell\Hyperlink(null, $tooltipValue);
$testInstance = new Hyperlink(null, $tooltipValue);
$result = $testInstance->getTooltip();
$this->assertEquals($tooltipValue, $result);
@ -51,9 +53,9 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
$initialTooltipValue = 'PHPExcel Web Site';
$newTooltipValue = 'PHPExcel Repository on Github';
$testInstance = new \PHPExcel\Cell\Hyperlink(null, $initialTooltipValue);
$testInstance = new Hyperlink(null, $initialTooltipValue);
$result = $testInstance->setTooltip($newTooltipValue);
$this->assertTrue($result instanceof \PHPExcel\Cell\Hyperlink);
$this->assertTrue($result instanceof Hyperlink);
$result = $testInstance->getTooltip();
$this->assertEquals($newTooltipValue, $result);
@ -64,7 +66,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
$initialUrlValue = 'http://www.phpexcel.net';
$newUrlValue = 'sheet://Worksheet1!A1';
$testInstance = new \PHPExcel\Cell\Hyperlink($initialUrlValue);
$testInstance = new Hyperlink($initialUrlValue);
$result = $testInstance->isInternal();
$this->assertFalse($result);
@ -79,7 +81,7 @@ class HyperlinkTest extends \PHPUnit_Framework_TestCase
$tooltipValue = 'PHPExcel Web Site';
$initialExpectedHash = '176f1ec64e84084db814481bd710b6b3';
$testInstance = new \PHPExcel\Cell\Hyperlink($urlValue, $tooltipValue);
$testInstance = new Hyperlink($urlValue, $tooltipValue);
$result = $testInstance->getHashCode();
$this->assertEquals($initialExpectedHash, $result);

View File

@ -1,14 +1,12 @@
<?php
namespace PHPExcel;
namespace PhpSpreadsheet\Tests;
use PHPExcel\Cell;
use PHPExcel\Exception;
class CellTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
}
/**
* @dataProvider providerColumnString
*/
@ -16,7 +14,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -29,9 +27,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellAddress = 'ABCD';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','columnIndexFromString'), $cellAddress);
$result = call_user_func(array(Cell::class,'columnIndexFromString'), $cellAddress);
} 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');
return;
}
@ -42,9 +40,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellAddress = '';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','columnIndexFromString'), $cellAddress);
$result = call_user_func(array(Cell::class,'columnIndexFromString'), $cellAddress);
} catch (\Exception $e) {
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
$this->assertInstanceOf(Exception::class, $e);
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
return;
}
@ -58,7 +56,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -74,7 +72,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -87,9 +85,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellAddress = 'A1:AI2012';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','coordinateFromString'), $cellAddress);
$result = call_user_func(array(Cell::class,'coordinateFromString'), $cellAddress);
} 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');
return;
}
@ -100,9 +98,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellAddress = '';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','coordinateFromString'), $cellAddress);
$result = call_user_func(array(Cell::class,'coordinateFromString'), $cellAddress);
} 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');
return;
}
@ -113,9 +111,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellAddress = 'AI';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','coordinateFromString'), $cellAddress);
$result = call_user_func(array(Cell::class,'coordinateFromString'), $cellAddress);
} catch (\Exception $e) {
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
$this->assertInstanceOf(Exception::class, $e);
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate '.$cellAddress);
return;
}
@ -129,7 +127,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -142,9 +140,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellAddress = 'A1:AI2012';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','absoluteCoordinate'), $cellAddress);
$result = call_user_func(array(Cell::class,'absoluteCoordinate'), $cellAddress);
} 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');
return;
}
@ -158,7 +156,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -171,9 +169,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellAddress = 'A1:AI2012';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','absoluteReference'), $cellAddress);
$result = call_user_func(array(Cell::class,'absoluteReference'), $cellAddress);
} 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');
return;
}
@ -187,7 +185,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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) {
if (!is_array($expectedResult[$key])) {
$this->assertEquals($expectedResult[$key], $split[0]);
@ -209,7 +207,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -222,9 +220,9 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$cellRange = '';
try {
$result = call_user_func(array('\\PHPExcel\\Cell','buildRange'), $cellRange);
$result = call_user_func(array(Cell::class,'buildRange'), $cellRange);
} catch (\Exception $e) {
$this->assertInstanceOf('\\PHPExcel\\Exception', $e);
$this->assertInstanceOf(Exception::class, $e);
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
return;
}
@ -238,7 +236,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -254,7 +252,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -270,7 +268,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -286,7 +284,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,6 +2,9 @@
namespace PhpSpreadsheet\Tests\Chart;
use PHPExcel\Chart\DataSeriesValues;
use PHPExcel\Exception;
class DataSeriesValuesTest extends \PHPUnit_Framework_TestCase
{
public function testSetDataType()
@ -11,21 +14,21 @@ class DataSeriesValuesTest extends \PHPUnit_Framework_TestCase
'String'
);
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
$testInstance = new DataSeriesValues;
foreach ($dataTypeValues as $dataTypeValue) {
$result = $testInstance->setDataType($dataTypeValue);
$this->assertTrue($result instanceof \PHPExcel\Chart\DataSeriesValues);
$this->assertTrue($result instanceof DataSeriesValues);
}
}
public function testSetInvalidDataTypeThrowsException()
{
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
$testInstance = new DataSeriesValues;
try {
$result = $testInstance->setDataType('BOOLEAN');
} catch (\PHPExcel\Exception $e) {
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values');
return;
}
@ -36,7 +39,7 @@ class DataSeriesValuesTest extends \PHPUnit_Framework_TestCase
{
$dataTypeValue = 'String';
$testInstance = new \PHPExcel\Chart\DataSeriesValues;
$testInstance = new DataSeriesValues;
$setValue = $testInstance->setDataType($dataTypeValue);
$result = $testInstance->getDataType();

View File

@ -2,23 +2,25 @@
namespace PhpSpreadsheet\Tests\Chart;
use PHPExcel\Chart\Layout;
class LayoutTest extends \PHPUnit_Framework_TestCase
{
public function testSetLayoutTarget()
{
$LayoutTargetValue = 'String';
$testInstance = new \PHPExcel\Chart\Layout;
$testInstance = new Layout;
$result = $testInstance->setLayoutTarget($LayoutTargetValue);
$this->assertTrue($result instanceof \PHPExcel\Chart\Layout);
$this->assertTrue($result instanceof Layout);
}
public function testGetLayoutTarget()
{
$LayoutTargetValue = 'String';
$testInstance = new \PHPExcel\Chart\Layout;
$testInstance = new Layout;
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue);
$result = $testInstance->getLayoutTarget();

View File

@ -2,19 +2,21 @@
namespace PhpSpreadsheet\Tests\Chart;
use PHPExcel\Chart\Legend;
class LegendTest extends \PHPUnit_Framework_TestCase
{
public function testSetPosition()
{
$positionValues = array(
\PHPExcel\Chart\Legend::POSITION_RIGHT,
\PHPExcel\Chart\Legend::POSITION_LEFT,
\PHPExcel\Chart\Legend::POSITION_TOP,
\PHPExcel\Chart\Legend::POSITION_BOTTOM,
\PHPExcel\Chart\Legend::POSITION_TOPRIGHT,
Legend::POSITION_RIGHT,
Legend::POSITION_LEFT,
Legend::POSITION_TOP,
Legend::POSITION_BOTTOM,
Legend::POSITION_TOPRIGHT,
);
$testInstance = new \PHPExcel\Chart\Legend;
$testInstance = new Legend;
foreach ($positionValues as $positionValue) {
$result = $testInstance->setPosition($positionValue);
@ -24,20 +26,20 @@ class LegendTest extends \PHPUnit_Framework_TestCase
public function testSetInvalidPositionReturnsFalse()
{
$testInstance = new \PHPExcel\Chart\Legend;
$testInstance = new Legend;
$result = $testInstance->setPosition('BottomLeft');
$this->assertFalse($result);
// Ensure that value is unchanged
$result = $testInstance->getPosition();
$this->assertEquals(\PHPExcel\Chart\Legend::POSITION_RIGHT, $result);
$this->assertEquals(Legend::POSITION_RIGHT, $result);
}
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);
$result = $testInstance->getPosition();
@ -47,15 +49,15 @@ class LegendTest extends \PHPUnit_Framework_TestCase
public function testSetPositionXL()
{
$positionValues = array(
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_BOTTOM,
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_CORNER,
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_CUSTOM,
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_LEFT,
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_RIGHT,
\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_TOP,
Legend::XL_LEGEND_POSITION_BOTTOM,
Legend::XL_LEGEND_POSITION_CORNER,
Legend::XL_LEGEND_POSITION_CUSTOM,
Legend::XL_LEGEND_POSITION_LEFT,
Legend::XL_LEGEND_POSITION_RIGHT,
Legend::XL_LEGEND_POSITION_TOP,
);
$testInstance = new \PHPExcel\Chart\Legend;
$testInstance = new Legend;
foreach ($positionValues as $positionValue) {
$result = $testInstance->setPositionXL($positionValue);
@ -65,20 +67,20 @@ class LegendTest extends \PHPUnit_Framework_TestCase
public function testSetInvalidXLPositionReturnsFalse()
{
$testInstance = new \PHPExcel\Chart\Legend;
$testInstance = new Legend;
$result = $testInstance->setPositionXL(999);
$this->assertFalse($result);
// Ensure that value is unchanged
$result = $testInstance->getPositionXL();
$this->assertEquals(\PHPExcel\Chart\Legend::XL_LEGEND_POSITION_RIGHT, $result);
$this->assertEquals(Legend::XL_LEGEND_POSITION_RIGHT, $result);
}
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);
$result = $testInstance->getPositionXL();
@ -92,7 +94,7 @@ class LegendTest extends \PHPUnit_Framework_TestCase
false,
);
$testInstance = new \PHPExcel\Chart\Legend;
$testInstance = new Legend;
foreach ($overlayValues as $overlayValue) {
$result = $testInstance->setOverlay($overlayValue);
@ -102,7 +104,7 @@ class LegendTest extends \PHPUnit_Framework_TestCase
public function testSetInvalidOverlayReturnsFalse()
{
$testInstance = new \PHPExcel\Chart\Legend;
$testInstance = new Legend;
$result = $testInstance->setOverlay('INVALID');
$this->assertFalse($result);
@ -115,7 +117,7 @@ class LegendTest extends \PHPUnit_Framework_TestCase
{
$OverlayValue = true;
$testInstance = new \PHPExcel\Chart\Legend;
$testInstance = new Legend;
$setValue = $testInstance->setOverlay($OverlayValue);
$result = $testInstance->getOverlay();

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Custom;
use PHPExcel\Exception;
class Complex
{
private $realPart = 0;
@ -33,7 +35,7 @@ class Complex
// Neither real nor imaginary part, so test to see if we actually have a suffix
$validComplex = preg_match('/^([\-\+]?)([ij])$/ui', $complexNumber, $complexParts);
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)
$imaginary = 1;

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Reader;
use PHPExcel\Reader\BaseReader;
class XEEValidatorTest extends \PHPUnit_Framework_TestCase
{
/**
@ -10,7 +12,7 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase
*/
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';
$result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result);
@ -30,7 +32,7 @@ class XEEValidatorTest extends \PHPUnit_Framework_TestCase
*/
public function testValidXML($filename, $expectedResult)
{
$reader = $this->getMockForAbstractClass('\PHPExcel\Reader\BaseReader');
$reader = $this->getMockForAbstractClass(BaseReader::class);
$result = $reader->securityScanFile($filename);
$this->assertEquals($expectedResult, $result);
}

View File

@ -1,6 +1,8 @@
<?php
namespace PHPExcel;
namespace PhpSpreadsheet\Tests;
use PHPExcel\ReferenceHelper;
class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
{
@ -24,7 +26,7 @@ class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
'BZA','BZB','BZZ'
];
shuffle($columnBase);
usort($columnBase, array('\\PHPExcel\\ReferenceHelper','columnSort'));
usort($columnBase, array(ReferenceHelper::class,'columnSort'));
foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value);
}
@ -46,7 +48,7 @@ class ReferenceHelperTest extends \PHPUnit_Framework_TestCase
];
shuffle($columnBase);
$columnExpectedResult = array_reverse($columnExpectedResult);
usort($columnBase, array('\\PHPExcel\\ReferenceHelper','columnReverseSort'));
usort($columnBase, array(ReferenceHelper::class,'columnReverseSort'));
foreach ($columnBase as $key => $value) {
$this->assertEquals($columnExpectedResult[$key], $value);
}

View File

@ -1,6 +1,6 @@
<?php
namespace PHPExcel;
namespace PhpSpreadsheet\Tests;
class SettingsTest extends \PHPUnit_Framework_TestCase
{

View File

@ -2,6 +2,9 @@
namespace PhpSpreadsheet\Tests\Shared;
use PHPExcel\Shared\CodePage;
use PHPExcel\Exception;
class CodePageTest extends \PHPUnit_Framework_TestCase
{
/**
@ -11,7 +14,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -24,8 +27,8 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
{
$invalidCodePage = 12345;
try {
$result = call_user_func(array('\PHPExcel\Shared\CodePage','numberToName'), $invalidCodePage);
} catch (\PHPExcel\Exception $e) {
$result = call_user_func(array(CodePage::class,'numberToName'), $invalidCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
return;
}
@ -36,8 +39,8 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
{
$unsupportedCodePage = 720;
try {
$result = call_user_func(array('\PHPExcel\Shared\CodePage','numberToName'), $unsupportedCodePage);
} catch (\PHPExcel\Exception $e) {
$result = call_user_func(array(CodePage::class,'numberToName'), $unsupportedCodePage);
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
return;
}

View File

@ -2,19 +2,19 @@
namespace PhpSpreadsheet\Tests\Shared;
use PhpSpreadsheet\TestDataFileIterator;
use PHPExcel\Shared\Date;
class DateTest extends \PHPUnit_Framework_TestCase
{
public function testSetExcelCalendar()
{
$calendarValues = array(
\PHPExcel\Shared\Date::CALENDAR_MAC_1904,
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900,
Date::CALENDAR_MAC_1904,
Date::CALENDAR_WINDOWS_1900,
);
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);
}
}
@ -22,7 +22,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
public function testSetExcelCalendarWithInvalidValue()
{
$unsupportedCalendar = '2012';
$result = call_user_func(array('\PHPExcel\Shared\Date','setExcelCalendar'), $unsupportedCalendar);
$result = call_user_func(array(Date::class,'setExcelCalendar'), $unsupportedCalendar);
$this->assertFalse($result);
}
@ -32,13 +32,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
public function testDateTimeExcelToTimestamp1900()
{
$result = call_user_func(
array('\PHPExcel\Shared\Date','setExcelCalendar'),
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
array(Date::class,'setExcelCalendar'),
Date::CALENDAR_WINDOWS_1900
);
$args = func_get_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);
}
@ -53,13 +53,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
public function testDateTimePHPToExcel1900()
{
$result = call_user_func(
array('\PHPExcel\Shared\Date','setExcelCalendar'),
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
array(Date::class,'setExcelCalendar'),
Date::CALENDAR_WINDOWS_1900
);
$args = func_get_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);
}
@ -74,13 +74,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
public function testDateTimeFormattedPHPToExcel1900()
{
$result = call_user_func(
array('\PHPExcel\Shared\Date','setExcelCalendar'),
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
array(Date::class,'setExcelCalendar'),
Date::CALENDAR_WINDOWS_1900
);
$args = func_get_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);
}
@ -95,13 +95,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
public function testDateTimeExcelToTimestamp1904()
{
$result = call_user_func(
array('\PHPExcel\Shared\Date','setExcelCalendar'),
\PHPExcel\Shared\Date::CALENDAR_MAC_1904
array(Date::class,'setExcelCalendar'),
Date::CALENDAR_MAC_1904
);
$args = func_get_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);
}
@ -116,13 +116,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
public function testDateTimePHPToExcel1904()
{
$result = call_user_func(
array('\PHPExcel\Shared\Date','setExcelCalendar'),
\PHPExcel\Shared\Date::CALENDAR_MAC_1904
array(Date::class,'setExcelCalendar'),
Date::CALENDAR_MAC_1904
);
$args = func_get_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);
}
@ -138,7 +138,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -149,18 +149,17 @@ class DateTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerDateTimeExcelToTimestamp1900Timezone
* @group fail19
*/
public function testDateTimeExcelToTimestamp1900Timezone()
{
$result = call_user_func(
array('\PHPExcel\Shared\Date','setExcelCalendar'),
\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900
array(Date::class,'setExcelCalendar'),
Date::CALENDAR_WINDOWS_1900
);
$args = func_get_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);
}

View File

@ -2,13 +2,15 @@
namespace PhpSpreadsheet\Tests\Shared;
use PHPExcel\Shared\File;
class FileTest extends \PHPUnit_Framework_TestCase
{
public function testGetUseUploadTempDirectory()
{
$expectedResult = false;
$result = call_user_func(array('\PHPExcel\Shared\File','getUseUploadTempDirectory'));
$result = call_user_func(array(File::class,'getUseUploadTempDirectory'));
$this->assertEquals($expectedResult, $result);
}
@ -20,9 +22,9 @@ class FileTest extends \PHPUnit_Framework_TestCase
);
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);
}
}

View File

@ -2,25 +2,27 @@
namespace PhpSpreadsheet\Tests\Shared;
use PHPExcel\Shared\Font;
class FontTest extends \PHPUnit_Framework_TestCase
{
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);
}
public function testSetAutoSizeMethod()
{
$autosizeMethodValues = array(
\PHPExcel\Shared\Font::AUTOSIZE_METHOD_EXACT,
\PHPExcel\Shared\Font::AUTOSIZE_METHOD_APPROX,
Font::AUTOSIZE_METHOD_EXACT,
Font::AUTOSIZE_METHOD_APPROX,
);
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);
}
}
@ -29,7 +31,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
{
$unsupportedAutosizeMethod = 'guess';
$result = call_user_func(array('\PHPExcel\Shared\Font','setAutoSizeMethod'), $unsupportedAutosizeMethod);
$result = call_user_func(array(Font::class,'setAutoSizeMethod'), $unsupportedAutosizeMethod);
$this->assertFalse($result);
}
@ -40,7 +42,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -56,7 +58,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -72,7 +74,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Shared;
use PHPExcel\Shared\PasswordHasher;
class PasswordHasherTest extends \PHPUnit_Framework_TestCase
{
/**
@ -12,7 +14,7 @@ class PasswordHasherTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Shared;
use PHPExcel\Shared\StringHelper;
class StringTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
@ -9,18 +11,18 @@ class StringTest extends \PHPUnit_Framework_TestCase
parent::setUp();
// Reset Currency Code
call_user_func(array('\PHPExcel\Shared\StringHelper','setCurrencyCode'), null);
call_user_func(array(StringHelper::class,'setCurrencyCode'), null);
}
public function testGetIsMbStringEnabled()
{
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getIsMbstringEnabled'));
$result = call_user_func(array(StringHelper::class,'getIsMbstringEnabled'));
$this->assertTrue($result);
}
public function testGetIsIconvEnabled()
{
$result = call_user_func(array('\PHPExcel\Shared\StringHelper','getIsIconvEnabled'));
$result = call_user_func(array(StringHelper::class,'getIsIconvEnabled'));
$this->assertTrue($result);
}
@ -29,16 +31,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
$localeconv = localeconv();
$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);
}
public function testSetDecimalSeparator()
{
$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);
}
@ -47,16 +49,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
$localeconv = localeconv();
$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);
}
public function testSetThousandsSeparator()
{
$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);
}
@ -64,16 +66,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
{
$localeconv = localeconv();
$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);
}
public function testSetCurrencyCode()
{
$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);
}
}

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Shared;
use PHPExcel\Shared\TimeZone;
class TimeZoneTest extends \PHPUnit_Framework_TestCase
{
public function testSetTimezone()
@ -15,7 +17,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase
);
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);
}
}
@ -23,7 +25,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase
public function testSetTimezoneWithInvalidValue()
{
$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);
}
}

View File

@ -2,6 +2,8 @@
namespace PhpSpreadsheet\Tests\Style;
use PHPExcel\Style\Color;
class ColorTest extends \PHPUnit_Framework_TestCase
{
/**
@ -11,7 +13,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -27,7 +29,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -43,7 +45,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}
@ -58,7 +60,7 @@ class ColorTest extends \PHPUnit_Framework_TestCase
public function testChangeBrightness()
{
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);
}

View File

@ -2,13 +2,16 @@
namespace PhpSpreadsheet\Tests\Style;
use PHPExcel\Shared\StringHelper;
use PHPExcel\Style\NumberFormat;
class NumberFormatDateTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
\PHPExcel\Shared\StringHelper::setDecimalSeparator('.');
\PHPExcel\Shared\StringHelper::setThousandsSeparator(',');
StringHelper::setDecimalSeparator('.');
StringHelper::setThousandsSeparator(',');
}
/**
@ -16,9 +19,11 @@ class NumberFormatDateTest extends \PHPUnit_Framework_TestCase
*/
public function testFormatValueWithMask()
{
$this->markTestIncomplete('TODO: This test should be fixed');
$args = func_get_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);
}

View File

@ -2,13 +2,16 @@
namespace PhpSpreadsheet\Tests\Style;
use PHPExcel\Shared\StringHelper;
use PHPExcel\Style\NumberFormat;
class NumberFormatTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
\PHPExcel\Shared\StringHelper::setDecimalSeparator('.');
\PHPExcel\Shared\StringHelper::setThousandsSeparator(',');
StringHelper::setDecimalSeparator('.');
StringHelper::setThousandsSeparator(',');
}
/**
@ -18,7 +21,7 @@ class NumberFormatTest extends \PHPUnit_Framework_TestCase
{
$args = func_get_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);
}

View File

@ -2,42 +2,44 @@
namespace PhpSpreadsheet\Tests\Worksheet\AutoFilter\Column;
use PHPExcel\Worksheet\AutoFilter\Column;
class RuleTest extends \PHPUnit_Framework_TestCase
{
private $_testAutoFilterRuleObject;
private $testAutoFilterRuleObject;
private $_mockAutoFilterColumnObject;
private $mockAutoFilterColumnObject;
public function setUp()
{
$this->_mockAutoFilterColumnObject = $this->getMockBuilder('\PHPExcel\Worksheet\AutoFilter\Column')
$this->mockAutoFilterColumnObject = $this->getMockBuilder(Column::class)
->disableOriginalConstructor()
->getMock();
$this->_mockAutoFilterColumnObject->expects($this->any())
$this->mockAutoFilterColumnObject->expects($this->any())
->method('testColumnInRange')
->will($this->returnValue(3));
$this->_testAutoFilterRuleObject = new \PHPExcel\Worksheet\AutoFilter\Column\Rule(
$this->_mockAutoFilterColumnObject
$this->testAutoFilterRuleObject = new Column\Rule(
$this->mockAutoFilterColumnObject
);
}
public function testGetRuleType()
{
$result = $this->_testAutoFilterRuleObject->getRuleType();
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_FILTER, $result);
$result = $this->testAutoFilterRuleObject->getRuleType();
$this->assertEquals(Column\Rule::AUTOFILTER_RULETYPE_FILTER, $result);
}
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
$result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
$result = $this->testAutoFilterRuleObject->setRuleType($expectedResult);
$this->assertInstanceOf(Column\Rule::class, $result);
$result = $this->_testAutoFilterRuleObject->getRuleType();
$result = $this->testAutoFilterRuleObject->getRuleType();
$this->assertEquals($expectedResult, $result);
}
@ -46,59 +48,59 @@ class RuleTest extends \PHPUnit_Framework_TestCase
$expectedResult = 100;
// Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterRuleObject->setValue($expectedResult);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
$result = $this->testAutoFilterRuleObject->setValue($expectedResult);
$this->assertInstanceOf(Column\Rule::class, $result);
$result = $this->_testAutoFilterRuleObject->getValue();
$result = $this->testAutoFilterRuleObject->getValue();
$this->assertEquals($expectedResult, $result);
}
public function testGetOperator()
{
$result = $this->_testAutoFilterRuleObject->getOperator();
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
$result = $this->testAutoFilterRuleObject->getOperator();
$this->assertEquals(Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
}
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
$result = $this->_testAutoFilterRuleObject->setOperator($expectedResult);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
$result = $this->testAutoFilterRuleObject->setOperator($expectedResult);
$this->assertInstanceOf(Column\Rule::class, $result);
$result = $this->_testAutoFilterRuleObject->getOperator();
$result = $this->testAutoFilterRuleObject->getOperator();
$this->assertEquals($expectedResult, $result);
}
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
$result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
$result = $this->testAutoFilterRuleObject->setGrouping($expectedResult);
$this->assertInstanceOf(Column\Rule::class, $result);
$result = $this->_testAutoFilterRuleObject->getGrouping();
$result = $this->testAutoFilterRuleObject->getGrouping();
$this->assertEquals($expectedResult, $result);
}
public function testGetParent()
{
$result = $this->_testAutoFilterRuleObject->getParent();
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = $this->testAutoFilterRuleObject->getParent();
$this->assertInstanceOf(Column::class, $result);
}
public function testSetParent()
{
// Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
$result = $this->testAutoFilterRuleObject->setParent($this->mockAutoFilterColumnObject);
$this->assertInstanceOf(Column\Rule::class, $result);
}
public function testClone()
{
$result = clone $this->_testAutoFilterRuleObject;
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result);
$result = clone $this->testAutoFilterRuleObject;
$this->assertInstanceOf(Column\Rule::class, $result);
}
}

View File

@ -2,34 +2,36 @@
namespace PhpSpreadsheet\Tests\Worksheet\AutoFilter;
use PHPExcel\Worksheet\AutoFilter;
class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
{
private $_testInitialColumn = 'H';
private $testInitialColumn = 'H';
private $_testAutoFilterColumnObject;
private $testAutoFilterColumnObject;
private $_mockAutoFilterObject;
private $mockAutoFilterObject;
public function setUp()
{
$this->_mockAutoFilterObject = $this->getMockBuilder('\PHPExcel\Worksheet\AutoFilter')
$this->mockAutoFilterObject = $this->getMockBuilder(AutoFilter::class)
->disableOriginalConstructor()
->getMock();
$this->_mockAutoFilterObject->expects($this->any())
$this->mockAutoFilterObject->expects($this->any())
->method('testColumnInRange')
->will($this->returnValue(3));
$this->_testAutoFilterColumnObject = new \PHPExcel\Worksheet\AutoFilter\Column(
$this->_testInitialColumn,
$this->_mockAutoFilterObject
$this->testAutoFilterColumnObject = new AutoFilter\Column(
$this->testInitialColumn,
$this->mockAutoFilterObject
);
}
public function testGetColumnIndex()
{
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
$this->assertEquals($this->_testInitialColumn, $result);
$result = $this->testAutoFilterColumnObject->getColumnIndex();
$this->assertEquals($this->testInitialColumn, $result);
}
public function testSetColumnIndex()
@ -37,39 +39,39 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
$expectedResult = 'L';
// Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = $this->testAutoFilterColumnObject->setColumnIndex($expectedResult);
$this->assertInstanceOf(AutoFilter\Column::class, $result);
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
$result = $this->testAutoFilterColumnObject->getColumnIndex();
$this->assertEquals($expectedResult, $result);
}
public function testGetParent()
{
$result = $this->_testAutoFilterColumnObject->getParent();
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter', $result);
$result = $this->testAutoFilterColumnObject->getParent();
$this->assertInstanceOf(AutoFilter::class, $result);
}
public function testSetParent()
{
// Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = $this->testAutoFilterColumnObject->setParent($this->mockAutoFilterObject);
$this->assertInstanceOf(AutoFilter\Column::class, $result);
}
public function testGetFilterType()
{
$result = $this->_testAutoFilterColumnObject->getFilterType();
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
$result = $this->testAutoFilterColumnObject->getFilterType();
$this->assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
}
public function testSetFilterType()
{
$result = $this->_testAutoFilterColumnObject->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = $this->testAutoFilterColumnObject->setFilterType(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
$this->assertInstanceOf(AutoFilter\Column::class, $result);
$result = $this->_testAutoFilterColumnObject->getFilterType();
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
$result = $this->testAutoFilterColumnObject->getFilterType();
$this->assertEquals(AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
}
/**
@ -79,22 +81,22 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
{
$expectedResult = 'Unfiltered';
$result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult);
$result = $this->testAutoFilterColumnObject->setFilterType($expectedResult);
}
public function testGetJoin()
{
$result = $this->_testAutoFilterColumnObject->getJoin();
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
$result = $this->testAutoFilterColumnObject->getJoin();
$this->assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
}
public function testSetJoin()
{
$result = $this->_testAutoFilterColumnObject->setJoin(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = $this->testAutoFilterColumnObject->setJoin(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND);
$this->assertInstanceOf(AutoFilter\Column::class, $result);
$result = $this->_testAutoFilterColumnObject->getJoin();
$this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
$result = $this->testAutoFilterColumnObject->getJoin();
$this->assertEquals(AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
}
/**
@ -104,7 +106,7 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
{
$expectedResult = 'Neither';
$result = $this->_testAutoFilterColumnObject->setJoin($expectedResult);
$result = $this->testAutoFilterColumnObject->setJoin($expectedResult);
}
public function testSetAttributes()
@ -114,8 +116,8 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
);
// Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = $this->testAutoFilterColumnObject->setAttributes($attributeSet);
$this->assertInstanceOf(AutoFilter\Column::class, $result);
}
public function testGetAttributes()
@ -124,9 +126,9 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
'maxVal' => 200
);
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
$this->testAutoFilterColumnObject->setAttributes($attributeSet);
$result = $this->_testAutoFilterColumnObject->getAttributes();
$result = $this->testAutoFilterColumnObject->getAttributes();
$this->assertTrue(is_array($result));
$this->assertEquals(count($attributeSet), count($result));
}
@ -139,8 +141,8 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
foreach ($attributeSet as $attributeName => $attributeValue) {
// Setters return the instance to implement the fluent interface
$result = $this->_testAutoFilterColumnObject->setAttribute($attributeName, $attributeValue);
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = $this->testAutoFilterColumnObject->setAttribute($attributeName, $attributeValue);
$this->assertInstanceOf(AutoFilter\Column::class, $result);
}
}
@ -150,19 +152,19 @@ class AutofilterColumnTest extends \PHPUnit_Framework_TestCase
'maxVal' => 200
);
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
$this->testAutoFilterColumnObject->setAttributes($attributeSet);
foreach ($attributeSet as $attributeName => $attributeValue) {
$result = $this->_testAutoFilterColumnObject->getAttribute($attributeName);
$result = $this->testAutoFilterColumnObject->getAttribute($attributeName);
$this->assertEquals($attributeValue, $result);
}
$result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
$result = $this->testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
$this->assertNull($result);
}
public function testClone()
{
$result = clone $this->_testAutoFilterColumnObject;
$this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result);
$result = clone $this->testAutoFilterColumnObject;
$this->assertInstanceOf(AutoFilter\Column::class, $result);
}
}

View File

@ -3,6 +3,9 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\Worksheet\AutoFilter;
use PHPExcel\Worksheet\AutoFilter\Column;
use PHPExcel\Worksheet;
use PHPExcel\CachedObjectStorage\Memory;
class AutoFilterTest extends \PHPUnit_Framework_TestCase
{
@ -12,17 +15,19 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
private $mockWorksheetObject;
private $mockCacheController;
public function setUp()
{
$this->mockWorksheetObject = $this->getMockBuilder('\\PHPExcel\\Worksheet')
$this->mockWorksheetObject = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
$this->_mockCacheController = $this->getMockBuilder('\\PHPExcel\\CachedObjectStorage\\Memory')
$this->mockCacheController = $this->getMockBuilder(Memory::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheetObject->expects($this->any())
->method('getCellCacheController')
->will($this->returnValue($this->_mockCacheController));
->will($this->returnValue($this->mockCacheController));
$this->testAutoFilterObject = new AutoFilter(
$this->testInitialRange,
@ -42,14 +47,14 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
public function testGetParent()
{
$result = $this->testAutoFilterObject->getParent();
$this->assertInstanceOf('\\PHPExcel\\Worksheet', $result);
$this->assertInstanceOf(Worksheet::class, $result);
}
public function testSetParent()
{
// Setters return the instance to implement the fluent interface
$result = $this->testAutoFilterObject->setParent($this->mockWorksheetObject);
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
}
public function testGetRange()
@ -71,7 +76,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
foreach ($ranges as $actualRange => $fullRange) {
// Setters return the instance to implement the fluent interface
$result = $this->testAutoFilterObject->setRange($fullRange);
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
// Result should be the new autofilter range
$result = $this->testAutoFilterObject->getRange();
@ -85,7 +90,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
// Setters return the instance to implement the fluent interface
$result = $this->testAutoFilterObject->setRange();
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
// Result should be a clear range
$result = $this->testAutoFilterObject->getRange();
@ -142,7 +147,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
// Setters return the instance to implement the fluent interface
$result = $this->testAutoFilterObject->setColumn($expectedResult);
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
$result = $this->testAutoFilterObject->getColumns();
// 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->assertEquals(1, count($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
$result = $this->testAutoFilterObject->setColumn($columnObject);
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
$result = $this->testAutoFilterObject->getColumns();
// 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->assertEquals(1, count($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));
foreach ($columnIndexes as $columnIndex) {
$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
foreach ($columnIndexes as $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
foreach ($columnIndexes as $columnIndex => $columnID) {
$result = $this->testAutoFilterObject->getColumnByOffset($columnIndex);
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter\\Column', $result);
$this->assertInstanceOf(Column::class, $result);
$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
// get a \PHPExcel\Worksheet\AutoFilter\Column object returned
$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
$result = $this->testAutoFilterObject->setRange();
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
// Range should be cleared
$result = $this->testAutoFilterObject->getRange();
@ -313,7 +318,7 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
// Setters return the instance to implement the fluent interface
$result = $this->testAutoFilterObject->setRange($expectedResult);
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
// Range should be correctly set
$result = $this->testAutoFilterObject->getRange();
@ -335,6 +340,6 @@ class AutoFilterTest extends \PHPUnit_Framework_TestCase
}
$result = clone $this->testAutoFilterObject;
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\AutoFilter', $result);
$this->assertInstanceOf(AutoFilter::class, $result);
}
}

View File

@ -2,25 +2,23 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\CachedObjectStorageFactory;
use PHPExcel\Spreadsheet;
class CellCollectionTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
}
public function testCacheLastCell()
{
$methods = \PHPExcel\CachedObjectStorageFactory::getCacheStorageMethods();
$methods = CachedObjectStorageFactory::getCacheStorageMethods();
foreach ($methods as $method) {
\PHPExcel\CachedObjectStorageFactory::initialize($method);
$workbook = new \PHPExcel\Spreadsheet();
CachedObjectStorageFactory::initialize($method);
$workbook = new Spreadsheet();
$cells = ['A1', 'A2'];
$worksheet = $workbook->getActiveSheet();
$worksheet->setCellValue('A1', 1);
$worksheet->setCellValue('A2', 2);
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
\PHPExcel\CachedObjectStorageFactory::finalize();
CachedObjectStorageFactory::finalize();
}
}
}

View File

@ -3,6 +3,8 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\Worksheet\ColumnCellIterator;
use PHPExcel\Cell;
use PHPExcel\Worksheet;
class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
{
@ -11,11 +13,11 @@ class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->mockCell = $this->getMockBuilder('\\PHPExcel\\Cell')
$this->mockCell = $this->getMockBuilder(Cell::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheet = $this->getMockBuilder('\\PHPExcel\\Worksheet')
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
@ -36,7 +38,7 @@ class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase
foreach ($iterator as $key => $ColumnCell) {
$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) {
$this->assertEquals($ColumnCellIndexResult++, $key);
$this->assertInstanceOf('\\PHPExcel\\Cell', $ColumnCell);
$this->assertInstanceOf(Cell::class, $ColumnCell);
}
}

View File

@ -2,7 +2,9 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\Worksheet;
use PHPExcel\Worksheet\ColumnIterator;
use PHPExcel\Worksheet\Column;
class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
{
@ -11,11 +13,11 @@ class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->mockColumn = $this->getMockBuilder('\\PHPExcel\\Worksheet\\Column')
$this->mockColumn = $this->getMockBuilder(Column::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheet = $this->getMockBuilder('\\PHPExcel\\Worksheet')
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
@ -36,7 +38,7 @@ class ColumnIteratorTest extends \PHPUnit_Framework_TestCase
foreach ($iterator as $key => $column) {
$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) {
$this->assertEquals($columnIndexResult++, $key);
$this->assertInstanceOf('\\PHPExcel\\Worksheet\\Column', $column);
$this->assertInstanceOf(Column::class, $column);
}
}

View File

@ -2,6 +2,10 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\Worksheet;
use PHPExcel\Cell;
use PHPExcel\Worksheet\RowCellIterator;
class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
{
public $mockWorksheet;
@ -9,11 +13,11 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
$this->mockCell = $this->getMockBuilder(Cell::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
@ -28,32 +32,32 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
public function testIteratorFullRange()
{
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet);
$iterator = new RowCellIterator($this->mockWorksheet);
$RowCellIndexResult = 'A';
$this->assertEquals($RowCellIndexResult, $iterator->key());
foreach ($iterator as $key => $RowCell) {
$this->assertEquals($RowCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
$this->assertInstanceOf(Cell::class, $RowCell);
}
}
public function testIteratorStartEndRange()
{
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$RowCellIndexResult = 'B';
$this->assertEquals($RowCellIndexResult, $iterator->key());
foreach ($iterator as $key => $RowCell) {
$this->assertEquals($RowCellIndexResult++, $key);
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
$this->assertInstanceOf(Cell::class, $RowCell);
}
}
public function testIteratorSeekAndPrev()
{
$ranges = range('A', 'E');
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$RowCellIndexResult = 'D';
$iterator->seek('D');
$this->assertEquals($RowCellIndexResult, $iterator->key());
@ -70,7 +74,7 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
*/
public function testSeekOutOfRange()
{
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator->seek(1);
}
@ -79,7 +83,7 @@ class RowCellIteratorTest extends \PHPUnit_Framework_TestCase
*/
public function testPrevOutOfRange()
{
$iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator = new RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$iterator->prev();
}
}

View File

@ -2,6 +2,10 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\Worksheet\RowIterator;
use PHPExcel\Worksheet;
use PHPExcel\Worksheet\Row;
class RowIteratorTest extends \PHPUnit_Framework_TestCase
{
public $mockWorksheet;
@ -9,11 +13,11 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->mockRow = $this->getMockBuilder('\PHPExcel\Worksheet\Row')
$this->mockRow = $this->getMockBuilder(Row::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
@ -28,31 +32,31 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
public function testIteratorFullRange()
{
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet);
$iterator = new RowIterator($this->mockWorksheet);
$rowIndexResult = 1;
$this->assertEquals($rowIndexResult, $iterator->key());
foreach ($iterator as $key => $row) {
$this->assertEquals($rowIndexResult++, $key);
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
$this->assertInstanceOf(Row::class, $row);
}
}
public function testIteratorStartEndRange()
{
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
$rowIndexResult = 2;
$this->assertEquals($rowIndexResult, $iterator->key());
foreach ($iterator as $key => $row) {
$this->assertEquals($rowIndexResult++, $key);
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
$this->assertInstanceOf(Row::class, $row);
}
}
public function testIteratorSeekAndPrev()
{
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
$columnIndexResult = 4;
$iterator->seek(4);
$this->assertEquals($columnIndexResult, $iterator->key());
@ -68,7 +72,7 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
*/
public function testSeekOutOfRange()
{
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
$iterator->seek(1);
}
@ -77,7 +81,7 @@ class RowIteratorTest extends \PHPUnit_Framework_TestCase
*/
public function testPrevOutOfRange()
{
$iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4);
$iterator = new RowIterator($this->mockWorksheet, 2, 4);
$iterator->prev();
}
}

View File

@ -2,6 +2,10 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\Worksheet;
use PHPExcel\Worksheet\Column;
use PHPExcel\Worksheet\ColumnCellIterator;
class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
{
public $mockWorksheet;
@ -9,7 +13,7 @@ class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheet->expects($this->any())
@ -20,24 +24,24 @@ class WorksheetColumnTest extends \PHPUnit_Framework_TestCase
public function testInstantiateColumnDefault()
{
$column = new \PHPExcel\Worksheet\Column($this->mockWorksheet);
$this->assertInstanceOf('\PHPExcel\Worksheet\Column', $column);
$column = new Column($this->mockWorksheet);
$this->assertInstanceOf(Column::class, $column);
$columnIndex = $column->getColumnIndex();
$this->assertEquals('A', $columnIndex);
}
public function testInstantiateColumnSpecified()
{
$column = new \PHPExcel\Worksheet\Column($this->mockWorksheet, 'E');
$this->assertInstanceOf('\PHPExcel\Worksheet\Column', $column);
$column = new Column($this->mockWorksheet, 'E');
$this->assertInstanceOf(Column::class, $column);
$columnIndex = $column->getColumnIndex();
$this->assertEquals('E', $columnIndex);
}
public function testGetCellIterator()
{
$column = new \PHPExcel\Worksheet\Column($this->mockWorksheet);
$column = new Column($this->mockWorksheet);
$cellIterator = $column->getCellIterator();
$this->assertInstanceOf('\PHPExcel\Worksheet\ColumnCellIterator', $cellIterator);
$this->assertInstanceOf(ColumnCellIterator::class, $cellIterator);
}
}

View File

@ -2,6 +2,10 @@
namespace PhpSpreadsheet\Tests\Worksheet;
use PHPExcel\Worksheet;
use PHPExcel\Worksheet\Row;
use PHPExcel\Worksheet\RowCellIterator;
class WorksheetRowTest extends \PHPUnit_Framework_TestCase
{
public $mockWorksheet;
@ -9,7 +13,7 @@ class WorksheetRowTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet')
$this->mockWorksheet = $this->getMockBuilder(Worksheet::class)
->disableOriginalConstructor()
->getMock();
$this->mockWorksheet->expects($this->any())
@ -20,24 +24,24 @@ class WorksheetRowTest extends \PHPUnit_Framework_TestCase
public function testInstantiateRowDefault()
{
$row = new \PHPExcel\Worksheet\Row($this->mockWorksheet);
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
$row = new Row($this->mockWorksheet);
$this->assertInstanceOf(Row::class, $row);
$rowIndex = $row->getRowIndex();
$this->assertEquals(1, $rowIndex);
}
public function testInstantiateRowSpecified()
{
$row = new \PHPExcel\Worksheet\Row($this->mockWorksheet, 5);
$this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row);
$row = new Row($this->mockWorksheet, 5);
$this->assertInstanceOf(Row::class, $row);
$rowIndex = $row->getRowIndex();
$this->assertEquals(5, $rowIndex);
}
public function testGetCellIterator()
{
$row = new \PHPExcel\Worksheet\Row($this->mockWorksheet);
$row = new Row($this->mockWorksheet);
$cellIterator = $row->getCellIterator();
$this->assertInstanceOf('\PHPExcel\Worksheet\RowCellIterator', $cellIterator);
$this->assertInstanceOf(RowCellIterator::class, $cellIterator);
}
}

View File

@ -1,9 +1,6 @@
"PHPExcel", "8053"
"Mark Baker", "877D"
"!+&=()~§±æþ", "C0EA"
"μυστικό κωδικό πρόσβασης", "FFFF26DD"
"গোপন পাসওয়ার্ড", "E858"
"Секретный пароль", "EA5F"
"秘密口令", "C07E"
"leyndarmál lykilorð", "99E8"
"", "CE4B"