diff --git a/.gitattributes b/.gitattributes index 58182f25..8afa9920 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ /Build export-ignore -/unitTests export-ignore +/tests export-ignore README.md export-ignore diff --git a/.gitignore b/.gitignore index dea03b5e..c3b65f07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ build/PHPExcel.phar -unitTests/codeCoverage +tests/codeCoverage analysis ## IDE support diff --git a/.travis.yml b/.travis.yml index 68dcb08c..bcc21aad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,6 @@ before_script: script: ## PHP_CodeSniffer - - ./vendor/bin/phpcs --report-width=200 --report-summary --report-full src/ unitTests/ --standard=PSR2 -n + - ./vendor/bin/phpcs --report-width=200 --report-summary --report-full src/ tests/ --standard=PSR2 -n ## PHPUnit - - ./vendor/bin/phpunit -c ./unitTests/ + - ./vendor/bin/phpunit diff --git a/composer.json b/composer.json index 243c1e38..4305ae99 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "phpoffice/phpspreadsheet", "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "keywords": ["PHP","OpenXML","Excel","xlsx","xls","ods","gnumeric","spreadsheet"], + "keywords": ["PHP", "OpenXML", "Excel", "xlsx", "xls", "ods", "gnumeric", "spreadsheet"], "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", "type": "library", "license": "LGPL-2.1", @@ -45,5 +45,10 @@ "psr-4": { "PHPExcel\\": "src/PhpSpreadsheet" } + }, + "autoload-dev": { + "psr-4": { + "PhpSpreadsheet\\Tests\\": "tests/PhpSpreadsheet" + } } } diff --git a/phpunit-cc.xml b/phpunit-cc.xml new file mode 100644 index 00000000..c7c314f8 --- /dev/null +++ b/phpunit-cc.xml @@ -0,0 +1,42 @@ + + + + + + + ./tests/PhpSpreadsheet + + + + ./src + + ./src/PhpSpreadsheet/Shared/PCLZip + ./src/PhpSpreadsheet/Shared/JAMA + ./src/PhpSpreadsheet/Writer/PDF + + + + + + + + + + diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 00000000..52f6ec5f --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,34 @@ + + + + + + + ./tests/PhpSpreadsheet + + + + ./src + + ./src/PhpSpreadsheet/Shared/PCLZip + ./src/PhpSpreadsheet/Shared/JAMA + ./src/PhpSpreadsheet/Writer/PDF + + + + diff --git a/unitTests/Classes/src/Calculation/DateTimeTest.php b/tests/PhpSpreadsheet/Calculation/DateTimeTest.php similarity index 98% rename from unitTests/Classes/src/Calculation/DateTimeTest.php rename to tests/PhpSpreadsheet/Calculation/DateTimeTest.php index 316f8b3d..9300c604 100644 --- a/unitTests/Classes/src/Calculation/DateTimeTest.php +++ b/tests/PhpSpreadsheet/Calculation/DateTimeTest.php @@ -1,9 +1,11 @@ complexAssert = new \PhpSpreadhsheet\unitTests\custom\ComplexAssert(); + $this->complexAssert = new \PhpSpreadsheet\Tests\Custom\ComplexAssert(); \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } @@ -41,7 +34,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerBESSELI() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELI.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELI.data'); } /** @@ -57,7 +50,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerBESSELJ() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELJ.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELJ.data'); } /** @@ -73,7 +66,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerBESSELK() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELK.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELK.data'); } /** @@ -89,7 +82,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerBESSELY() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELY.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/BESSELY.data'); } /** @@ -105,7 +98,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerCOMPLEX() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/COMPLEX.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/COMPLEX.data'); } /** @@ -121,7 +114,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMAGINARY() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMAGINARY.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMAGINARY.data'); } /** @@ -137,7 +130,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMREAL() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMREAL.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMREAL.data'); } /** @@ -153,7 +146,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMABS() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMABS.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMABS.data'); } /** @@ -170,7 +163,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMARGUMENT() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMARGUMENT.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMARGUMENT.data'); } /** @@ -186,7 +179,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMCONJUGATE() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMCONJUGATE.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMCONJUGATE.data'); } /** @@ -202,7 +195,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMCOS() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMCOS.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMCOS.data'); } /** @@ -219,7 +212,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMDIV() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMDIV.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMDIV.data'); } /** @@ -235,7 +228,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMEXP() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMEXP.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMEXP.data'); } /** @@ -251,7 +244,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMLN() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMLN.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMLN.data'); } /** @@ -267,7 +260,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMLOG2() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMLOG2.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMLOG2.data'); } /** @@ -283,7 +276,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMLOG10() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMLOG10.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMLOG10.data'); } /** @@ -300,7 +293,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMPOWER() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMPOWER.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMPOWER.data'); } /** @@ -316,7 +309,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMPRODUCT() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMPRODUCT.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMPRODUCT.data'); } /** @@ -332,7 +325,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMSIN() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSIN.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSIN.data'); } /** @@ -348,7 +341,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMSQRT() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSQRT.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSQRT.data'); } /** @@ -365,7 +358,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMSUB() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSUB.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSUB.data'); } /** @@ -382,7 +375,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerIMSUM() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSUM.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/IMSUM.data'); } /** @@ -398,7 +391,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerERF() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/ERF.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/ERF.data'); } /** @@ -414,7 +407,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerERFC() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/ERFC.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/ERFC.data'); } /** @@ -430,7 +423,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerBIN2DEC() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/BIN2DEC.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/BIN2DEC.data'); } /** @@ -446,7 +439,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerBIN2HEX() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/BIN2HEX.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/BIN2HEX.data'); } /** @@ -462,7 +455,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerBIN2OCT() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/BIN2OCT.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/BIN2OCT.data'); } /** @@ -478,7 +471,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerDEC2BIN() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/DEC2BIN.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/DEC2BIN.data'); } /** @@ -494,7 +487,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerDEC2HEX() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/DEC2HEX.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/DEC2HEX.data'); } /** @@ -510,7 +503,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerDEC2OCT() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/DEC2OCT.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/DEC2OCT.data'); } /** @@ -526,7 +519,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerHEX2BIN() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/HEX2BIN.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/HEX2BIN.data'); } /** @@ -542,7 +535,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerHEX2DEC() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/HEX2DEC.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/HEX2DEC.data'); } /** @@ -558,7 +551,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerHEX2OCT() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/HEX2OCT.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/HEX2OCT.data'); } /** @@ -574,7 +567,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerOCT2BIN() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/OCT2BIN.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/OCT2BIN.data'); } /** @@ -590,7 +583,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerOCT2DEC() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/OCT2DEC.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/OCT2DEC.data'); } /** @@ -606,7 +599,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerOCT2HEX() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/OCT2HEX.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/OCT2HEX.data'); } /** @@ -622,7 +615,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerDELTA() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/DELTA.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/DELTA.data'); } /** @@ -638,7 +631,7 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerGESTEP() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/GESTEP.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/GESTEP.data'); } public function testGetConversionGroups() @@ -678,6 +671,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase public function providerCONVERTUOM() { - return new \PhpSpreadhsheet\unitTests\TestDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data'); + return new \PhpSpreadsheet\Tests\TestDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data'); } } diff --git a/unitTests/Classes/src/Calculation/FinancialTest.php b/tests/PhpSpreadsheet/Calculation/FinancialTest.php similarity index 77% rename from unitTests/Classes/src/Calculation/FinancialTest.php rename to tests/PhpSpreadsheet/Calculation/FinancialTest.php index 12cc3e8f..76dfb6d3 100644 --- a/unitTests/Classes/src/Calculation/FinancialTest.php +++ b/tests/PhpSpreadsheet/Calculation/FinancialTest.php @@ -1,8 +1,6 @@ setDataType('BOOLEAN'); - } catch (Exception $e) { + } catch (\PHPExcel\Exception $e) { $this->assertEquals($e->getMessage(), 'Invalid datatype for chart data series values'); return; } diff --git a/unitTests/Classes/src/Chart/LayoutTest.php b/tests/PhpSpreadsheet/Chart/LayoutTest.php similarity index 94% rename from unitTests/Classes/src/Chart/LayoutTest.php rename to tests/PhpSpreadsheet/Chart/LayoutTest.php index 24351207..c4817e58 100644 --- a/unitTests/Classes/src/Chart/LayoutTest.php +++ b/tests/PhpSpreadsheet/Chart/LayoutTest.php @@ -1,6 +1,6 @@ mockWorksheet, 'A'); $ColumnCellIndexResult = 1; $this->assertEquals($ColumnCellIndexResult, $iterator->key()); - + foreach ($iterator as $key => $ColumnCell) { $this->assertEquals($ColumnCellIndexResult++, $key); $this->assertInstanceOf('\\PHPExcel\\Cell', $ColumnCell); @@ -43,7 +45,7 @@ class ColumnCellIteratorTest extends \PHPUnit_Framework_TestCase $iterator = new ColumnCellIterator($this->mockWorksheet, 'A', 2, 4); $ColumnCellIndexResult = 2; $this->assertEquals($ColumnCellIndexResult, $iterator->key()); - + foreach ($iterator as $key => $ColumnCell) { $this->assertEquals($ColumnCellIndexResult++, $key); $this->assertInstanceOf('\\PHPExcel\\Cell', $ColumnCell); diff --git a/unitTests/Classes/src/Worksheet/ColumnIteratorTest.php b/tests/PhpSpreadsheet/Worksheet/ColumnIteratorTest.php similarity index 96% rename from unitTests/Classes/src/Worksheet/ColumnIteratorTest.php rename to tests/PhpSpreadsheet/Worksheet/ColumnIteratorTest.php index 0b4e2bf9..14c23fc3 100644 --- a/unitTests/Classes/src/Worksheet/ColumnIteratorTest.php +++ b/tests/PhpSpreadsheet/Worksheet/ColumnIteratorTest.php @@ -1,6 +1,8 @@ mockWorksheet); $columnIndexResult = 'A'; $this->assertEquals($columnIndexResult, $iterator->key()); - + foreach ($iterator as $key => $column) { $this->assertEquals($columnIndexResult++, $key); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\Column', $column); @@ -43,7 +45,7 @@ class ColumnIteratorTest extends \PHPUnit_Framework_TestCase $iterator = new ColumnIterator($this->mockWorksheet, 'B', 'D'); $columnIndexResult = 'B'; $this->assertEquals($columnIndexResult, $iterator->key()); - + foreach ($iterator as $key => $column) { $this->assertEquals($columnIndexResult++, $key); $this->assertInstanceOf('\\PHPExcel\\Worksheet\\Column', $column); diff --git a/unitTests/Classes/src/Worksheet/RowCellIteratorTest.php b/tests/PhpSpreadsheet/Worksheet/RowCellIteratorTest.php similarity index 98% rename from unitTests/Classes/src/Worksheet/RowCellIteratorTest.php rename to tests/PhpSpreadsheet/Worksheet/RowCellIteratorTest.php index 58dca140..eed9e2e6 100644 --- a/unitTests/Classes/src/Worksheet/RowCellIteratorTest.php +++ b/tests/PhpSpreadsheet/Worksheet/RowCellIteratorTest.php @@ -1,6 +1,6 @@ - - - - - - ./Classes - - - - ../src - - ../src/PhpSpreadsheet/Shared/PCLZip - ../src/PhpSpreadsheet/Shared/JAMA - ../src/PhpSpreadsheet/Writer/PDF - - - - - - - - - - diff --git a/unitTests/phpunit.xml b/unitTests/phpunit.xml deleted file mode 100644 index 95ca0774..00000000 --- a/unitTests/phpunit.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - ./Classes - - - - ../src - - ../src/PhpSpreadsheet/Shared/PCLZip - ../src/PhpSpreadsheet/Shared/JAMA - ../src/PhpSpreadsheet/Writer/PDF - - - -