Add unit tests for refactoring results
This commit is contained in:
parent
07be5eaea3
commit
6f7b97e3ab
|
|
@ -39,14 +39,14 @@ class DocumentProperties
|
||||||
/**
|
/**
|
||||||
* Created
|
* Created
|
||||||
*
|
*
|
||||||
* @var datetime|int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_created;
|
private $_created;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modified
|
* Modified
|
||||||
*
|
*
|
||||||
* @var datetime|int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_modified;
|
private $_modified;
|
||||||
|
|
||||||
|
|
@ -171,7 +171,7 @@ class DocumentProperties
|
||||||
/**
|
/**
|
||||||
* Get Created
|
* Get Created
|
||||||
*
|
*
|
||||||
* @return datetime
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getCreated()
|
public function getCreated()
|
||||||
{
|
{
|
||||||
|
|
@ -181,7 +181,7 @@ class DocumentProperties
|
||||||
/**
|
/**
|
||||||
* Set Created
|
* Set Created
|
||||||
*
|
*
|
||||||
* @param datetime $pValue
|
* @param int $pValue
|
||||||
* @return \PhpOffice\PhpWord\DocumentProperties
|
* @return \PhpOffice\PhpWord\DocumentProperties
|
||||||
*/
|
*/
|
||||||
public function setCreated($pValue = null)
|
public function setCreated($pValue = null)
|
||||||
|
|
@ -196,7 +196,7 @@ class DocumentProperties
|
||||||
/**
|
/**
|
||||||
* Get Modified
|
* Get Modified
|
||||||
*
|
*
|
||||||
* @return datetime
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getModified()
|
public function getModified()
|
||||||
{
|
{
|
||||||
|
|
@ -206,7 +206,7 @@ class DocumentProperties
|
||||||
/**
|
/**
|
||||||
* Set Modified
|
* Set Modified
|
||||||
*
|
*
|
||||||
* @param datetime $pValue
|
* @param int $pValue
|
||||||
* @return \PhpOffice\PhpWord\DocumentProperties
|
* @return \PhpOffice\PhpWord\DocumentProperties
|
||||||
*/
|
*/
|
||||||
public function setModified($pValue = null)
|
public function setModified($pValue = null)
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ class Media
|
||||||
if (!empty(self::$media)) {
|
if (!empty(self::$media)) {
|
||||||
foreach (self::$media as $key => $val) {
|
foreach (self::$media as $key => $val) {
|
||||||
if (substr($key, 0, 6) == $prefix) {
|
if (substr($key, 0, 6) == $prefix) {
|
||||||
$mediaCollection[$key] = $val;
|
$mediaCollection[$key] = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,5 +30,6 @@ class FootnoteTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals(1, $rIdFootnote);
|
$this->assertEquals(1, $rIdFootnote);
|
||||||
$this->assertEquals(1, $rIdLink);
|
$this->assertEquals(1, $rIdLink);
|
||||||
$this->assertEquals(1, count(Footnote::getFootnoteElements()));
|
$this->assertEquals(1, count(Footnote::getFootnoteElements()));
|
||||||
|
$this->assertEquals(1, count(Footnote::getFootnoteLinkElements()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,8 @@ class MediaTest extends \PHPUnit_Framework_TestCase
|
||||||
Media::addHeaderMediaElement(1, $remote, new Image($remote));
|
Media::addHeaderMediaElement(1, $remote, new Image($remote));
|
||||||
|
|
||||||
$this->assertEquals(2, Media::countHeaderMediaElements('header1'));
|
$this->assertEquals(2, Media::countHeaderMediaElements('header1'));
|
||||||
|
$this->assertEquals(2, count(Media::getMediaElements('header1')));
|
||||||
|
$this->assertFalse(Media::getMediaElements('header2'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use PhpOffice\PhpWord\Settings;
|
||||||
class SettingsTest extends \PHPUnit_Framework_TestCase
|
class SettingsTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get and set compatibity option
|
* Get/set compatibity option
|
||||||
*/
|
*/
|
||||||
public function testGetSetCompatibility()
|
public function testGetSetCompatibility()
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,14 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertFalse(Settings::getCompatibility());
|
$this->assertFalse(Settings::getCompatibility());
|
||||||
$this->assertFalse(Settings::setCompatibility('Non boolean'));
|
$this->assertFalse(Settings::setCompatibility('Non boolean'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get/set zip class
|
||||||
|
*/
|
||||||
|
public function testGetSetZipClass()
|
||||||
|
{
|
||||||
|
$this->assertEquals(Settings::ZIPARCHIVE, Settings::getZipClass());
|
||||||
|
$this->assertTrue(Settings::setZipClass(Settings::PCLZIP));
|
||||||
|
$this->assertFalse(Settings::setZipClass('foo'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue