Add unit tests for refactoring results

This commit is contained in:
Ivan Lanin 2014-04-01 19:05:07 +07:00
parent 07be5eaea3
commit 6f7b97e3ab
5 changed files with 21 additions and 8 deletions

View File

@ -39,14 +39,14 @@ class DocumentProperties
/**
* Created
*
* @var datetime|int
* @var int
*/
private $_created;
/**
* Modified
*
* @var datetime|int
* @var int
*/
private $_modified;
@ -171,7 +171,7 @@ class DocumentProperties
/**
* Get Created
*
* @return datetime
* @return int
*/
public function getCreated()
{
@ -181,7 +181,7 @@ class DocumentProperties
/**
* Set Created
*
* @param datetime $pValue
* @param int $pValue
* @return \PhpOffice\PhpWord\DocumentProperties
*/
public function setCreated($pValue = null)
@ -196,7 +196,7 @@ class DocumentProperties
/**
* Get Modified
*
* @return datetime
* @return int
*/
public function getModified()
{
@ -206,7 +206,7 @@ class DocumentProperties
/**
* Set Modified
*
* @param datetime $pValue
* @param int $pValue
* @return \PhpOffice\PhpWord\DocumentProperties
*/
public function setModified($pValue = null)

View File

@ -202,7 +202,7 @@ class Media
if (!empty(self::$media)) {
foreach (self::$media as $key => $val) {
if (substr($key, 0, 6) == $prefix) {
$mediaCollection[$key] = $val;
$mediaCollection[$key] = $val;
}
}
}

View File

@ -30,5 +30,6 @@ class FootnoteTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(1, $rIdFootnote);
$this->assertEquals(1, $rIdLink);
$this->assertEquals(1, count(Footnote::getFootnoteElements()));
$this->assertEquals(1, count(Footnote::getFootnoteLinkElements()));
}
}

View File

@ -102,6 +102,8 @@ class MediaTest extends \PHPUnit_Framework_TestCase
Media::addHeaderMediaElement(1, $remote, new Image($remote));
$this->assertEquals(2, Media::countHeaderMediaElements('header1'));
$this->assertEquals(2, count(Media::getMediaElements('header1')));
$this->assertFalse(Media::getMediaElements('header2'));
}
/**

View File

@ -19,7 +19,7 @@ use PhpOffice\PhpWord\Settings;
class SettingsTest extends \PHPUnit_Framework_TestCase
{
/**
* Get and set compatibity option
* Get/set compatibity option
*/
public function testGetSetCompatibility()
{
@ -28,4 +28,14 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
$this->assertFalse(Settings::getCompatibility());
$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'));
}
}