From d2a231799de1cb169666469951e7a2acb385abc1 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Tue, 11 Mar 2014 21:44:54 +0700 Subject: [PATCH] Code formatting for PSR1 & PSR2 - Part 2 --- Classes/PHPWord/HashTable.php | 4 +- Classes/PHPWord/Writer/ODText.php | 2 +- Classes/PHPWord/Writer/ODText/Manifest.php | 2 +- Tests/PHPWord/AutoloaderTest.php | 2 +- Tests/PHPWord/IOFactoryTest.php | 2 +- Tests/PHPWord/MediaTest.php | 2 +- .../Section/Footer/PreserveTextTest.php | 2 +- Tests/PHPWord/Section/FooterTest.php | 2 +- Tests/PHPWord/Section/FootnoteTest.php | 2 +- Tests/PHPWord/Section/HeaderTest.php | 2 +- Tests/PHPWord/Section/ImageTest.php | 2 +- Tests/PHPWord/Section/LinkTest.php | 2 +- Tests/PHPWord/Section/ListItemTest.php | 2 +- Tests/PHPWord/Section/MemoryImageTest.php | 2 +- Tests/PHPWord/Section/ObjectTest.php | 2 +- Tests/PHPWord/Section/PageBreakTest.php | 2 +- Tests/PHPWord/Section/SettingsTest.php | 2 +- Tests/PHPWord/Section/Table/CellTest.php | 2 +- Tests/PHPWord/Section/Table/RowTest.php | 2 +- Tests/PHPWord/Section/TableTest.php | 2 +- Tests/PHPWord/Section/TextBreakTest.php | 2 +- Tests/PHPWord/Section/TextRunTest.php | 2 +- Tests/PHPWord/Section/TextTest.php | 2 +- Tests/PHPWord/Section/TitleTest.php | 2 +- Tests/PHPWord/SectionTest.php | 2 +- Tests/PHPWord/Shared/DrawingTest.php | 4 +- Tests/PHPWord/Shared/FileTest.php | 13 ++--- Tests/PHPWord/Shared/FontTest.php | 2 +- Tests/PHPWord/Shared/StringTest.php | 2 - Tests/PHPWord/Style/CellTest.php | 3 +- Tests/PHPWord/Style/FontTest.php | 2 +- Tests/PHPWord/Style/ImageTest.php | 4 +- Tests/PHPWord/Style/ListItemTest.php | 4 +- Tests/PHPWord/Style/ParagraphTest.php | 3 +- Tests/PHPWord/Style/RowTest.php | 2 - Tests/PHPWord/Style/TOCTest.php | 2 - Tests/PHPWord/Style/TableFullTest.php | 2 - Tests/PHPWord/Style/TableTest.php | 2 - Tests/PHPWord/Style/TabsTest.php | 1 - Tests/PHPWord/TemplateTest.php | 2 +- Tests/PHPWord/Writer/Word2007/BaseTest.php | 54 +++++++++---------- .../PHPWord/Writer/Word2007/DocumentTest.php | 4 +- Tests/PHPWord/Writer/Word2007/StylesTest.php | 2 +- Tests/_inc/TestHelperDOCX.php | 20 +++---- 44 files changed, 81 insertions(+), 99 deletions(-) diff --git a/Classes/PHPWord/HashTable.php b/Classes/PHPWord/HashTable.php index 5b6fbd04..f2ef3148 100755 --- a/Classes/PHPWord/HashTable.php +++ b/Classes/PHPWord/HashTable.php @@ -69,7 +69,7 @@ class PHPWord_HashTable // Check if an array was passed if ($pSource == null) { return; - } else if (!is_array($pSource)) { + } elseif (!is_array($pSource)) { throw new Exception('Invalid array parameter passed.'); } @@ -91,7 +91,7 @@ class PHPWord_HashTable $hashIndex = $pSource->getHashIndex(); if (is_null($hashIndex)) { $hashCode = $pSource->getHashCode(); - } else if (isset ($this->_keyMap[$hashIndex])) { + } elseif (isset ($this->_keyMap[$hashIndex])) { $hashCode = $this->_keyMap[$hashIndex]; } else { $hashCode = $pSource->getHashCode(); diff --git a/Classes/PHPWord/Writer/ODText.php b/Classes/PHPWord/Writer/ODText.php index 16a60304..71775630 100755 --- a/Classes/PHPWord/Writer/ODText.php +++ b/Classes/PHPWord/Writer/ODText.php @@ -161,7 +161,7 @@ class PHPWord_Writer_ODText implements PHPWord_Writer_IWriter } $objZip->addFromString('Pictures/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); - } else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) { + } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) { ob_start(); call_user_func( $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), diff --git a/Classes/PHPWord/Writer/ODText/Manifest.php b/Classes/PHPWord/Writer/ODText/Manifest.php index f9815941..4b1c6b26 100755 --- a/Classes/PHPWord/Writer/ODText/Manifest.php +++ b/Classes/PHPWord/Writer/ODText/Manifest.php @@ -86,7 +86,7 @@ class PHPWord_Writer_ODText_Manifest extends PHPWord_Writer_ODText_WriterPart $objWriter->writeAttribute('manifest:media-type', $mimeType); $objWriter->writeAttribute('manifest:full-path', 'Pictures/' . str_replace(' ', '_', $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getIndexedFilename())); $objWriter->endElement(); - } else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) { + } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) { $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); $extension = explode('/', $extension); $extension = $extension[1]; diff --git a/Tests/PHPWord/AutoloaderTest.php b/Tests/PHPWord/AutoloaderTest.php index 2ad280f0..45ee6066 100644 --- a/Tests/PHPWord/AutoloaderTest.php +++ b/Tests/PHPWord/AutoloaderTest.php @@ -29,4 +29,4 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase Autoloader::autoload('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException'); // TODO change this class to the main PHPWord class when it is namespaced $this->assertTrue(in_array('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException', get_declared_classes()), 'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException class'); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/IOFactoryTest.php b/Tests/PHPWord/IOFactoryTest.php index a7c05bcf..0c2976b6 100644 --- a/Tests/PHPWord/IOFactoryTest.php +++ b/Tests/PHPWord/IOFactoryTest.php @@ -59,4 +59,4 @@ class IOFactoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord)); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/MediaTest.php b/Tests/PHPWord/MediaTest.php index 25cdab0a..86e9651a 100644 --- a/Tests/PHPWord/MediaTest.php +++ b/Tests/PHPWord/MediaTest.php @@ -25,4 +25,4 @@ class MediaTest extends \PHPUnit_Framework_TestCase { $this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia', 'PHPWord_Media'); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/Footer/PreserveTextTest.php b/Tests/PHPWord/Section/Footer/PreserveTextTest.php index ad6b5c24..c8297738 100644 --- a/Tests/PHPWord/Section/Footer/PreserveTextTest.php +++ b/Tests/PHPWord/Section/Footer/PreserveTextTest.php @@ -30,4 +30,4 @@ class PreserveTextTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PHPWord_Style_Font', $oPreserveText->getFontStyle()); $this->assertInstanceOf('PHPWord_Style_Paragraph', $oPreserveText->getParagraphStyle()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/FooterTest.php b/Tests/PHPWord/Section/FooterTest.php index 46999b59..de1fa613 100644 --- a/Tests/PHPWord/Section/FooterTest.php +++ b/Tests/PHPWord/Section/FooterTest.php @@ -118,4 +118,4 @@ class FooterTest extends \PHPUnit_Framework_TestCase $this->assertInternalType('array', $oFooter->getElements()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/FootnoteTest.php b/Tests/PHPWord/Section/FootnoteTest.php index a1f26494..1c798f4a 100644 --- a/Tests/PHPWord/Section/FootnoteTest.php +++ b/Tests/PHPWord/Section/FootnoteTest.php @@ -61,4 +61,4 @@ class FootnoteTest extends \PHPUnit_Framework_TestCase $oFootnote = new PHPWord_Section_Footnote(); $this->assertInternalType('array', $oFootnote->getElements()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/HeaderTest.php b/Tests/PHPWord/Section/HeaderTest.php index d7dc3ace..f9b05318 100644 --- a/Tests/PHPWord/Section/HeaderTest.php +++ b/Tests/PHPWord/Section/HeaderTest.php @@ -161,4 +161,4 @@ class HeaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oHeader->getType(), PHPWord_Section_Header::EVEN); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/ImageTest.php b/Tests/PHPWord/Section/ImageTest.php index 4e265db7..5bffbc0c 100644 --- a/Tests/PHPWord/Section/ImageTest.php +++ b/Tests/PHPWord/Section/ImageTest.php @@ -65,4 +65,4 @@ class ImageTest extends \PHPUnit_Framework_TestCase $oImage->setIsWatermark(true); $this->assertEquals($oImage->getIsWatermark(), true); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/LinkTest.php b/Tests/PHPWord/Section/LinkTest.php index c9f1bdca..81c5788e 100644 --- a/Tests/PHPWord/Section/LinkTest.php +++ b/Tests/PHPWord/Section/LinkTest.php @@ -45,4 +45,4 @@ class LinkTest extends \PHPUnit_Framework_TestCase $oLink->setRelationId($iVal); $this->assertEquals($oLink->getRelationId(), $iVal); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/ListItemTest.php b/Tests/PHPWord/Section/ListItemTest.php index 0b656eed..56973822 100644 --- a/Tests/PHPWord/Section/ListItemTest.php +++ b/Tests/PHPWord/Section/ListItemTest.php @@ -29,4 +29,4 @@ class ListItemTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oListItem->getDepth(), $iVal); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/MemoryImageTest.php b/Tests/PHPWord/Section/MemoryImageTest.php index 9b9694d9..be53f119 100644 --- a/Tests/PHPWord/Section/MemoryImageTest.php +++ b/Tests/PHPWord/Section/MemoryImageTest.php @@ -92,4 +92,4 @@ class MemoryImageTest extends \PHPUnit_Framework_TestCase $oMemoryImage->setRelationId($iVal); $this->assertEquals($oMemoryImage->getRelationId(), $iVal); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/ObjectTest.php b/Tests/PHPWord/Section/ObjectTest.php index fa5fa24b..53d26314 100644 --- a/Tests/PHPWord/Section/ObjectTest.php +++ b/Tests/PHPWord/Section/ObjectTest.php @@ -83,4 +83,4 @@ class ObjectTest extends \PHPUnit_Framework_TestCase $oObject->setObjectId($iVal); $this->assertEquals($oObject->getObjectId(), $iVal); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/PageBreakTest.php b/Tests/PHPWord/Section/PageBreakTest.php index 01944d06..497a7c1a 100644 --- a/Tests/PHPWord/Section/PageBreakTest.php +++ b/Tests/PHPWord/Section/PageBreakTest.php @@ -16,4 +16,4 @@ class PageBreakTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PHPWord_Section_PageBreak', $oPageBreak); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/SettingsTest.php b/Tests/PHPWord/Section/SettingsTest.php index 505347e6..69d7fe2c 100644 --- a/Tests/PHPWord/Section/SettingsTest.php +++ b/Tests/PHPWord/Section/SettingsTest.php @@ -233,4 +233,4 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings->setBreakType(); $this->assertNull($oSettings->getBreakType()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/Table/CellTest.php b/Tests/PHPWord/Section/Table/CellTest.php index bfd7e0d0..261c9ee0 100644 --- a/Tests/PHPWord/Section/Table/CellTest.php +++ b/Tests/PHPWord/Section/Table/CellTest.php @@ -201,4 +201,4 @@ class CellTest extends \PHPUnit_Framework_TestCase $this->assertInternalType('array', $oCell->getElements()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/Table/RowTest.php b/Tests/PHPWord/Section/Table/RowTest.php index 849abbac..c6dd762a 100644 --- a/Tests/PHPWord/Section/Table/RowTest.php +++ b/Tests/PHPWord/Section/Table/RowTest.php @@ -36,4 +36,4 @@ class RowTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PHPWord_Section_Table_Cell', $element); $this->assertCount(1, $oRow->getCells()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/TableTest.php b/Tests/PHPWord/Section/TableTest.php index f207d426..6c479e36 100644 --- a/Tests/PHPWord/Section/TableTest.php +++ b/Tests/PHPWord/Section/TableTest.php @@ -54,4 +54,4 @@ class TableTest extends \PHPUnit_Framework_TestCase $element = $oTable->addCell(); $this->assertInstanceOf('PHPWord_Section_Table_Cell', $element); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/TextBreakTest.php b/Tests/PHPWord/Section/TextBreakTest.php index 86e9ac48..a75b97c4 100644 --- a/Tests/PHPWord/Section/TextBreakTest.php +++ b/Tests/PHPWord/Section/TextBreakTest.php @@ -16,4 +16,4 @@ class TextBreakTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PHPWord_Section_TextBreak', $oTextBreak); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/TextRunTest.php b/Tests/PHPWord/Section/TextRunTest.php index 0ea9d701..aa352fa5 100644 --- a/Tests/PHPWord/Section/TextRunTest.php +++ b/Tests/PHPWord/Section/TextRunTest.php @@ -95,4 +95,4 @@ class TextRunTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PHPWord_Section_Footnote', $element); $this->assertCount(1, $oTextRun->getElements()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/TextTest.php b/Tests/PHPWord/Section/TextTest.php index 8a2bf321..b85b2028 100644 --- a/Tests/PHPWord/Section/TextTest.php +++ b/Tests/PHPWord/Section/TextTest.php @@ -40,4 +40,4 @@ class TextTest extends \PHPUnit_Framework_TestCase $oText->setParagraphStyle(array('align' => 'center', 'spaceAfter' => 100)); $this->assertInstanceOf('PHPWord_Style_Paragraph', $oText->getParagraphStyle()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Section/TitleTest.php b/Tests/PHPWord/Section/TitleTest.php index c595ab97..c0a6185d 100644 --- a/Tests/PHPWord/Section/TitleTest.php +++ b/Tests/PHPWord/Section/TitleTest.php @@ -45,4 +45,4 @@ class TitleTest extends \PHPUnit_Framework_TestCase $oTitle->setBookmarkId($iVal); $this->assertEquals($oTitle->getBookmarkId(), $iVal); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/SectionTest.php b/Tests/PHPWord/SectionTest.php index 378fd642..3af02eca 100644 --- a/Tests/PHPWord/SectionTest.php +++ b/Tests/PHPWord/SectionTest.php @@ -35,4 +35,4 @@ class SectionTest extends \PHPUnit_Framework_TestCase $oSection = new PHPWord_Section(0); $this->assertAttributeEquals($oSection->getElements(), '_elementCollection', new PHPWord_Section(0)); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Shared/DrawingTest.php b/Tests/PHPWord/Shared/DrawingTest.php index cfebad34..c939b9c0 100644 --- a/Tests/PHPWord/Shared/DrawingTest.php +++ b/Tests/PHPWord/Shared/DrawingTest.php @@ -12,7 +12,6 @@ use PHPWord_Shared_Drawing; */ class DrawingTest extends \PHPUnit_Framework_TestCase { - /** * Test unit conversion functions with various numbers */ @@ -65,5 +64,4 @@ class DrawingTest extends \PHPUnit_Framework_TestCase $this->assertEquals($value[1], $result); } } - -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Shared/FileTest.php b/Tests/PHPWord/Shared/FileTest.php index fb7a8bd6..618d5801 100644 --- a/Tests/PHPWord/Shared/FileTest.php +++ b/Tests/PHPWord/Shared/FileTest.php @@ -12,13 +12,13 @@ use PHPWord_Shared_File; */ class FileTest extends \PHPUnit_Framework_TestCase { - /** * Test file_exists() */ - public function testFile_exists() + public function testFileExists() { - $dir = join(DIRECTORY_SEPARATOR, + $dir = join( + DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates') ); chdir($dir); @@ -30,12 +30,13 @@ class FileTest extends \PHPUnit_Framework_TestCase */ public function testRealpath() { - $dir = join(DIRECTORY_SEPARATOR, - array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates')); + $dir = join( + DIRECTORY_SEPARATOR, + array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates') + ); chdir($dir); $file = 'blank.docx'; $expected = $dir . DIRECTORY_SEPARATOR . $file; $this->assertEquals($expected, PHPWord_Shared_File::realpath($file)); } - } diff --git a/Tests/PHPWord/Shared/FontTest.php b/Tests/PHPWord/Shared/FontTest.php index f2950abb..74ece26a 100644 --- a/Tests/PHPWord/Shared/FontTest.php +++ b/Tests/PHPWord/Shared/FontTest.php @@ -43,4 +43,4 @@ class FontTest extends \PHPUnit_Framework_TestCase $result = PHPWord_Shared_Font::pointSizeToTwips($original); $this->assertEquals($original * 20, $result); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Shared/StringTest.php b/Tests/PHPWord/Shared/StringTest.php index 9bb0d63b..a0ab7ad0 100644 --- a/Tests/PHPWord/Shared/StringTest.php +++ b/Tests/PHPWord/Shared/StringTest.php @@ -12,7 +12,6 @@ use PHPWord_Shared_String; */ class StringTest extends \PHPUnit_Framework_TestCase { - /** * Test getIsMbstringEnabled() and getIsIconvEnabled() */ @@ -41,5 +40,4 @@ class StringTest extends \PHPUnit_Framework_TestCase $returned = PHPWord_Shared_String::FormatNumber('1022.1234'); $this->assertEquals($expected, $returned); } - } diff --git a/Tests/PHPWord/Style/CellTest.php b/Tests/PHPWord/Style/CellTest.php index 759f6e0e..61ef93f4 100644 --- a/Tests/PHPWord/Style/CellTest.php +++ b/Tests/PHPWord/Style/CellTest.php @@ -12,7 +12,6 @@ use PHPWord_Style_Cell; */ class CellTest extends \PHPUnit_Framework_TestCase { - /** * Test setting style with normal value */ @@ -75,4 +74,4 @@ class CellTest extends \PHPUnit_Framework_TestCase $object->setStyleValue('_borderSize', $value); $this->assertEquals($expected, $object->getBorderSize()); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Style/FontTest.php b/Tests/PHPWord/Style/FontTest.php index eb29cd5c..375ebe5b 100644 --- a/Tests/PHPWord/Style/FontTest.php +++ b/Tests/PHPWord/Style/FontTest.php @@ -114,4 +114,4 @@ class FontTest extends \PHPUnit_Framework_TestCase $this->assertEquals(720, $lineHeight); $this->assertEquals('auto', $lineRule); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Style/ImageTest.php b/Tests/PHPWord/Style/ImageTest.php index 52d0b4c2..60af0b6e 100644 --- a/Tests/PHPWord/Style/ImageTest.php +++ b/Tests/PHPWord/Style/ImageTest.php @@ -12,7 +12,6 @@ use PHPWord_Style_Image; */ class ImageTest extends \PHPUnit_Framework_TestCase { - /** * Test setting style with normal value */ @@ -67,5 +66,4 @@ class ImageTest extends \PHPUnit_Framework_TestCase $object = new PHPWord_Style_Image(); $object->setWrappingStyle('foo'); } - -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Style/ListItemTest.php b/Tests/PHPWord/Style/ListItemTest.php index 9b9f6ec9..7185e25e 100644 --- a/Tests/PHPWord/Style/ListItemTest.php +++ b/Tests/PHPWord/Style/ListItemTest.php @@ -12,7 +12,6 @@ use PHPWord_Style_ListItem; */ class ListItemTest extends \PHPUnit_Framework_TestCase { - /** * Test construct */ @@ -47,5 +46,4 @@ class ListItemTest extends \PHPUnit_Framework_TestCase $object->setListType($value); $this->assertEquals($value, $object->getListType()); } - -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Style/ParagraphTest.php b/Tests/PHPWord/Style/ParagraphTest.php index e61ff8fd..94550da1 100644 --- a/Tests/PHPWord/Style/ParagraphTest.php +++ b/Tests/PHPWord/Style/ParagraphTest.php @@ -133,5 +133,4 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase $object->setLineHeight('12.5pt'); $this->assertEquals(12.5, $object->getLineHeight()); } - -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Style/RowTest.php b/Tests/PHPWord/Style/RowTest.php index 63c05d61..3d2f9b2f 100644 --- a/Tests/PHPWord/Style/RowTest.php +++ b/Tests/PHPWord/Style/RowTest.php @@ -12,7 +12,6 @@ use PHPWord_Style_Row; */ class RowTest extends \PHPUnit_Framework_TestCase { - /** * Test properties with normal value */ @@ -39,5 +38,4 @@ class RowTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $object->$get()); } } - } diff --git a/Tests/PHPWord/Style/TOCTest.php b/Tests/PHPWord/Style/TOCTest.php index 78ac6506..80e34d74 100644 --- a/Tests/PHPWord/Style/TOCTest.php +++ b/Tests/PHPWord/Style/TOCTest.php @@ -12,7 +12,6 @@ use PHPWord_Style_TOC; */ class TOCTest extends \PHPUnit_Framework_TestCase { - /** * Test properties with normal value */ @@ -37,5 +36,4 @@ class TOCTest extends \PHPUnit_Framework_TestCase $this->assertEquals(null, $object->$get()); } } - } diff --git a/Tests/PHPWord/Style/TableFullTest.php b/Tests/PHPWord/Style/TableFullTest.php index 10855d55..6261404d 100644 --- a/Tests/PHPWord/Style/TableFullTest.php +++ b/Tests/PHPWord/Style/TableFullTest.php @@ -12,7 +12,6 @@ use PHPWord_Style_TableFull; */ class TableFullTest extends \PHPUnit_Framework_TestCase { - /** * Test class construction * @@ -132,5 +131,4 @@ class TableFullTest extends \PHPUnit_Framework_TestCase } $this->assertEquals($values, $object->getCellMargin()); } - } diff --git a/Tests/PHPWord/Style/TableTest.php b/Tests/PHPWord/Style/TableTest.php index 93f4ebfc..61459aad 100644 --- a/Tests/PHPWord/Style/TableTest.php +++ b/Tests/PHPWord/Style/TableTest.php @@ -12,7 +12,6 @@ use PHPWord_Style_Table; */ class TableTest extends \PHPUnit_Framework_TestCase { - /** * Test set style value */ @@ -50,5 +49,4 @@ class TableTest extends \PHPUnit_Framework_TestCase } $this->assertEquals($values, $object->getCellMargin()); } - } diff --git a/Tests/PHPWord/Style/TabsTest.php b/Tests/PHPWord/Style/TabsTest.php index 5d318610..1be0c350 100644 --- a/Tests/PHPWord/Style/TabsTest.php +++ b/Tests/PHPWord/Style/TabsTest.php @@ -42,5 +42,4 @@ class TabsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1440, $element->getAttribute('w:pos')); $this->assertEquals('dot', $element->getAttribute('w:leader')); } - } diff --git a/Tests/PHPWord/TemplateTest.php b/Tests/PHPWord/TemplateTest.php index 8c17d2e3..65db9850 100644 --- a/Tests/PHPWord/TemplateTest.php +++ b/Tests/PHPWord/TemplateTest.php @@ -115,4 +115,4 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ @$template->applyXslStyleSheet($xslDOMDocument); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Writer/Word2007/BaseTest.php b/Tests/PHPWord/Writer/Word2007/BaseTest.php index 534dd2a6..e477eee8 100644 --- a/Tests/PHPWord/Writer/Word2007/BaseTest.php +++ b/Tests/PHPWord/Writer/Word2007/BaseTest.php @@ -20,7 +20,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase TestHelperDOCX::clear(); } - public function testWriteImage_Position() + public function testWriteImagePosition() { $PHPWord = new PHPWord(); $section = $PHPWord->createSection(); @@ -42,7 +42,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase $this->assertRegExp('/position:absolute;/', $style); } - public function testWriteParagraphStyle_Align() + public function testWriteParagraphStyleAlign() { $PHPWord = new PHPWord(); $section = $PHPWord->createSection(); @@ -55,34 +55,10 @@ class BaseTest extends \PHPUnit_Framework_TestCase $this->assertEquals('right', $element->getAttribute('w:val')); } - public function testWriteCellStyle_CellGridSpan() - { - $PHPWord = new PHPWord(); - $section = $PHPWord->createSection(); - - $table = $section->addTable(); - - $table->addRow(); - $cell = $table->addCell(200); - $cell->getStyle()->setGridSpan(5); - - $table->addRow(); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - - $doc = TestHelperDOCX::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan'); - - $this->assertEquals(5, $element->getAttribute('w:val')); - } - /** * Test write paragraph pagination */ - public function testWriteParagraphStyle_Pagination() + public function testWriteParagraphStylePagination() { // Create the doc $PHPWord = new PHPWord(); @@ -108,4 +84,28 @@ class BaseTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $element->getAttribute('w:val')); } } + + public function testWriteCellStyleCellGridSpan() + { + $PHPWord = new PHPWord(); + $section = $PHPWord->createSection(); + + $table = $section->addTable(); + + $table->addRow(); + $cell = $table->addCell(200); + $cell->getStyle()->setGridSpan(5); + + $table->addRow(); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + + $doc = TestHelperDOCX::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan'); + + $this->assertEquals(5, $element->getAttribute('w:val')); + } } diff --git a/Tests/PHPWord/Writer/Word2007/DocumentTest.php b/Tests/PHPWord/Writer/Word2007/DocumentTest.php index 5d91ebab..22efe7d0 100644 --- a/Tests/PHPWord/Writer/Word2007/DocumentTest.php +++ b/Tests/PHPWord/Writer/Word2007/DocumentTest.php @@ -22,7 +22,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase TestHelperDOCX::clear(); } - public function testWriteEndSection_PageNumbering() + public function testWriteEndSectionPageNumbering() { $PHPWord = new PHPWord(); $section = $PHPWord->createSection(); @@ -33,4 +33,4 @@ class DocumentTest extends \PHPUnit_Framework_TestCase $this->assertEquals(2, $element->getAttribute('w:start')); } -} \ No newline at end of file +} diff --git a/Tests/PHPWord/Writer/Word2007/StylesTest.php b/Tests/PHPWord/Writer/Word2007/StylesTest.php index 9fd19335..39162eae 100644 --- a/Tests/PHPWord/Writer/Word2007/StylesTest.php +++ b/Tests/PHPWord/Writer/Word2007/StylesTest.php @@ -51,4 +51,4 @@ class StylesTest extends \PHPUnit_Framework_TestCase $element = $doc->getElement($path, $file); $this->assertEquals('Normal', $element->getAttribute('w:val')); } -} \ No newline at end of file +} diff --git a/Tests/_inc/TestHelperDOCX.php b/Tests/_inc/TestHelperDOCX.php index 5c603b0b..c9dd88f8 100644 --- a/Tests/_inc/TestHelperDOCX.php +++ b/Tests/_inc/TestHelperDOCX.php @@ -15,8 +15,8 @@ class TestHelperDOCX public static function getDocument(PHPWord $PHPWord) { self::$file = tempnam(sys_get_temp_dir(), 'PHPWord'); - if(!is_dir(sys_get_temp_dir().'/PHPWord_Unit_Test/')){ - mkdir(sys_get_temp_dir().'/PHPWord_Unit_Test/'); + if (!is_dir(sys_get_temp_dir() . '/PHPWord_Unit_Test/')) { + mkdir(sys_get_temp_dir() . '/PHPWord_Unit_Test/'); } $objWriter = \PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); @@ -29,16 +29,16 @@ class TestHelperDOCX $zip->close(); } - return new Xml_Document(sys_get_temp_dir().'/PHPWord_Unit_Test/'); + return new Xml_Document(sys_get_temp_dir() . '/PHPWord_Unit_Test/'); } public static function clear() { - if(file_exists(self::$file)){ - unlink(self::$file); + if (file_exists(self::$file)) { + unlink(self::$file); } - if(is_dir(sys_get_temp_dir().'/PHPWord_Unit_Test/')){ - self::deleteDir(sys_get_temp_dir().'/PHPWord_Unit_Test/'); + if (is_dir(sys_get_temp_dir() . '/PHPWord_Unit_Test/')) { + self::deleteDir(sys_get_temp_dir() . '/PHPWord_Unit_Test/'); } } @@ -94,9 +94,9 @@ class Xml_Document } $this->xpath = null; - $this->file = $file; + $this->file = $file; - $file = $this->path . '/' . $file; + $file = $this->path . '/' . $file; $this->dom = new DOMDocument(); $this->dom->load($file); return $this->dom; @@ -121,4 +121,4 @@ class Xml_Document $elements = $this->xpath->query($path); return $elements->item(0); } -} \ No newline at end of file +}