Additional unit tests and @since documentation
This commit is contained in:
parent
3569271277
commit
d764de018c
|
|
@ -22,6 +22,7 @@ use PhpOffice\PhpWord\Exception\Exception;
|
||||||
/**
|
/**
|
||||||
* Reader abstract class
|
* Reader abstract class
|
||||||
*
|
*
|
||||||
|
* @since 0.8.0
|
||||||
* @codeCoverageIgnore Abstract class
|
* @codeCoverageIgnore Abstract class
|
||||||
*/
|
*/
|
||||||
abstract class AbstractReader implements ReaderInterface
|
abstract class AbstractReader implements ReaderInterface
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract part reader
|
* Abstract part reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
|
* @codeCoverageIgnore Nothing in here yet
|
||||||
*/
|
*/
|
||||||
abstract class AbstractPart extends Word2007AbstractPart
|
abstract class AbstractPart extends Word2007AbstractPart
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ namespace PhpOffice\PhpWord\Reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reader interface
|
* Reader interface
|
||||||
|
*
|
||||||
|
* @since 0.8.0
|
||||||
*/
|
*/
|
||||||
interface ReaderInterface
|
interface ReaderInterface
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
* Abstract part reader
|
* Abstract part reader
|
||||||
*
|
*
|
||||||
* This class is inherited by ODText reader
|
* This class is inherited by ODText reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
abstract class AbstractPart
|
abstract class AbstractPart
|
||||||
{
|
{
|
||||||
|
|
@ -466,6 +468,7 @@ abstract class AbstractPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var array $styles Type hint */
|
||||||
return $styles;
|
return $styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended properties reader
|
* Extended properties reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
class DocPropsApp extends DocPropsCore
|
class DocPropsApp extends DocPropsCore
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core properties reader
|
* Core properties reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
class DocPropsCore extends AbstractPart
|
class DocPropsCore extends AbstractPart
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom properties reader
|
* Custom properties reader
|
||||||
|
*
|
||||||
|
* @since 0.11.0
|
||||||
*/
|
*/
|
||||||
class DocPropsCustom extends AbstractPart
|
class DocPropsCustom extends AbstractPart
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document reader
|
* Document reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
class Document extends AbstractPart
|
class Document extends AbstractPart
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Endnotes reader
|
* Endnotes reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
class Endnotes extends Footnotes
|
class Endnotes extends Footnotes
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Footnotes reader
|
* Footnotes reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
class Footnotes extends AbstractPart
|
class Footnotes extends AbstractPart
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Numbering reader
|
* Numbering reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
class Numbering extends AbstractPart
|
class Numbering extends AbstractPart
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ use PhpOffice\PhpWord\Shared\XMLReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Styles reader
|
* Styles reader
|
||||||
|
*
|
||||||
|
* @since 0.10.0
|
||||||
*/
|
*/
|
||||||
class Styles extends AbstractPart
|
class Styles extends AbstractPart
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,17 @@ class ListItemRunTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals($oListItemRun->getParagraphStyle(), 'pStyle');
|
$this->assertEquals($oListItemRun->getParagraphStyle(), 'pStyle');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New instance with string
|
||||||
|
*/
|
||||||
|
public function testConstructListString()
|
||||||
|
{
|
||||||
|
$oListItemRun = new ListItemRun(0, 'numberingStyle');
|
||||||
|
|
||||||
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\ListItemRun', $oListItemRun);
|
||||||
|
$this->assertCount(0, $oListItemRun->getElements());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New instance with array
|
* New instance with array
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,14 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
|
||||||
'defaultFontName' => 'Arial',
|
'defaultFontName' => 'Arial',
|
||||||
'defaultFontSize' => 10,
|
'defaultFontSize' => 10,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Test default value
|
||||||
|
$this->assertEquals($expected, Settings::loadConfig());
|
||||||
|
|
||||||
|
// Test with valid file
|
||||||
$this->assertEquals($expected, Settings::loadConfig(__DIR__ . '/../../../phpword.ini.dist'));
|
$this->assertEquals($expected, Settings::loadConfig(__DIR__ . '/../../../phpword.ini.dist'));
|
||||||
|
|
||||||
|
// Test with invalid file
|
||||||
|
$this->assertEmpty(Settings::loadConfig(__DIR__ . '/files/xsl/passthrough.xsl'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,4 +54,14 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals('', String::controlCharacterPHP2OOXML(''));
|
$this->assertEquals('', String::controlCharacterPHP2OOXML(''));
|
||||||
$this->assertEquals('_x0008_', String::controlCharacterPHP2OOXML(chr(0x08)));
|
$this->assertEquals('_x0008_', String::controlCharacterPHP2OOXML(chr(0x08)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test unicode conversion
|
||||||
|
*/
|
||||||
|
public function testToUnicode()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a', String::toUnicode('a'));
|
||||||
|
$this->assertEquals('\uc0{\u8364}', String::toUnicode('€'));
|
||||||
|
$this->assertEquals('\uc0{\u233}', String::toUnicode('é'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue