From 0e2f476cc2818aaad12be1076efd2ed792d9d3be Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 30 Mar 2014 14:15:23 +0700 Subject: [PATCH] Docblock updates --- samples/Sample_Footer.php | 6 +- samples/Sample_Header.php | 10 +-- src/PhpWord/Section.php | 5 +- src/PhpWord/Section/CheckBox.php | 6 +- src/PhpWord/Section/Table/Cell.php | 5 +- src/PhpWord/Writer/Word2007/Base.php | 3 + .../Tests/Exceptions/ExceptionTest.php | 2 + .../Exceptions/InvalidImageExceptionTest.php | 2 + .../Exceptions/InvalidStyleExceptionTest.php | 2 + .../UnsupportedImageTypeExceptionTest.php | 2 + tests/PhpWord/Tests/Reader/Word2007Test.php | 5 ++ .../Tests/Section/Footer/PreserveTextTest.php | 10 ++- tests/PhpWord/Tests/Section/LinkTest.php | 12 ++++ tests/PhpWord/Tests/Section/ListItemTest.php | 9 +++ tests/PhpWord/Tests/Section/ObjectTest.php | 18 ++++++ tests/PhpWord/Tests/Section/SettingsTest.php | 34 +++++++++- tests/PhpWord/Tests/Section/Table/RowTest.php | 9 +++ tests/PhpWord/Tests/Section/TableTest.php | 18 ++++++ tests/PhpWord/Tests/Section/TitleTest.php | 15 +++++ tests/PhpWord/Tests/Shared/StringTest.php | 9 +++ tests/PhpWord/Tests/Style/FontTest.php | 4 +- tests/PhpWord/Tests/Style/ParagraphTest.php | 7 ++- tests/PhpWord/Tests/TemplateTest.php | 1 + .../Tests/Writer/Word2007/FooterTest.php | 2 + .../Tests/Writer/Word2007/FootnotesTest.php | 3 + .../Tests/Writer/Word2007/HeaderTest.php | 3 +- .../Tests/_includes/TestHelperDOCX.php | 26 +++++++- tests/PhpWord/Tests/_includes/XmlDocument.php | 63 ++++++++++++++++--- tests/bootstrap.php | 11 +++- 29 files changed, 271 insertions(+), 31 deletions(-) diff --git a/samples/Sample_Footer.php b/samples/Sample_Footer.php index 5c7d7da1..4d5777c2 100644 --- a/samples/Sample_Footer.php +++ b/samples/Sample_Footer.php @@ -3,7 +3,7 @@ * Footer file */ // Do not show execution time for index -if (!$isIndexFile) { +if (!IS_INDEX) { echo date('H:i:s'), " Done writing file(s)", EOL; echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; } @@ -11,12 +11,12 @@ if (!$isIndexFile) { if (CLI) { echo 'The results are stored in the "results" subdirectory.', EOL; } else { - if (!$isIndexFile) { + if (!IS_INDEX) { $types = array('docx', 'odt', 'rtf'); echo '

 

'; echo '

Results: '; foreach ($types as $type) { - $result = "results/{$sampleFile}.{$type}"; + $result = 'results/' . SCRIPT_FILENAME . '.' . $type; if (file_exists($result)) { echo "{$type} "; } diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 28ae61e7..b61e415a 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -5,6 +5,8 @@ error_reporting(E_ALL); define('CLI', (PHP_SAPI == 'cli') ? true : false); define('EOL', CLI ? PHP_EOL : '
'); +define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php')); +define('IS_INDEX', SCRIPT_FILENAME == 'index'); require_once '../src/PhpWord/Autoloader.php'; PhpOffice\PhpWord\Autoloader::register(); @@ -15,12 +17,10 @@ if (CLI) { } // Set titles and names -$sampleFile = basename($_SERVER['SCRIPT_FILENAME'], '.php'); -$isIndexFile = ($sampleFile == 'index'); -$pageHeading = str_replace('_', ' ', $sampleFile); -$pageTitle = $isIndexFile ? 'Welcome to ' : "{$pageHeading} - "; +$pageHeading = str_replace('_', ' ', SCRIPT_FILENAME); +$pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - "; $pageTitle .= 'PHPWord'; -$pageHeading = $isIndexFile ? '' : "

