Docblock updates

This commit is contained in:
Ivan Lanin 2014-03-30 14:15:23 +07:00
parent 05a4b95255
commit 0e2f476cc2
29 changed files with 271 additions and 31 deletions

View File

@ -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 '<p>&nbsp;</p>';
echo '<p>Results: ';
foreach ($types as $type) {
$result = "results/{$sampleFile}.{$type}";
$result = 'results/' . SCRIPT_FILENAME . '.' . $type;
if (file_exists($result)) {
echo "<a href='{$result}' class='btn btn-primary'>{$type}</a> ";
}

View File

@ -5,6 +5,8 @@
error_reporting(E_ALL);
define('CLI', (PHP_SAPI == 'cli') ? true : false);
define('EOL', CLI ? PHP_EOL : '<br />');
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 ? '' : "<h1>{$pageHeading}</h1>";
$pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";
// Populate samples
$files = '';
if ($handle = opendir('.')) {

View File

@ -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)
{

View File

@ -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
*/

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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(

View File

@ -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(

View File

@ -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');

View File

@ -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);

View File

@ -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";

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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(''));

View File

@ -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();

View File

@ -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();

View File

@ -65,6 +65,7 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase
/**
* XSL stylesheet can be applied
*
* @param string $actualDocumentFqfn
* @covers ::applyXslStyleSheet
* @depends testTemplateCanBeSavedInTemporaryLocation
* @test

View File

@ -21,6 +21,8 @@ use PhpOffice\PhpWord\Tests\TestHelperDOCX;
class FooterTest extends \PHPUnit_Framework_TestCase
{
/**
* Write footer
*
* @covers ::writeFooter
*/
public function testWriteFooter()

View File

@ -27,6 +27,9 @@ class FootnotesTest extends \PHPUnit_Framework_TestCase
TestHelperDOCX::clear();
}
/**
* Write footnotes
*/
public function testWriteFootnotes()
{
$phpWord = new PhpWord();

View File

@ -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()
{

View File

@ -1,15 +1,32 @@
<?php
/**
* PHPWord
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
namespace PhpOffice\PhpWord\Tests;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\IOFactory;
/**
* Test helper class
*/
class TestHelperDOCX
{
/** @var string $file */
/**
* Temporary file name
*
* @var string
*/
static protected $file;
/**
* Get document content
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @param string $writerName
* @return \PhpOffice\PhpWord\Tests\XmlDocument
@ -34,6 +51,9 @@ class TestHelperDOCX
return new XmlDocument(sys_get_temp_dir() . '/PhpWord_Unit_Test/');
}
/**
* Clear document
*/
public static function clear()
{
if (\file_exists(self::$file)) {
@ -45,6 +65,8 @@ class TestHelperDOCX
}
/**
* Delete directory
*
* @param string $dir
*/
public static function deleteDir($dir)
@ -63,6 +85,8 @@ class TestHelperDOCX
}
/**
* Get file
*
* @return string
*/
public static function getFile()

View File

@ -1,21 +1,50 @@
<?php
/**
* PHPWord
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
namespace PhpOffice\PhpWord\Tests;
/**
* DOM wrapper class
*/
class XmlDocument
{
/** @var string $path */
/**
* Path
*
* @var string $path
*/
private $path;
/** @var \DOMDocument $dom */
/**
* DOMDocument object
*
* @var \DOMDocument
*/
private $dom;
/** @var \DOMXpath $xpath */
/**
* DOMXpath object
*
* @var \DOMXpath
*/
private $xpath;
/** @var string $file */
/**
* File name
*
* @var string
*/
private $file;
/**
* Create new instance
*
* @param string $path
*/
public function __construct($path)
@ -24,6 +53,8 @@ class XmlDocument
}
/**
* Get DOM from file
*
* @param string $file
* @return \DOMDocument
*/
@ -43,9 +74,11 @@ class XmlDocument
}
/**
* @param string $path
* @param string $file
* @return \DOMNodeList
* Get node list
*
* @param string $path
* @param string $file
* @return \DOMNodeList
*/
public function getNodeList($path, $file = 'word/document.xml')
{
@ -62,9 +95,11 @@ class XmlDocument
}
/**
* @param string $path
* @param string $file
* @return \DOMElement
* Get element
*
* @param string $path
* @param string $file
* @return \DOMElement
*/
public function getElement($path, $file = 'word/document.xml')
{
@ -74,6 +109,8 @@ class XmlDocument
}
/**
* Get file name
*
* @return string
*/
public function getFile()
@ -82,6 +119,8 @@ class XmlDocument
}
/**
* Get path
*
* @return string
*/
public function getPath()
@ -90,6 +129,8 @@ class XmlDocument
}
/**
* Get element attribute
*
* @param string $path
* @param string $attribute
* @param string $file
@ -101,6 +142,8 @@ class XmlDocument
}
/**
* Check if element exists
*
* @param string $path
* @param string $file
* @return string

View File

@ -1,4 +1,12 @@
<?php
/**
* PHPWord test bootstrap
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
date_default_timezone_set('UTC');
// defining base dir for tests
@ -24,7 +32,8 @@ spl_autoload_register(function ($class) {
$prefix = 'PhpOffice\\PhpWord\\Tests';
if (strpos($class, $prefix) === 0) {
$class = str_replace('\\', DIRECTORY_SEPARATOR, $class);
$class = 'PhpWord' . DIRECTORY_SEPARATOR . 'Tests' . DIRECTORY_SEPARATOR . '_includes' . substr($class, strlen($prefix));
$class = join(DIRECTORY_SEPARATOR, array('PhpWord', 'Tests', '_includes')) .
substr($class, strlen($prefix));
$file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php';
if (\file_exists($file)) {
require_once $file;