diff --git a/composer.json b/composer.json
index f5f751ec..e8720b7b 100644
--- a/composer.json
+++ b/composer.json
@@ -36,7 +36,7 @@
],
"scripts": {
"test": [
- "phpunit --color=always"
+ "phpunit --color=always --filter testReadAlternateContent"
],
"test-no-coverage": [
"phpunit --color=always --no-coverage"
diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php
index cb72ef9f..a0875a67 100644
--- a/tests/PhpWord/Reader/Word2007/ElementTest.php
+++ b/tests/PhpWord/Reader/Word2007/ElementTest.php
@@ -25,6 +25,49 @@ use PhpOffice\PhpWord\Element\TrackChange;
*/
class ElementTest extends AbstractTestReader
{
+ /**
+ * Test reading of alternate content value
+ */
+ public function testReadAlternateContent()
+ {
+ $documentXml = '
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test node value
+
+
+
+
+
+
+
+
+
+ ';
+
+ $phpWord = $this->getDocumentFromString(array('document' => $documentXml));
+
+ $elements = $phpWord->getSection(0)->getElements();
+
+ $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]);
+ $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]->getElement(0));
+
+ $text = $elements[0];
+
+ $this->assertEquals('Test node value', trim($text->getElement(0)->getText()));
+ }
+
/**
* Test reading of textbreak
*/
diff --git a/tests/PhpWord/_includes/AbstractTestReader.php b/tests/PhpWord/_includes/AbstractTestReader.php
index d9097d71..12bd437a 100644
--- a/tests/PhpWord/_includes/AbstractTestReader.php
+++ b/tests/PhpWord/_includes/AbstractTestReader.php
@@ -24,7 +24,7 @@ abstract class AbstractTestReader extends \PHPUnit\Framework\TestCase
{
private $parts = array(
'styles' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Styles', 'xml' => '{toReplace}'),
- 'document' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Document', 'xml' => '{toReplace}'),
+ 'document' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Document', 'xml' => '{toReplace}'),
'footnotes' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Footnotes', 'xml' => '{toReplace}'),
'endnotes' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Endnotes', 'xml' => '{toReplace}'),
'settings' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Settings', 'xml' => '{toReplace}'),