From 06ba9e70930aabac16b4e1aa8ddc8e58ab92b17a Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Wed, 2 Apr 2014 11:11:59 +0700 Subject: [PATCH] Make one level Element folder structure (move Cell and Row up one level) --- src/PhpWord/Element/{Table => }/Cell.php | 2 +- src/PhpWord/Element/{Table => }/Row.php | 4 ++-- src/PhpWord/Element/Table.php | 4 ++-- .../Tests/Element/{Table => }/CellTest.php | 18 +++++++++--------- .../Tests/Element/{Table => }/RowTest.php | 12 ++++++------ tests/PhpWord/Tests/Element/TableTest.php | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) rename src/PhpWord/Element/{Table => }/Cell.php (97%) rename src/PhpWord/Element/{Table => }/Row.php (95%) rename tests/PhpWord/Tests/Element/{Table => }/CellTest.php (93%) rename tests/PhpWord/Tests/Element/{Table => }/RowTest.php (79%) diff --git a/src/PhpWord/Element/Table/Cell.php b/src/PhpWord/Element/Cell.php similarity index 97% rename from src/PhpWord/Element/Table/Cell.php rename to src/PhpWord/Element/Cell.php index 2a15a263..25e9fb71 100755 --- a/src/PhpWord/Element/Table/Cell.php +++ b/src/PhpWord/Element/Cell.php @@ -7,7 +7,7 @@ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -namespace PhpOffice\PhpWord\Element\Table; +namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Container\Container; use PhpOffice\PhpWord\Style\Cell as CellStyle; diff --git a/src/PhpWord/Element/Table/Row.php b/src/PhpWord/Element/Row.php similarity index 95% rename from src/PhpWord/Element/Table/Row.php rename to src/PhpWord/Element/Row.php index c027d373..eefeca57 100644 --- a/src/PhpWord/Element/Table/Row.php +++ b/src/PhpWord/Element/Row.php @@ -7,7 +7,7 @@ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -namespace PhpOffice\PhpWord\Element\Table; +namespace PhpOffice\PhpWord\Element; /** * Table row element @@ -83,7 +83,7 @@ class Row * * @param int $width * @param mixed $style - * @return \PhpOffice\PhpWord\Element\Table\Cell + * @return \PhpOffice\PhpWord\Element\Cell */ public function addCell($width = null, $style = null) { diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index fc168349..083ad5fc 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -9,7 +9,7 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Element\Table\Row; +use PhpOffice\PhpWord\Element\Row; /** * Table element @@ -98,7 +98,7 @@ class Table * * @param int $width * @param mixed $style - * @return \PhpOffice\PhpWord\Element\Table\Cell + * @return \PhpOffice\PhpWord\Element\Cell */ public function addCell($width = null, $style = null) { diff --git a/tests/PhpWord/Tests/Element/Table/CellTest.php b/tests/PhpWord/Tests/Element/CellTest.php similarity index 93% rename from tests/PhpWord/Tests/Element/Table/CellTest.php rename to tests/PhpWord/Tests/Element/CellTest.php index bc0a8db1..be541935 100644 --- a/tests/PhpWord/Tests/Element/Table/CellTest.php +++ b/tests/PhpWord/Tests/Element/CellTest.php @@ -7,12 +7,12 @@ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -namespace PhpOffice\PhpWord\Tests\Element\Table; +namespace PhpOffice\PhpWord\Tests\Element; -use PhpOffice\PhpWord\Element\Table\Cell; +use PhpOffice\PhpWord\Element\Cell; /** - * Test class for PhpOffice\PhpWord\Element\Table\Cell + * Test class for PhpOffice\PhpWord\Element\Cell * * @runTestsInSeparateProcesses */ @@ -26,7 +26,7 @@ class CellTest extends \PHPUnit_Framework_TestCase $iVal = rand(1, 1000); $oCell = new Cell('section', $iVal); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table\\Cell', $oCell); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Cell', $oCell); $this->assertEquals($oCell->getWidth(), null); } @@ -132,7 +132,7 @@ class CellTest extends \PHPUnit_Framework_TestCase */ public function testAddImageSection() { - $src = __DIR__ . "/../../_files/images/earth.jpg"; + $src = __DIR__ . "/../_files/images/earth.jpg"; $oCell = new Cell('section', 1); $element1 = $oCell->addImage($src); $element2 = $oCell->addMemoryImage($src); // @deprecated @@ -146,7 +146,7 @@ class CellTest extends \PHPUnit_Framework_TestCase */ public function testAddImageHeader() { - $src = __DIR__ . "/../../_files/images/earth.jpg"; + $src = __DIR__ . "/../_files/images/earth.jpg"; $oCell = new Cell('header', 1); $element = $oCell->addImage($src); @@ -159,7 +159,7 @@ class CellTest extends \PHPUnit_Framework_TestCase */ public function testAddImageFooter() { - $src = __DIR__ . "/../../_files/images/earth.jpg"; + $src = __DIR__ . "/../_files/images/earth.jpg"; $oCell = new Cell('footer', 1); $element = $oCell->addImage($src); @@ -214,7 +214,7 @@ class CellTest extends \PHPUnit_Framework_TestCase */ public function testAddObjectXLS() { - $src = __DIR__ . "/../../_files/documents/sheet.xls"; + $src = __DIR__ . "/../_files/documents/sheet.xls"; $oCell = new Cell('section', 1); $element = $oCell->addObject($src); @@ -229,7 +229,7 @@ class CellTest extends \PHPUnit_Framework_TestCase */ public function testAddObjectException() { - $src = __DIR__ . "/_files/xsl/passthrough.xsl"; + $src = __DIR__ . "/../_files/xsl/passthrough.xsl"; $oCell = new Cell('section', 1); $element = $oCell->addObject($src); } diff --git a/tests/PhpWord/Tests/Element/Table/RowTest.php b/tests/PhpWord/Tests/Element/RowTest.php similarity index 79% rename from tests/PhpWord/Tests/Element/Table/RowTest.php rename to tests/PhpWord/Tests/Element/RowTest.php index f64c0cb4..e232afa8 100644 --- a/tests/PhpWord/Tests/Element/Table/RowTest.php +++ b/tests/PhpWord/Tests/Element/RowTest.php @@ -7,14 +7,14 @@ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -namespace PhpOffice\PhpWord\Tests\Element\Table; +namespace PhpOffice\PhpWord\Tests\Element; -use PhpOffice\PhpWord\Element\Table\Row; +use PhpOffice\PhpWord\Element\Row; /** - * Test class for PhpOffice\PhpWord\Element\Table\Row + * Test class for PhpOffice\PhpWord\Element\Row * - * @coversDefaultClass \PhpOffice\PhpWord\Element\Table\Row + * @coversDefaultClass \PhpOffice\PhpWord\Element\Row * @runTestsInSeparateProcesses */ class RowTest extends \PHPUnit_Framework_TestCase @@ -27,7 +27,7 @@ class RowTest extends \PHPUnit_Framework_TestCase $iVal = rand(1, 1000); $oRow = new Row('section', $iVal); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table\\Row', $oRow); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Row', $oRow); $this->assertEquals($oRow->getHeight(), null); $this->assertInternalType('array', $oRow->getCells()); $this->assertCount(0, $oRow->getCells()); @@ -60,7 +60,7 @@ class RowTest extends \PHPUnit_Framework_TestCase $oRow = new Row('section', 1); $element = $oRow->addCell(); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table\\Cell', $element); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Cell', $element); $this->assertCount(1, $oRow->getCells()); } } diff --git a/tests/PhpWord/Tests/Element/TableTest.php b/tests/PhpWord/Tests/Element/TableTest.php index 1b337fd6..0d3a74b9 100644 --- a/tests/PhpWord/Tests/Element/TableTest.php +++ b/tests/PhpWord/Tests/Element/TableTest.php @@ -75,7 +75,7 @@ class TableTest extends \PHPUnit_Framework_TestCase { $oTable = new Table('section', 1); $element = $oTable->addRow(); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table\\Row', $element); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Row', $element); $this->assertCount(1, $oTable->getRows()); } @@ -87,6 +87,6 @@ class TableTest extends \PHPUnit_Framework_TestCase $oTable = new Table('section', 1); $oTable->addRow(); $element = $oTable->addCell(); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table\\Cell', $element); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Cell', $element); } }