diff --git a/.travis.yml b/.travis.yml index 2e22b855..a8b60e2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,13 +52,13 @@ script: ## PHP Copy/Paste Detector - phpcpd src/ tests/ --verbose ## PHP Mess Detector - - phpmd src/ text unusedcode,naming,design,controversial --exclude pclzip.lib.php + - phpmd src/,tests/ text unusedcode,naming,design,controversial --exclude pclzip.lib.php ## PHPLOC #- php phploc.phar src/ ## PHPUnit - phpunit -c ./ --coverage-text --coverage-html ./build/coverage ## PHPDocumentor - - vendor/bin/phpdoc.php -d ./src -t ./build/docs + - vendor/bin/phpdoc.php -d ./src -t ./build/docs -i ./src/PhpWord/Shared/PCLZip/ after_script: ## PHPDocumentor diff --git a/.travis_shell_after_success.sh b/.travis_shell_after_success.sh index 308388d7..35c7a338 100644 --- a/.travis_shell_after_success.sh +++ b/.travis_shell_after_success.sh @@ -31,7 +31,7 @@ if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == echo "--DEBUG : Git" git add -f . - git commit -m "PHPDocumentor (Travis Build : $TRAVIS_BUILD_NUMBER - Branch : $TRAVIS_BRANCH)" + git commit -m "PHPDocumentor (Travis Build: $TRAVIS_BUILD_NUMBER - Branch: $TRAVIS_BRANCH)" git push -fq origin gh-pages > /dev/null echo -e "Published PHPDoc to gh-pages.\n" diff --git a/CHANGELOG.md b/CHANGELOG.md index 35c5ea1b..64804690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This is the changelog between releases of PHPWord. Releases are listed in revers ## 0.11.0 - Not yet released -PHPWord license is changed from LGPL 2.1 to LGPL 3 in this release. +This release changed PHPWord license from LGPL 2.1 to LGPL 3. ### Features diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f77b9ce3..ce823a54 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -21,4 +21,7 @@ + + + \ No newline at end of file diff --git a/tests/PhpWord/Tests/Element/CellTest.php b/tests/PhpWord/Tests/Element/CellTest.php index c2ce43d6..9466f521 100644 --- a/tests/PhpWord/Tests/Element/CellTest.php +++ b/tests/PhpWord/Tests/Element/CellTest.php @@ -219,7 +219,7 @@ class CellTest extends \PHPUnit_Framework_TestCase { $src = __DIR__ . "/../_files/xsl/passthrough.xsl"; $oCell = new Cell('section', 1); - $element = $oCell->addObject($src); + $oCell->addObject($src); } /** @@ -255,7 +255,7 @@ class CellTest extends \PHPUnit_Framework_TestCase public function testAddPreserveTextException() { $oCell = new Cell('section', 1); - $element = $oCell->addPreserveText('text'); + $oCell->addPreserveText('text'); } /** diff --git a/tests/PhpWord/Tests/Element/ImageTest.php b/tests/PhpWord/Tests/Element/ImageTest.php index f5c35701..ca5234ea 100644 --- a/tests/PhpWord/Tests/Element/ImageTest.php +++ b/tests/PhpWord/Tests/Element/ImageTest.php @@ -107,6 +107,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase public function testInvalidImagePhp() { $object = new Image('test.php'); + $object->getSource(); } /** @@ -117,6 +118,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase public function testUnsupportedImage() { $object = new Image('http://samples.libav.org/image-samples/RACECAR.BMP'); + $object->getSource(); } /** diff --git a/tests/PhpWord/Tests/Element/ObjectTest.php b/tests/PhpWord/Tests/Element/ObjectTest.php index 69b11e47..33b63ec9 100644 --- a/tests/PhpWord/Tests/Element/ObjectTest.php +++ b/tests/PhpWord/Tests/Element/ObjectTest.php @@ -34,15 +34,14 @@ class ObjectTest extends \PHPUnit_Framework_TestCase /** * Create new instance with non-supported files + * + * @expectedException \PhpOffice\PhpWord\Exception\InvalidObjectException */ public function testConstructWithNotSupportedFiles() { $src = __DIR__ . "/../_files/xsl/passthrough.xsl"; $oObject = new Object($src); - - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); - $this->assertEquals($oObject->getSource(), null); - $this->assertEquals($oObject->getStyle(), null); + $oObject->getSource(); } /** diff --git a/tests/PhpWord/Tests/Element/SectionTest.php b/tests/PhpWord/Tests/Element/SectionTest.php index 04cda267..068aaa97 100644 --- a/tests/PhpWord/Tests/Element/SectionTest.php +++ b/tests/PhpWord/Tests/Element/SectionTest.php @@ -76,7 +76,7 @@ class SectionTest extends \PHPUnit_Framework_TestCase { $objectSource = __DIR__ . "/../_files/documents/reader.docx"; $imageSource = __DIR__ . "/../_files/images/PhpWord.png"; - $imageUrl = 'http://php.net//images/logos/php-med-trans-light.gif'; + // $imageUrl = 'http://php.net//images/logos/php-med-trans-light.gif'; $section = new Section(0); $section->setPhpWord(new PhpWord()); @@ -98,10 +98,10 @@ class SectionTest extends \PHPUnit_Framework_TestCase $elementTypes = array('Text', 'Link', 'TextBreak', 'PageBreak', 'Table', 'ListItem', 'Object', 'Image', 'Title', 'TextRun', 'Footnote', 'CheckBox', 'TOC'); - $i = 0; + $elmCount = 0; foreach ($elementTypes as $elementType) { - $this->assertInstanceOf("PhpOffice\\PhpWord\\Element\\{$elementType}", $elementCollection[$i]); - $i++; + $this->assertInstanceOf("PhpOffice\\PhpWord\\Element\\{$elementType}", $elementCollection[$elmCount]); + $elmCount++; } } @@ -166,6 +166,6 @@ class SectionTest extends \PHPUnit_Framework_TestCase public function testAddHeaderException() { $object = new Section(1); - $header = $object->addHeader('ODD'); + $object->addHeader('ODD'); } } diff --git a/tests/PhpWord/Tests/Element/TOCTest.php b/tests/PhpWord/Tests/Element/TOCTest.php index c38f3b41..77875037 100644 --- a/tests/PhpWord/Tests/Element/TOCTest.php +++ b/tests/PhpWord/Tests/Element/TOCTest.php @@ -48,7 +48,7 @@ class TOCTest extends \PHPUnit_Framework_TestCase public function testConstructWithStyleName() { $object = new TOC('Font Style'); - $tocStyle = $object->getStyleTOC(); + // $tocStyle = $object->getStyleTOC(); $this->assertEquals('Font Style', $object->getStyleFont()); } diff --git a/tests/PhpWord/Tests/Element/TextRunTest.php b/tests/PhpWord/Tests/Element/TextRunTest.php index 6b9011c2..49b9c3bb 100644 --- a/tests/PhpWord/Tests/Element/TextRunTest.php +++ b/tests/PhpWord/Tests/Element/TextRunTest.php @@ -114,7 +114,7 @@ class TextRunTest extends \PHPUnit_Framework_TestCase public function testAddTextBreak() { $oTextRun = new TextRun(); - $element = $oTextRun->addTextBreak(2); + $oTextRun->addTextBreak(2); $this->assertCount(2, $oTextRun->getElements()); } diff --git a/tests/PhpWord/Tests/Shared/FontTest.php b/tests/PhpWord/Tests/Shared/FontTest.php index 8183051b..a6c10362 100644 --- a/tests/PhpWord/Tests/Shared/FontTest.php +++ b/tests/PhpWord/Tests/Shared/FontTest.php @@ -25,8 +25,6 @@ class FontTest extends \PHPUnit_Framework_TestCase */ public function testConversions() { - $phpWord = new PhpWord(); - $original = 1; $result = Font::fontSizeToPixels($original); diff --git a/tests/PhpWord/Tests/Style/CellTest.php b/tests/PhpWord/Tests/Style/CellTest.php index 3838a36e..78b5d60d 100644 --- a/tests/PhpWord/Tests/Style/CellTest.php +++ b/tests/PhpWord/Tests/Style/CellTest.php @@ -56,7 +56,6 @@ class CellTest extends \PHPUnit_Framework_TestCase { $object = new Cell(); - $default = '000000'; $value = 'FF0000'; $object->setStyleValue('borderColor', $value); diff --git a/tests/PhpWord/Tests/Writer/PDF/DomPDFTest.php b/tests/PhpWord/Tests/Writer/PDF/DomPDFTest.php index d8d941e7..3dd21d7f 100644 --- a/tests/PhpWord/Tests/Writer/PDF/DomPDFTest.php +++ b/tests/PhpWord/Tests/Writer/PDF/DomPDFTest.php @@ -48,7 +48,6 @@ class DomPDFTest extends \PHPUnit_Framework_TestCase public function testSetGetAbstractRendererProperties() { define('DOMPDF_ENABLE_AUTOLOAD', false); - $file = __DIR__ . "/../../_files/temp.pdf"; $rendererName = Settings::PDF_RENDERER_DOMPDF; $rendererLibraryPath = realpath(PHPWORD_TESTS_BASE_DIR . '/../vendor/dompdf/dompdf'); diff --git a/tests/PhpWord/Tests/Writer/PDFTest.php b/tests/PhpWord/Tests/Writer/PDFTest.php index 79776579..0359ba18 100644 --- a/tests/PhpWord/Tests/Writer/PDFTest.php +++ b/tests/PhpWord/Tests/Writer/PDFTest.php @@ -47,5 +47,6 @@ class PDFTest extends \PHPUnit_Framework_TestCase public function testConstructException() { $writer = new PDF(new PhpWord()); + $writer->save(); } } diff --git a/tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php index 9597e772..8c7ae1c7 100644 --- a/tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php @@ -361,11 +361,11 @@ class DocumentTest extends \PHPUnit_Framework_TestCase $doc = TestHelperDOCX::getDocument($phpWord); // Test the attributes - $i = 0; + $attributeCount = 0; foreach ($attributes as $key => $value) { - $i++; + $attributeCount++; $nodeName = ($key == 'align') ? 'jc' : $key; - $path = "/w:document/w:body/w:p[{$i}]/w:pPr/w:{$nodeName}"; + $path = "/w:document/w:body/w:p[{$attributeCount}]/w:pPr/w:{$nodeName}"; if ($key != 'align') { $value = $value ? 1 : 0; } @@ -416,7 +416,6 @@ class DocumentTest extends \PHPUnit_Framework_TestCase public function testWriteTableStyle() { $phpWord = new PhpWord(); - $tWidth = 120; $rHeight = 120; $cWidth = 120; $imageSrc = __DIR__ . "/../../../_files/images/earth.jpg"; @@ -511,7 +510,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase $lineNumberingPath = '/w:document/w:body/w:sectPr/w:lnNumType'; $phpWord = new PhpWord(); - $section = $phpWord->addSection(array('gutter' => 240, 'lineNumbering' => array())); + $phpWord->addSection(array('gutter' => 240, 'lineNumbering' => array())); $doc = TestHelperDOCX::getDocument($phpWord); $this->assertEquals(240, $doc->getElement($pageMarginPath)->getAttribute('w:gutter')); diff --git a/tests/PhpWord/Tests/Writer/Word2007Test.php b/tests/PhpWord/Tests/Writer/Word2007Test.php index 3dbdd049..4be12d40 100644 --- a/tests/PhpWord/Tests/Writer/Word2007Test.php +++ b/tests/PhpWord/Tests/Writer/Word2007Test.php @@ -171,7 +171,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase public function testSetGetUseDiskCaching() { $phpWord = new PhpWord(); - $section = $phpWord->addSection(); + $phpWord->addSection(); $object = new Word2007($phpWord); $object->setUseDiskCaching(true, PHPWORD_TESTS_BASE_DIR); $writer = new Word2007($phpWord);