{$pageHeading}

"; +$pageHeading = IS_INDEX ? '' : "

{$pageHeading}

"; // Populate samples $files = ''; if ($handle = opendir('.')) { diff --git a/src/PhpWord/Section.php b/src/PhpWord/Section.php index 1649ce96..e350f7f8 100644 --- a/src/PhpWord/Section.php +++ b/src/PhpWord/Section.php @@ -421,8 +421,9 @@ class Section * * @param string $name * @param string $text - * @param mixed $style - * @return PHPWord_Section_CheckBox + * @param mixed $styleFont + * @param mixed $styleParagraph + * @return \PhpOffice\PhpWord\Section\CheckBox */ public function addCheckBox($name, $text, $styleFont = null, $styleParagraph = null) { diff --git a/src/PhpWord/Section/CheckBox.php b/src/PhpWord/Section/CheckBox.php index 57671b84..00f75e54 100644 --- a/src/PhpWord/Section/CheckBox.php +++ b/src/PhpWord/Section/CheckBox.php @@ -129,6 +129,8 @@ class CheckBox } /** + * Set name content + * * @param string $name * @return $this */ @@ -149,6 +151,8 @@ class CheckBox } /** + * Set text content + * * @param string $text * @return $this */ @@ -159,7 +163,7 @@ class CheckBox } /** - * Get Text content + * Get text content * * @return string */ diff --git a/src/PhpWord/Section/Table/Cell.php b/src/PhpWord/Section/Table/Cell.php index 45d43ece..e0004350 100755 --- a/src/PhpWord/Section/Table/Cell.php +++ b/src/PhpWord/Section/Table/Cell.php @@ -296,8 +296,9 @@ class Cell * * @param string $name * @param string $text - * @param mixed $style - * @return PHPWord_Section_CheckBox + * @param mixed $styleFont + * @param mixed $styleParagraph + * @return \PhpOffice\PhpWord\Section\CheckBox */ public function addCheckBox($name, $text, $styleFont = null, $styleParagraph = null) { diff --git a/src/PhpWord/Writer/Word2007/Base.php b/src/PhpWord/Writer/Word2007/Base.php index c32eede3..644bf2a2 100644 --- a/src/PhpWord/Writer/Word2007/Base.php +++ b/src/PhpWord/Writer/Word2007/Base.php @@ -1220,6 +1220,9 @@ class Base extends WriterPart /** * Write CheckBox + * + * @param boolean $withoutP + * @param boolean $checkState */ protected function _writeCheckBox(XMLWriter $xmlWriter, CheckBox $checkbox, $withoutP = false, $checkState = false) { diff --git a/tests/PhpWord/Tests/Exceptions/ExceptionTest.php b/tests/PhpWord/Tests/Exceptions/ExceptionTest.php index 2810c054..81732c97 100644 --- a/tests/PhpWord/Tests/Exceptions/ExceptionTest.php +++ b/tests/PhpWord/Tests/Exceptions/ExceptionTest.php @@ -20,6 +20,8 @@ use PhpOffice\PhpWord\Exceptions\Exception; class ExceptionTest extends \PHPUnit_Framework_TestCase { /** + * Throw new exception + * * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @covers \PhpOffice\PhpWord\Exceptions\Exception */ diff --git a/tests/PhpWord/Tests/Exceptions/InvalidImageExceptionTest.php b/tests/PhpWord/Tests/Exceptions/InvalidImageExceptionTest.php index 4ae7c7f0..7db70993 100644 --- a/tests/PhpWord/Tests/Exceptions/InvalidImageExceptionTest.php +++ b/tests/PhpWord/Tests/Exceptions/InvalidImageExceptionTest.php @@ -20,6 +20,8 @@ use PhpOffice\PhpWord\Exceptions\InvalidImageException; class InvalidImageExceptionTest extends \PHPUnit_Framework_TestCase { /** + * Throw new exception + * * @expectedException \PhpOffice\PhpWord\Exceptions\InvalidImageException * @covers \PhpOffice\PhpWord\Exceptions\InvalidImageException */ diff --git a/tests/PhpWord/Tests/Exceptions/InvalidStyleExceptionTest.php b/tests/PhpWord/Tests/Exceptions/InvalidStyleExceptionTest.php index bb782edc..174e07ac 100644 --- a/tests/PhpWord/Tests/Exceptions/InvalidStyleExceptionTest.php +++ b/tests/PhpWord/Tests/Exceptions/InvalidStyleExceptionTest.php @@ -20,6 +20,8 @@ use PhpOffice\PhpWord\Exceptions\InvalidStyleException; class InvalidStyleExceptionTest extends \PHPUnit_Framework_TestCase { /** + * Throw new exception + * * @expectedException \PhpOffice\PhpWord\Exceptions\InvalidStyleException * @covers \PhpOffice\PhpWord\Exceptions\InvalidStyleException */ diff --git a/tests/PhpWord/Tests/Exceptions/UnsupportedImageTypeExceptionTest.php b/tests/PhpWord/Tests/Exceptions/UnsupportedImageTypeExceptionTest.php index ab0d25cc..027ec3a9 100644 --- a/tests/PhpWord/Tests/Exceptions/UnsupportedImageTypeExceptionTest.php +++ b/tests/PhpWord/Tests/Exceptions/UnsupportedImageTypeExceptionTest.php @@ -20,6 +20,8 @@ use PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException; class UnsupportedImageTypeExceptionTest extends \PHPUnit_Framework_TestCase { /** + * Throw new exception + * * @expectedException \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException * @covers \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException */ diff --git a/tests/PhpWord/Tests/Reader/Word2007Test.php b/tests/PhpWord/Tests/Reader/Word2007Test.php index 768f6b6e..5aee8144 100644 --- a/tests/PhpWord/Tests/Reader/Word2007Test.php +++ b/tests/PhpWord/Tests/Reader/Word2007Test.php @@ -41,6 +41,8 @@ class Word2007Test extends \PHPUnit_Framework_TestCase } /** + * Can read exception + * * @expectedException \PhpOffice\PhpWord\Exceptions\Exception */ public function testCanReadFailed() @@ -54,6 +56,9 @@ class Word2007Test extends \PHPUnit_Framework_TestCase $object = IOFactory::load($fqFilename); } + /** + * Load + */ public function testLoad() { $fqFilename = join( diff --git a/tests/PhpWord/Tests/Section/Footer/PreserveTextTest.php b/tests/PhpWord/Tests/Section/Footer/PreserveTextTest.php index e78d2100..82ded881 100644 --- a/tests/PhpWord/Tests/Section/Footer/PreserveTextTest.php +++ b/tests/PhpWord/Tests/Section/Footer/PreserveTextTest.php @@ -14,11 +14,13 @@ use PhpOffice\PhpWord\Section\Footer\PreserveText; /** * Test class for PhpOffice\PhpWord\Section\Footer\PreserveText * - * @coversDefaultClass \PhpOffice\PhpWord\Section\Footer\PreserveText * @runTestsInSeparateProcesses */ class PreserveTextTest extends \PHPUnit_Framework_TestCase { + /** + * Create new instance + */ public function testConstruct() { $oPreserveText = new PreserveText(); @@ -29,6 +31,9 @@ class PreserveTextTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oPreserveText->getParagraphStyle(), null); } + /** + * Create new instance with style name + */ public function testConstructWithString() { $oPreserveText = new PreserveText('text', 'styleFont', 'styleParagraph'); @@ -37,6 +42,9 @@ class PreserveTextTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oPreserveText->getParagraphStyle(), 'styleParagraph'); } + /** + * Create new instance with array + */ public function testConstructWithArray() { $oPreserveText = new PreserveText( diff --git a/tests/PhpWord/Tests/Section/LinkTest.php b/tests/PhpWord/Tests/Section/LinkTest.php index 2e7c05b0..ae1a3e09 100644 --- a/tests/PhpWord/Tests/Section/LinkTest.php +++ b/tests/PhpWord/Tests/Section/LinkTest.php @@ -20,6 +20,9 @@ use PhpOffice\PhpWord\Style\Font; */ class LinkTest extends \PHPUnit_Framework_TestCase { + /** + * Create new instance + */ public function testConstructDefault() { $oLink = new Link('http://www.google.com'); @@ -31,6 +34,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oLink->getParagraphStyle(), null); } + /** + * Create new instance with array + */ public function testConstructWithParamsArray() { $oLink = new Link( @@ -47,6 +53,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oLink->getParagraphStyle()); } + /** + * Create new instance with style name string + */ public function testConstructWithParamsString() { $oLink = new Link('http://www.google.com', null, 'fontStyle', 'paragraphStyle'); @@ -55,6 +64,9 @@ class LinkTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oLink->getParagraphStyle(), 'paragraphStyle'); } + /** + * Set/get relation Id + */ public function testRelationId() { $oLink = new Link('http://www.google.com'); diff --git a/tests/PhpWord/Tests/Section/ListItemTest.php b/tests/PhpWord/Tests/Section/ListItemTest.php index 42af449a..1964cdac 100644 --- a/tests/PhpWord/Tests/Section/ListItemTest.php +++ b/tests/PhpWord/Tests/Section/ListItemTest.php @@ -19,6 +19,9 @@ use PhpOffice\PhpWord\Section\ListItem; */ class ListItemTest extends \PHPUnit_Framework_TestCase { + /** + * Get text object + */ public function testText() { $oListItem = new ListItem('text'); @@ -26,6 +29,9 @@ class ListItemTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\Text', $oListItem->getTextObject()); } + /** + * Get style + */ public function testStyle() { $oListItem = new ListItem( @@ -42,6 +48,9 @@ class ListItemTest extends \PHPUnit_Framework_TestCase ); } + /** + * Get depth + */ public function testDepth() { $iVal = rand(1, 1000); diff --git a/tests/PhpWord/Tests/Section/ObjectTest.php b/tests/PhpWord/Tests/Section/ObjectTest.php index a68b6a0f..d6094de1 100644 --- a/tests/PhpWord/Tests/Section/ObjectTest.php +++ b/tests/PhpWord/Tests/Section/ObjectTest.php @@ -19,6 +19,9 @@ use PhpOffice\PhpWord\Section\Object; */ class ObjectTest extends \PHPUnit_Framework_TestCase { + /** + * Create new instance with supported files + */ public function testConstructWithSupportedFiles() { $src = __DIR__ . "/../_files/documents/sheet.xls"; @@ -29,6 +32,9 @@ class ObjectTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oObject->getSource(), $src); } + /** + * Create new instance with non-supported files + */ public function testConstructWithNotSupportedFiles() { $src = __DIR__ . "/../_files/xsl/passthrough.xsl"; @@ -39,6 +45,9 @@ class ObjectTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oObject->getStyle(), null); } + /** + * Create with style + */ public function testConstructWithSupportedFilesAndStyle() { $src = __DIR__ . "/../_files/documents/sheet.xls"; @@ -49,6 +58,9 @@ class ObjectTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oObject->getSource(), $src); } + /** + * Set/get relation Id + */ public function testRelationId() { $src = __DIR__ . "/../_files/documents/sheet.xls"; @@ -59,6 +71,9 @@ class ObjectTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oObject->getRelationId(), $iVal); } + /** + * Set/get image relation Id + */ public function testImageRelationId() { $src = __DIR__ . "/../_files/documents/sheet.xls"; @@ -69,6 +84,9 @@ class ObjectTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oObject->getImageRelationId(), $iVal); } + /** + * Set/get object relation Id + */ public function testObjectId() { $src = __DIR__ . "/../_files/documents/sheet.xls"; diff --git a/tests/PhpWord/Tests/Section/SettingsTest.php b/tests/PhpWord/Tests/Section/SettingsTest.php index 7c66b67a..8fb62f1c 100644 --- a/tests/PhpWord/Tests/Section/SettingsTest.php +++ b/tests/PhpWord/Tests/Section/SettingsTest.php @@ -57,6 +57,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($iVal, $oSettings->getHeaderHeight()); } + /** + * Set/get margin + */ public function testMargin() { // Section Settings @@ -79,6 +82,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($iVal, $oSettings->getMarginRight()); } + /** + * Set/get landscape orientation + */ public function testOrientationLandscape() { // Section Settings @@ -90,6 +96,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(11906, $oSettings->getPageSizeH()); } + /** + * Set/get portrait orientation + */ public function testOrientationPortrait() { // Section Settings @@ -101,6 +110,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(16838, $oSettings->getPageSizeH()); } + /** + * Set/get border size + */ public function testBorderSize() { // Section Settings @@ -131,6 +143,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($iVal, $oSettings->getBorderTopSize()); } + /** + * Set/get border color + */ public function testBorderColor() { // Section Settings @@ -156,6 +171,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('22FF33', $oSettings->getBorderTopColor()); } + /** + * Set/get page numbering start + */ public function testNumberingStart() { // Section Settings @@ -171,9 +189,11 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertNull($oSettings->getPageNumberingStart()); } + /** + * Set/get header height + */ public function testHeader() { - // Section Settings $oSettings = new Settings(); $this->assertEquals(720, $oSettings->getHeaderHeight()); @@ -186,6 +206,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(720, $oSettings->getHeaderHeight()); } + /** + * Set/get footer height + */ public function testFooter() { // Section Settings @@ -201,6 +224,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(720, $oSettings->getFooterHeight()); } + /** + * Set/get column number + */ public function testColumnsNum() { // Section Settings @@ -217,6 +243,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, $oSettings->getColsNum()); } + /** + * Set/get column spacing + */ public function testColumnsSpace() { // Section Settings @@ -233,6 +262,9 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(720, $oSettings->getColsSpace()); } + /** + * Set/get break type + */ public function testBreakType() { // Section Settings diff --git a/tests/PhpWord/Tests/Section/Table/RowTest.php b/tests/PhpWord/Tests/Section/Table/RowTest.php index 991d8a47..10d53915 100644 --- a/tests/PhpWord/Tests/Section/Table/RowTest.php +++ b/tests/PhpWord/Tests/Section/Table/RowTest.php @@ -19,6 +19,9 @@ use PhpOffice\PhpWord\Section\Table\Row; */ class RowTest extends \PHPUnit_Framework_TestCase { + /** + * Create new instance + */ public function testConstruct() { $iVal = rand(1, 1000); @@ -31,6 +34,9 @@ class RowTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Row', $oRow->getStyle()); } + /** + * Create new instance with parameters + */ public function testConstructWithParams() { $iVal = rand(1, 1000); @@ -46,6 +52,9 @@ class RowTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Row', $oRow->getStyle()); } + /** + * Add cell + */ public function testAddCell() { $oRow = new Row('section', 1); diff --git a/tests/PhpWord/Tests/Section/TableTest.php b/tests/PhpWord/Tests/Section/TableTest.php index c6d3463d..9808485d 100644 --- a/tests/PhpWord/Tests/Section/TableTest.php +++ b/tests/PhpWord/Tests/Section/TableTest.php @@ -19,6 +19,9 @@ use PhpOffice\PhpWord\Section\Table; */ class TableTest extends \PHPUnit_Framework_TestCase { + /** + * Create new instance + */ public function testConstruct() { $oTable = new Table('section', 1); @@ -30,6 +33,9 @@ class TableTest extends \PHPUnit_Framework_TestCase $this->assertCount(0, $oTable->getRows()); } + /** + * Get style name + */ public function testStyleText() { $oTable = new Table('section', 1, 'tableStyle'); @@ -37,6 +43,9 @@ class TableTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oTable->getStyle(), 'tableStyle'); } + /** + * Get style array + */ public function testStyleArray() { $oTable = new Table( @@ -48,6 +57,9 @@ class TableTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Table', $oTable->getStyle()); } + /** + * Set/get width + */ public function testWidth() { $oTable = new Table('section', 1); @@ -56,6 +68,9 @@ class TableTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oTable->getWidth(), $iVal); } + /** + * Add/get row + */ public function testRow() { $oTable = new Table('section', 1); @@ -64,6 +79,9 @@ class TableTest extends \PHPUnit_Framework_TestCase $this->assertCount(1, $oTable->getRows()); } + /** + * Add cell + */ public function testCell() { $oTable = new Table('section', 1); diff --git a/tests/PhpWord/Tests/Section/TitleTest.php b/tests/PhpWord/Tests/Section/TitleTest.php index e1b25e3a..a63d184c 100644 --- a/tests/PhpWord/Tests/Section/TitleTest.php +++ b/tests/PhpWord/Tests/Section/TitleTest.php @@ -19,6 +19,9 @@ use PhpOffice\PhpWord\Section\Title; */ class TitleTest extends \PHPUnit_Framework_TestCase { + /** + * Create new instance + */ public function testConstruct() { $oTitle = new Title('text'); @@ -27,6 +30,9 @@ class TitleTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oTitle->getText(), 'text'); } + /** + * Get style null + */ public function testStyleNull() { $oTitle = new Title('text'); @@ -34,6 +40,9 @@ class TitleTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oTitle->getStyle(), null); } + /** + * Get style not null + */ public function testStyleNotNull() { $oTitle = new Title('text', 1, 'style'); @@ -41,6 +50,9 @@ class TitleTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oTitle->getStyle(), 'style'); } + /** + * Get anchor + */ public function testAnchor() { $oTitle = new Title('text'); @@ -50,6 +62,9 @@ class TitleTest extends \PHPUnit_Framework_TestCase $this->assertEquals($oTitle->getAnchor(), $iVal); } + /** + * Get bookmark Id + */ public function testBookmarkID() { $oTitle = new Title('text'); diff --git a/tests/PhpWord/Tests/Shared/StringTest.php b/tests/PhpWord/Tests/Shared/StringTest.php index bb7a36ad..02b4898a 100644 --- a/tests/PhpWord/Tests/Shared/StringTest.php +++ b/tests/PhpWord/Tests/Shared/StringTest.php @@ -19,6 +19,9 @@ use PhpOffice\PhpWord\Shared\String; */ class StringTest extends \PHPUnit_Framework_TestCase { + /** + * Is UTF8 + */ public function testIsUTF8() { $this->assertTrue(String::isUTF8('')); @@ -26,12 +29,18 @@ class StringTest extends \PHPUnit_Framework_TestCase $this->assertFalse(String::isUTF8(utf8_decode('éééé'))); } + /** + * OOXML to PHP control character + */ public function testControlCharacterOOXML2PHP() { $this->assertEquals('', String::controlCharacterOOXML2PHP('')); $this->assertEquals(chr(0x08), String::controlCharacterOOXML2PHP('_x0008_')); } + /** + * PHP to OOXML control character + */ public function testControlCharacterPHP2OOXML() { $this->assertEquals('', String::controlCharacterPHP2OOXML('')); diff --git a/tests/PhpWord/Tests/Style/FontTest.php b/tests/PhpWord/Tests/Style/FontTest.php index c5e0664b..ed4d61db 100644 --- a/tests/PhpWord/Tests/Style/FontTest.php +++ b/tests/PhpWord/Tests/Style/FontTest.php @@ -16,11 +16,13 @@ use PhpOffice\PhpWord\Tests\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Style\Font * - * @coversDefaultClass \PhpOffice\PhpWord\Style\Font * @runTestsInSeparateProcesses */ class FontTest extends \PHPUnit_Framework_TestCase { + /** + * Tear down after each test + */ public function tearDown() { TestHelperDOCX::clear(); diff --git a/tests/PhpWord/Tests/Style/ParagraphTest.php b/tests/PhpWord/Tests/Style/ParagraphTest.php index 856e2b13..619d5497 100644 --- a/tests/PhpWord/Tests/Style/ParagraphTest.php +++ b/tests/PhpWord/Tests/Style/ParagraphTest.php @@ -17,11 +17,13 @@ use PhpOffice\PhpWord\Tests\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Style\Paragraph * - * @coversDefaultClass \PhpOffice\PhpWord\Style\Paragraph * @runTestsInSeparateProcesses */ class ParagraphTest extends \PHPUnit_Framework_TestCase { + /** + * Tear down after each test + */ public function tearDown() { TestHelperDOCX::clear(); @@ -97,6 +99,9 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Tabs', $object->getTabs()); } + /** + * Line height + */ public function testLineHeight() { $phpWord = new PhpWord(); diff --git a/tests/PhpWord/Tests/TemplateTest.php b/tests/PhpWord/Tests/TemplateTest.php index b9302f7e..669ae946 100644 --- a/tests/PhpWord/Tests/TemplateTest.php +++ b/tests/PhpWord/Tests/TemplateTest.php @@ -65,6 +65,7 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase /** * XSL stylesheet can be applied * + * @param string $actualDocumentFqfn * @covers ::applyXslStyleSheet * @depends testTemplateCanBeSavedInTemporaryLocation * @test diff --git a/tests/PhpWord/Tests/Writer/Word2007/FooterTest.php b/tests/PhpWord/Tests/Writer/Word2007/FooterTest.php index de08ff9d..6d303a0a 100644 --- a/tests/PhpWord/Tests/Writer/Word2007/FooterTest.php +++ b/tests/PhpWord/Tests/Writer/Word2007/FooterTest.php @@ -21,6 +21,8 @@ use PhpOffice\PhpWord\Tests\TestHelperDOCX; class FooterTest extends \PHPUnit_Framework_TestCase { /** + * Write footer + * * @covers ::writeFooter */ public function testWriteFooter() diff --git a/tests/PhpWord/Tests/Writer/Word2007/FootnotesTest.php b/tests/PhpWord/Tests/Writer/Word2007/FootnotesTest.php index a1220d26..6baba0ac 100644 --- a/tests/PhpWord/Tests/Writer/Word2007/FootnotesTest.php +++ b/tests/PhpWord/Tests/Writer/Word2007/FootnotesTest.php @@ -27,6 +27,9 @@ class FootnotesTest extends \PHPUnit_Framework_TestCase TestHelperDOCX::clear(); } + /** + * Write footnotes + */ public function testWriteFootnotes() { $phpWord = new PhpWord(); diff --git a/tests/PhpWord/Tests/Writer/Word2007/HeaderTest.php b/tests/PhpWord/Tests/Writer/Word2007/HeaderTest.php index ca997b65..de3ac010 100644 --- a/tests/PhpWord/Tests/Writer/Word2007/HeaderTest.php +++ b/tests/PhpWord/Tests/Writer/Word2007/HeaderTest.php @@ -15,13 +15,12 @@ use PhpOffice\PhpWord\Tests\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Header * - * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Header * @runTestsInSeparateProcesses */ class HeaderTest extends \PHPUnit_Framework_TestCase { /** - * @covers ::writeHeader + * Write header */ public function testWriteHeader() { diff --git a/tests/PhpWord/Tests/_includes/TestHelperDOCX.php b/tests/PhpWord/Tests/_includes/TestHelperDOCX.php index 97f84ac2..3e24c4cc 100644 --- a/tests/PhpWord/Tests/_includes/TestHelperDOCX.php +++ b/tests/PhpWord/Tests/_includes/TestHelperDOCX.php @@ -1,15 +1,32 @@