diff --git a/CHANGELOG.md b/CHANGELOG.md
index a2f52bde..7acfecee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@ This is the changelog between releases of PHPWord. Releases are listed in revers
## 0.12.0 - Not yet released
+This release added drawing shapes (arc, curve, line, polyline, rect, oval) element and some new styles.
+
### Features
- Element: Ability to add drawing shapes (arc, curve, line, polyline, rect, oval) using new `Shape` element - @ivanlanin GH-123
@@ -18,13 +20,14 @@ This is the changelog between releases of PHPWord. Releases are listed in revers
### Deprecated
-None yet.
+- `Element\Link::getTarget()` replaced by `Element\Link::getSource()`
### Miscellaneous
- Docs: Add known issue on `README` about requirement for temporary folder to be writable and update `samples/index.php` for this requirement check - @ivanlanin GH-238
- PclZip: Remove temporary file after used - @andrew-kzoo GH-265
- Autoloader: Add the ability to set the autoloader options - @bskrtich GH-267
+- Element: Refactor elements to move set relation Id from container to element - @ivanlanin
## 0.11.1 - 2 June 2014
diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php
index 701b888c..64c4b768 100644
--- a/src/PhpWord/Element/AbstractContainer.php
+++ b/src/PhpWord/Element/AbstractContainer.php
@@ -17,9 +17,6 @@
namespace PhpOffice\PhpWord\Element;
-use PhpOffice\PhpWord\Media;
-use PhpOffice\PhpWord\PhpWord;
-
/**
* Container abstract class
*
@@ -33,6 +30,10 @@ use PhpOffice\PhpWord\PhpWord;
* @method Footnote addFootnote(mixed $pStyle = null)
* @method Endnote addEndnote(mixed $pStyle = null)
* @method CheckBox addCheckBox(string $name, $text, mixed $fStyle = null, mixed $pStyle = null)
+ * @method Title addTitle(string $text, int $depth = 1)
+ * @method TOC addTOC(mixed $fontStyle = null, mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9)
+ *
+ * @method PageBreak addPageBreak()
* @method Table addTable(mixed $style = null)
* @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false)
* @method Object addObject(string $source, mixed $style = null)
@@ -125,10 +126,6 @@ abstract class AbstractContainer extends AbstractElement
if ($withoutP && ($elementName == 'Text' || $elementName == 'PreserveText')) {
$args[3] = null; // Remove paragraph style for texts in textrun
}
- $source = '';
- if (count($args) > 1) {
- $source = $args[1];
- }
// Create element using reflection
$reflection = new \ReflectionClass($elementClass);
@@ -138,15 +135,10 @@ abstract class AbstractContainer extends AbstractElement
/** @var \PhpOffice\PhpWord\Element\AbstractElement $element Type hint */
$element = $reflection->newInstanceArgs($elementArgs);
- // Set nested level and relation Id
- $this->setElementNestedLevel($element);
- $this->setElementRelationId($element, $elementName, $source);
-
- // Set other properties and add element into collection
- $element->setDocPart($this->getDocPart(), $this->getDocPartId());
+ // Set parent container
+ $element->setParentContainer($this);
$element->setElementIndex($this->countElements() + 1);
$element->setElementId();
- $element->setPhpWord($this->phpWord);
$this->elements[] = $element;
@@ -173,55 +165,6 @@ abstract class AbstractContainer extends AbstractElement
return count($this->elements);
}
- /**
- * Set element nested level based on container; add one when it's inside a cell
- */
- private function setElementNestedLevel(AbstractElement $element)
- {
- if ($this->container == 'Cell') {
- $element->setNestedLevel($this->getNestedLevel() + 1);
- } else {
- $element->setNestedLevel($this->getNestedLevel());
- }
- }
-
- /**
- * Set relation Id
- *
- * @param \PhpOffice\PhpWord\Element\AbstractElement $element
- * @param string $elementName
- * @param string $source
- */
- private function setElementRelationId(AbstractElement $element, $elementName, $source)
- {
- $mediaContainer = $this->getMediaContainer();
- $hasMediaRelation = in_array($elementName, array('Link', 'Image', 'Object'));
- $hasOtherRelation = in_array($elementName, array('Footnote', 'Endnote', 'Title'));
-
- // Set relation Id for media elements (link, image, object; legacy of OOXML)
- // Only Image that needs to be passed to Media class
- if ($hasMediaRelation) {
- /** @var \PhpOffice\PhpWord\Element\Image $element Type hint */
- $image = ($elementName == 'Image') ? $element : null;
- $rId = Media::addElement($mediaContainer, strtolower($elementName), $source, $image);
- $element->setRelationId($rId);
- }
-
- // Set relation Id for icon of object element
- if ($elementName == 'Object') {
- /** @var \PhpOffice\PhpWord\Element\Object $element Type hint */
- $rIdIcon = Media::addElement($mediaContainer, 'image', $element->getIcon(), new Image($element->getIcon()));
- $element->setImageRelationId($rIdIcon);
- }
-
- // Set relation Id for elements that will be registered in the Collection subnamespaces
- if ($hasOtherRelation && $this->phpWord instanceof PhpWord) {
- $addMethod = "add{$elementName}";
- $rId = $this->phpWord->$addMethod($element);
- $element->setRelationId($rId);
- }
- }
-
/**
* Check if a method is allowed for the current container
*
@@ -254,6 +197,9 @@ abstract class AbstractContainer extends AbstractElement
'Footnote' => array('Section', 'TextRun', 'Cell'),
'Endnote' => array('Section', 'TextRun', 'Cell'),
'PreserveText' => array('Header', 'Footer', 'Cell'),
+ 'Title' => array('Section'),
+ 'TOC' => array('Section'),
+ 'PageBreak' => array('Section'),
);
// Special condition, e.g. preservetext can only exists in cell when
// the cell is located in header or footer
@@ -284,24 +230,6 @@ abstract class AbstractContainer extends AbstractElement
return true;
}
- /**
- * Return media element (image, object, link) container name
- *
- * @return string section|headerx|footerx|footnote|endnote
- */
- private function getMediaContainer()
- {
- $partName = $this->container;
- if (in_array($partName, array('Cell', 'TextRun', 'TextBox', 'ListItemRun'))) {
- $partName = $this->getDocPart();
- }
- if ($partName == 'Header' || $partName == 'Footer') {
- $partName .= $this->getDocPartId();
- }
-
- return strtolower($partName);
- }
-
/**
* Add memory image element
*
diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php
index c8e574b7..623f6bfb 100644
--- a/src/PhpWord/Element/AbstractElement.php
+++ b/src/PhpWord/Element/AbstractElement.php
@@ -17,6 +17,7 @@
namespace PhpOffice\PhpWord\Element;
+use PhpOffice\PhpWord\Media;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style;
@@ -42,7 +43,7 @@ abstract class AbstractElement
protected $sectionId;
/**
- * Document part type: section|header|footer
+ * Document part type: Section|Header|Footer|Footnote|Endnote
*
* Used by textrun and cell container to determine where the element is
* located because it will affect the availability of other element,
@@ -93,6 +94,27 @@ abstract class AbstractElement
*/
private $nestedLevel = 0;
+ /**
+ * Parent container type
+ *
+ * @var string
+ */
+ private $parentContainer;
+
+ /**
+ * Has media relation flag; true for Link, Image, and Object
+ *
+ * @var bool
+ */
+ protected $mediaRelation = false;
+
+ /**
+ * Is part of collection; true for Title, Footnote, and Endnote
+ *
+ * @var bool
+ */
+ protected $collectionRelation = false;
+
/**
* Get PhpWord
*
@@ -155,6 +177,21 @@ abstract class AbstractElement
return $this->docPartId;
}
+ /**
+ * Return media element (image, object, link) container name
+ *
+ * @return string section|headerx|footerx|footnote|endnote
+ */
+ private function getMediaPart()
+ {
+ $mediaPart = $this->docPart;
+ if ($mediaPart == 'Header' || $mediaPart == 'Footer') {
+ $mediaPart .= $this->docPartId;
+ }
+
+ return strtolower($mediaPart);
+ }
+
/**
* Get element index
*
@@ -224,13 +261,74 @@ abstract class AbstractElement
}
/**
- * Set nested level
+ * Set parent container
*
- * @param int $value
+ * Passed parameter should be a container, except for Table (contain Row) and Row (contain Cell)
+ *
+ * @param \PhpOffice\PhpWord\Element\AbstractElement $container
*/
- public function setNestedLevel($value)
+ public function setParentContainer(AbstractElement $container)
{
- $this->nestedLevel = $value;
+ $this->parentContainer = substr(get_class($container), strrpos(get_class($container), '\\') + 1);
+
+ // Set nested level
+ $this->nestedLevel = $container->getNestedLevel();
+ if ($this->parentContainer == 'Cell') {
+ $this->nestedLevel++;
+ }
+
+ // Set phpword
+ $phpWord = $container->getPhpWord();
+ $this->setPhpWord($phpWord);
+
+ // Set doc part
+ if (!$this instanceof Footnote) {
+ $this->setDocPart($container->getDocPart(), $container->getDocPartId());
+ }
+
+ $this->setMediaRelation();
+ $this->setCollectionRelation();
+ }
+
+ /**
+ * Set relation Id for media elements (link, image, object; legacy of OOXML)
+ *
+ * - Image element needs to be passed to Media object
+ * - Icon needs to be set for Object element
+ */
+ private function setMediaRelation()
+ {
+ if ($this->mediaRelation === false) {
+ return;
+ }
+
+ $mediaPart = $this->getMediaPart();
+ $elementName = substr(get_class($this), strrpos(get_class($this), '\\') + 1);
+
+ /** @var \PhpOffice\PhpWord\Element\Image $this Type hint */
+ $source = $this->getSource();
+ $image = ($elementName == 'Image') ? $this : null;
+ $rId = Media::addElement($mediaPart, strtolower($elementName), $source, $image);
+ $this->setRelationId($rId);
+
+ if ($elementName == 'Object') {
+ /** @var \PhpOffice\PhpWord\Element\Object $this Type hint */
+ $rId = Media::addElement($mediaPart, 'image', $this->getIcon(), new Image($this->getIcon()));
+ $this->setImageRelationId($rId);
+ }
+ }
+
+ /**
+ * Set relation Id for elements that will be registered in the Collection subnamespaces
+ */
+ private function setCollectionRelation()
+ {
+ if ($this->collectionRelation === true && $this->phpWord instanceof PhpWord) {
+ $elementName = substr(get_class($this), strrpos(get_class($this), '\\') + 1);
+ $addMethod = "add{$elementName}";
+ $rId = $this->phpWord->$addMethod($this);
+ $this->setRelationId($rId);
+ }
}
/**
diff --git a/src/PhpWord/Element/Footnote.php b/src/PhpWord/Element/Footnote.php
index 76311c6b..82bcd88f 100644
--- a/src/PhpWord/Element/Footnote.php
+++ b/src/PhpWord/Element/Footnote.php
@@ -36,6 +36,13 @@ class Footnote extends AbstractContainer
*/
protected $paragraphStyle;
+ /**
+ * Is part of collection; true for Title, Footnote, and Endnote
+ *
+ * @var bool
+ */
+ protected $collectionRelation = true;
+
/**
* Create new instance
*
@@ -44,6 +51,7 @@ class Footnote extends AbstractContainer
public function __construct($paragraphStyle = null)
{
$this->paragraphStyle = $this->setStyle(new Paragraph(), $paragraphStyle);
+ $this->setDocPart($this->container);
}
/**
diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php
index a1cb8250..3d6a5545 100644
--- a/src/PhpWord/Element/Image.php
+++ b/src/PhpWord/Element/Image.php
@@ -111,6 +111,13 @@ class Image extends AbstractElement
*/
private $mediaIndex;
+ /**
+ * Has media relation flag; true for Link, Image, and Object
+ *
+ * @var bool
+ */
+ protected $mediaRelation = true;
+
/**
* Create new image element
*
diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php
index 3ffe58d4..d962a3b5 100644
--- a/src/PhpWord/Element/Link.php
+++ b/src/PhpWord/Element/Link.php
@@ -27,11 +27,11 @@ use PhpOffice\PhpWord\Style\Paragraph;
class Link extends AbstractElement
{
/**
- * Link target
+ * Link source
*
* @var string
*/
- private $target;
+ private $source;
/**
* Link text
@@ -54,19 +54,25 @@ class Link extends AbstractElement
*/
private $paragraphStyle;
+ /**
+ * Has media relation flag; true for Link, Image, and Object
+ *
+ * @var bool
+ */
+ protected $mediaRelation = true;
/**
* Create a new Link Element
*
- * @param string $target
+ * @param string $source
* @param string $text
* @param mixed $fontStyle
* @param mixed $paragraphStyle
*/
- public function __construct($target, $text = null, $fontStyle = null, $paragraphStyle = null)
+ public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null)
{
- $this->target = String::toUTF8($target);
- $this->text = is_null($text) ? $this->target : String::toUTF8($text);
+ $this->source = String::toUTF8($source);
+ $this->text = is_null($text) ? $this->source : String::toUTF8($text);
$this->fontStyle = $this->setStyle(new Font('text'), $fontStyle);
$this->paragraphStyle = $this->setStyle(new Paragraph(), $paragraphStyle);
@@ -74,13 +80,13 @@ class Link extends AbstractElement
}
/**
- * Get link target
+ * Get link source
*
* @return string
*/
- public function getTarget()
+ public function getSource()
{
- return $this->target;
+ return $this->source;
}
/**
@@ -113,6 +119,18 @@ class Link extends AbstractElement
return $this->paragraphStyle;
}
+ /**
+ * Get link target
+ *
+ * @return string
+ * @deprecated 0.12.0
+ * @codeCoverageIgnore
+ */
+ public function getTarget()
+ {
+ return $this->source;
+ }
+
/**
* Get Link source
*
@@ -122,7 +140,7 @@ class Link extends AbstractElement
*/
public function getLinkSrc()
{
- return $this->getTarget();
+ return $this->getSource();
}
/**
diff --git a/src/PhpWord/Element/Object.php b/src/PhpWord/Element/Object.php
index a63c1869..ca3ecdf1 100644
--- a/src/PhpWord/Element/Object.php
+++ b/src/PhpWord/Element/Object.php
@@ -53,6 +53,13 @@ class Object extends AbstractElement
*/
private $imageRelationId;
+ /**
+ * Has media relation flag; true for Link, Image, and Object
+ *
+ * @var bool
+ */
+ protected $mediaRelation = true;
+
/**
* Create a new Ole-Object Element
*
diff --git a/src/PhpWord/Element/Row.php b/src/PhpWord/Element/Row.php
index d7dcea34..acbb75dc 100644
--- a/src/PhpWord/Element/Row.php
+++ b/src/PhpWord/Element/Row.php
@@ -69,9 +69,7 @@ class Row extends AbstractElement
public function addCell($width = null, $style = null)
{
$cell = new Cell($width, $style);
- $cell->setDocPart($this->getDocPart(), $this->getDocPartId());
- $cell->setPhpWord($this->phpWord);
- $cell->setNestedLevel($this->getNestedLevel());
+ $cell->setParentContainer($this);
$this->cells[] = $cell;
return $cell;
diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php
index b7cee6a2..6fc63332 100644
--- a/src/PhpWord/Element/Section.php
+++ b/src/PhpWord/Element/Section.php
@@ -92,40 +92,6 @@ class Section extends AbstractContainer
return $this->settings;
}
- /**
- * Add a Title Element
- *
- * @param string $text
- * @param int $depth
- * @return \PhpOffice\PhpWord\Element\Title
- */
- public function addTitle($text, $depth = 1)
- {
- return $this->addElement('Title', $text, $depth);
- }
-
- /**
- * Add a PageBreak Element
- */
- public function addPageBreak()
- {
- return $this->addElement('PageBreak');
- }
-
- /**
- * Add a Table-of-Contents Element
- *
- * @param mixed $fontStyle
- * @param mixed $tocStyle
- * @param integer $minDepth
- * @param integer $maxDepth
- * @return \PhpOffice\PhpWord\Element\TOC
- */
- public function addTOC($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9)
- {
- return $this->addElement('TOC', $fontStyle, $tocStyle, $minDepth, $maxDepth);
- }
-
/**
* Add header
*
diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php
index ace63460..2d59073e 100644
--- a/src/PhpWord/Element/Table.php
+++ b/src/PhpWord/Element/Table.php
@@ -65,9 +65,7 @@ class Table extends AbstractElement
public function addRow($height = null, $style = null)
{
$row = new Row($height, $style);
- $row->setDocPart($this->getDocPart(), $this->getDocPartId());
- $row->setPhpWord($this->phpWord);
- $row->setNestedLevel($this->getNestedLevel());
+ $row->setParentContainer($this);
$this->rows[] = $row;
return $row;
diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php
index d5206879..a4faeb70 100644
--- a/src/PhpWord/Element/Title.php
+++ b/src/PhpWord/Element/Title.php
@@ -46,6 +46,13 @@ class Title extends AbstractElement
*/
private $style;
+ /**
+ * Is part of collection; true for Title, Footnote, and Endnote
+ *
+ * @var bool
+ */
+ protected $collectionRelation = true;
+
/**
* Create a new Title Element
*
diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php
index a7261d6d..ac26dee5 100644
--- a/src/PhpWord/Reader/Word2007/AbstractPart.php
+++ b/src/PhpWord/Reader/Word2007/AbstractPart.php
@@ -483,8 +483,8 @@ abstract class AbstractPart
$style = true;
} elseif ($method == self::READ_FALSE) {
$style = false;
- } elseif ($method == self::READ_EQUAL && $attributeValue == $expected) {
- $style = true;
+ } elseif ($method == self::READ_EQUAL) {
+ $style = $attributeValue == $expected;
}
return $style;
diff --git a/src/PhpWord/Writer/HTML/Element/Link.php b/src/PhpWord/Writer/HTML/Element/Link.php
index d1256eb0..4e99810c 100644
--- a/src/PhpWord/Writer/HTML/Element/Link.php
+++ b/src/PhpWord/Writer/HTML/Element/Link.php
@@ -37,7 +37,7 @@ class Link extends Text
$content = '';
$content .= $this->writeOpening();
- $content .= "element->getTarget()}\">{$this->element->getText()}";
+ $content .= "element->getSource()}\">{$this->element->getText()}";
$content .= $this->writeClosing();
return $content;
diff --git a/src/PhpWord/Writer/ODText/Element/Link.php b/src/PhpWord/Writer/ODText/Element/Link.php
index 79d3aa24..adb64f85 100644
--- a/src/PhpWord/Writer/ODText/Element/Link.php
+++ b/src/PhpWord/Writer/ODText/Element/Link.php
@@ -41,7 +41,7 @@ class Link extends AbstractElement
$xmlWriter->startElement('text:a');
$xmlWriter->writeAttribute('xlink:type', 'simple');
- $xmlWriter->writeAttribute('xlink:href', $element->getTarget());
+ $xmlWriter->writeAttribute('xlink:href', $element->getSource());
$xmlWriter->writeRaw($element->getText());
$xmlWriter->endElement(); // text:a
diff --git a/src/PhpWord/Writer/RTF/Element/Link.php b/src/PhpWord/Writer/RTF/Element/Link.php
index 22b08588..adbc7976 100644
--- a/src/PhpWord/Writer/RTF/Element/Link.php
+++ b/src/PhpWord/Writer/RTF/Element/Link.php
@@ -39,7 +39,7 @@ class Link extends AbstractElement
$content = '';
$content .= $this->writeOpening();
- $content .= '{\field {\*\fldinst {HYPERLINK "' . $this->element->getTarget() . '"}}{\\fldrslt {';
+ $content .= '{\field {\*\fldinst {HYPERLINK "' . $this->element->getSource() . '"}}{\\fldrslt {';
$content .= $this->writeFontStyle();
$content .= $this->writeText($this->element->getText());
$content .= '}}}';
diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php
index 73673f05..6eb38dc2 100644
--- a/src/PhpWord/Writer/Word2007/Style/Font.php
+++ b/src/PhpWord/Writer/Word2007/Style/Font.php
@@ -64,8 +64,10 @@ class Font extends AbstractStyle
$xmlWriter->startElement('w:rPr');
// Style name
- $styleName = $style->getStyleName();
- $xmlWriter->writeElementIf(!is_null($styleName), 'w:rStyle', 'w:val', $styleName);
+ if ($this->isInline === true) {
+ $styleName = $style->getStyleName();
+ $xmlWriter->writeElementIf($styleName !== null, 'w:rStyle', 'w:val', $styleName);
+ }
// Font name/family
$font = $style->getName();
diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php
index 4ccba00f..f8d6cf1e 100644
--- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php
+++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php
@@ -83,7 +83,9 @@ class Paragraph extends AbstractStyle
}
// Style name
- $xmlWriter->writeElementIf($styles['name'] !== null, 'w:pStyle', 'w:val', $styles['name']);
+ if ($this->isInline === true) {
+ $xmlWriter->writeElementIf($styles['name'] !== null, 'w:pStyle', 'w:val', $styles['name']);
+ }
// Alignment
$styleWriter = new Alignment($xmlWriter, new AlignmentStyle(array('value' => $styles['alignment'])));
diff --git a/tests/PhpWord/Tests/Element/LinkTest.php b/tests/PhpWord/Tests/Element/LinkTest.php
index 0e582b13..ada6a36a 100644
--- a/tests/PhpWord/Tests/Element/LinkTest.php
+++ b/tests/PhpWord/Tests/Element/LinkTest.php
@@ -36,8 +36,8 @@ class LinkTest extends \PHPUnit_Framework_TestCase
$oLink = new Link('http://www.google.com');
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $oLink);
- $this->assertEquals($oLink->getTarget(), 'http://www.google.com');
- $this->assertEquals($oLink->getText(), $oLink->getTarget());
+ $this->assertEquals($oLink->getSource(), 'http://www.google.com');
+ $this->assertEquals($oLink->getText(), $oLink->getSource());
$this->assertEquals($oLink->getFontStyle(), null);
$this->assertEquals($oLink->getParagraphStyle(), null);
}
@@ -55,7 +55,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase
);
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $oLink);
- $this->assertEquals($oLink->getTarget(), 'http://www.google.com');
+ $this->assertEquals($oLink->getSource(), 'http://www.google.com');
$this->assertEquals($oLink->getText(), 'Search Engine');
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Font', $oLink->getFontStyle());
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oLink->getParagraphStyle());
diff --git a/tests/PhpWord/Tests/Element/ListItemRunTest.php b/tests/PhpWord/Tests/Element/ListItemRunTest.php
index 37d679f9..7bb0c25d 100644
--- a/tests/PhpWord/Tests/Element/ListItemRunTest.php
+++ b/tests/PhpWord/Tests/Element/ListItemRunTest.php
@@ -131,7 +131,7 @@ class ListItemRunTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $element);
$this->assertCount(1, $oListItemRun->getElements());
- $this->assertEquals($element->getTarget(), 'http://www.google.fr');
+ $this->assertEquals($element->getSource(), 'http://www.google.fr');
}
/**
@@ -144,7 +144,7 @@ class ListItemRunTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $element);
$this->assertCount(1, $oListItemRun->getElements());
- $this->assertEquals($element->getTarget(), 'http://www.google.fr');
+ $this->assertEquals($element->getSource(), 'http://www.google.fr');
$this->assertEquals($element->getText(), 'ééé');
}
diff --git a/tests/PhpWord/Tests/Element/TextRunTest.php b/tests/PhpWord/Tests/Element/TextRunTest.php
index 870214dd..de62a920 100644
--- a/tests/PhpWord/Tests/Element/TextRunTest.php
+++ b/tests/PhpWord/Tests/Element/TextRunTest.php
@@ -99,7 +99,7 @@ class TextRunTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $element);
$this->assertCount(1, $oTextRun->getElements());
- $this->assertEquals($element->getTarget(), 'http://www.google.fr');
+ $this->assertEquals($element->getSource(), 'http://www.google.fr');
}
/**
@@ -112,7 +112,7 @@ class TextRunTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $element);
$this->assertCount(1, $oTextRun->getElements());
- $this->assertEquals($element->getTarget(), 'http://www.google.fr');
+ $this->assertEquals($element->getSource(), 'http://www.google.fr');
$this->assertEquals($element->getText(), 'ééé');
}
diff --git a/tests/PhpWord/Tests/Style/SectionTest.php b/tests/PhpWord/Tests/Style/SectionTest.php
index de582948..8e8c1e87 100644
--- a/tests/PhpWord/Tests/Style/SectionTest.php
+++ b/tests/PhpWord/Tests/Style/SectionTest.php
@@ -37,6 +37,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('portrait', $oSettings->getOrientation());
$this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW());
$this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH());
+ $this->assertEquals('A4', $oSettings->getPaperSize());
$oSettings->setSettingValue('orientation', 'landscape');
$this->assertEquals('landscape', $oSettings->getOrientation());