Reformatted Tests to PSR-2 coding standards

This commit is contained in:
Gabriel Bull 2014-03-02 14:40:58 -05:00
parent 63a535bf1a
commit 7abd5be62b
15 changed files with 184 additions and 193 deletions

View File

@ -30,7 +30,6 @@
*/
class PHPWord_Style_Font
{
const UNDERLINE_NONE = 'none';
const UNDERLINE_DASH = 'dash';
const UNDERLINE_DASHHEAVY = 'dashHeavy';

View File

@ -11,16 +11,17 @@ use PHPWord_Writer_Word2007;
* @package PHPWord\Tests
* @runTestsInSeparateProcesses
*/
class PHPWord_IOFactoryTest extends \PHPUnit_Framework_TestCase {
class PHPWord_IOFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testGetSearchLocations()
{
$this->assertAttributeEquals(PHPWord_IOFactory::getSearchLocations(), '_searchLocations','PHPWord_IOFactory');
$this->assertAttributeEquals(PHPWord_IOFactory::getSearchLocations(), '_searchLocations', 'PHPWord_IOFactory');
}
public function testSetSearchLocationsWithArray()
{
PHPWord_IOFactory::setSearchLocations(array());
$this->assertAttributeEquals(array(), '_searchLocations','PHPWord_IOFactory');
$this->assertAttributeEquals(array(), '_searchLocations', 'PHPWord_IOFactory');
}
/**
@ -36,24 +37,25 @@ class PHPWord_IOFactoryTest extends \PHPUnit_Framework_TestCase {
{
PHPWord_IOFactory::setSearchLocations(array());
PHPWord_IOFactory::addSearchLocation('type', 'location', 'classname');
$this->assertAttributeEquals(array(array('type' => 'type', 'path' => 'location', 'class' => 'classname')), '_searchLocations','PHPWord_IOFactory');
$this->assertAttributeEquals(array(array('type' => 'type', 'path' => 'location', 'class' => 'classname')), '_searchLocations', 'PHPWord_IOFactory');
}
/**
* @expectedException Exception
* @expectedExceptionMessage No IWriter found for type
*/
public function testCreateWriterException(){
public function testCreateWriterException()
{
$oPHPWord = new PHPWord();
PHPWord_IOFactory::setSearchLocations(array());
PHPWord_IOFactory::createWriter($oPHPWord);
}
public function testCreateWriter(){
public function testCreateWriter()
{
$oPHPWord = new PHPWord();
$this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord));
}
}

View File

@ -4,8 +4,8 @@ namespace PHPWord\Tests;
use PHPUnit_Framework_TestCase;
use PHPWord_Media;
class PHPWord_MediaTest extends \PHPUnit_Framework_TestCase {
class PHPWord_MediaTest extends \PHPUnit_Framework_TestCase
{
public function testGetSectionMediaElementsWithNull()
{
$this->assertEquals(PHPWord_Media::getSectionMediaElements(), array());
@ -18,12 +18,11 @@ class PHPWord_MediaTest extends \PHPUnit_Framework_TestCase {
public function testGetHeaderMediaElements()
{
$this->assertAttributeEquals(PHPWord_Media::getHeaderMediaElements(), '_headerMedia','PHPWord_Media');
$this->assertAttributeEquals(PHPWord_Media::getHeaderMediaElements(), '_headerMedia', 'PHPWord_Media');
}
public function testGetFooterMediaElements()
{
$this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia','PHPWord_Media');
$this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia', 'PHPWord_Media');
}
}

View File

@ -4,7 +4,8 @@ namespace PHPWord\Tests;
use PHPUnit_Framework_TestCase;
use PHPWord_Section;
class PHPWord_SectionTest extends \PHPUnit_Framework_TestCase {
class PHPWord_SectionTest extends \PHPUnit_Framework_TestCase
{
public function testGetSettings()
{
$oSection = new PHPWord_Section(0);
@ -14,25 +15,24 @@ class PHPWord_SectionTest extends \PHPUnit_Framework_TestCase {
public function testGetElementss()
{
$oSection = new PHPWord_Section(0);
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection',new PHPWord_Section(0));
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection', new PHPWord_Section(0));
}
public function testGetFooter()
{
$oSection = new PHPWord_Section(0);
$this->assertAttributeEquals($oSection->getFooter(), '_footer',new PHPWord_Section(0));
$this->assertAttributeEquals($oSection->getFooter(), '_footer', new PHPWord_Section(0));
}
public function testGetHeaders()
{
$oSection = new PHPWord_Section(0);
$this->assertAttributeEquals($oSection->getHeaders(), '_headers',new PHPWord_Section(0));
$this->assertAttributeEquals($oSection->getHeaders(), '_headers', new PHPWord_Section(0));
}
public function testGetElements()
{
$oSection = new PHPWord_Section(0);
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection',new PHPWord_Section(0));
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection', new PHPWord_Section(0));
}
}

View File

@ -13,7 +13,6 @@ use PHPWord_Shared_Font;
*/
class PHPWord_Writer_Shared_FontTest extends \PHPUnit_Framework_TestCase
{
/**
* Test various conversions
*/
@ -44,5 +43,4 @@ class PHPWord_Writer_Shared_FontTest extends \PHPUnit_Framework_TestCase
$result = PHPWord_Shared_Font::pointSizeToTwips($original);
$this->assertEquals($original * 20, $result);
}
}

View File

@ -12,7 +12,6 @@ use PHPWord_Style_Cell;
*/
class PHPWord_Style_CellTest extends \PHPUnit_Framework_TestCase
{
/**
* Test setting style with normal value
*/
@ -76,5 +75,4 @@ class PHPWord_Style_CellTest extends \PHPUnit_Framework_TestCase
$object->setStyleValue('_borderSize', $value);
$this->assertEquals($expected, $object->getBorderSize());
}
}

View File

@ -13,7 +13,6 @@ use PHPWord_Style_Font;
*/
class PHPWord_Style_FontTest extends \PHPUnit_Framework_TestCase
{
/**
* Test initiation for style type and paragraph style
*/
@ -78,5 +77,4 @@ class PHPWord_Style_FontTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($value, $object->$get());
}
}
}

View File

@ -13,7 +13,6 @@ use PHPWord_Style_Tab;
*/
class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase
{
/**
* Test setting style values with null or empty value
*/
@ -86,5 +85,4 @@ class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase
));
$this->assertInstanceOf('PHPWord_Style_Tabs', $object->getTabs());
}
}

View File

@ -11,7 +11,8 @@ use PHPWord_Writer_Word2007_Base;
* @package PHPWord\Tests
* @runTestsInSeparateProcesses
*/
class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase {
class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase
{
/**
* Executed before each method of the class
*/
@ -108,5 +109,4 @@ class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($expected, $element->getAttribute('w:val'));
}
}
}

View File

@ -11,7 +11,8 @@ use PHPWord_Writer_Word2007_Document;
* @package PHPWord\Tests
* @runTestsInSeparateProcesses
*/
class PHPWord_Writer_Word2007_DocumentTest extends \PHPUnit_Framework_TestCase {
class PHPWord_Writer_Word2007_DocumentTest extends \PHPUnit_Framework_TestCase
{
/**
* Executed before each method of the class
*/
@ -32,4 +33,3 @@ class PHPWord_Writer_Word2007_DocumentTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(2, $element->getAttribute('w:start'));
}
}

View File

@ -51,5 +51,4 @@ class PHPWord_Writer_Word2007_StylesTest extends \PHPUnit_Framework_TestCase
$element = $doc->getElement($path, $file);
$this->assertEquals('Normal', $element->getAttribute('w:val'));
}
}

View File

@ -25,7 +25,7 @@ class TestHelperDOCX
$zip = new \ZipArchive;
$res = $zip->open(self::$file);
if ($res === true) {
$zip->extractTo(sys_get_temp_dir().'/PHPWord_Unit_Test/');
$zip->extractTo(sys_get_temp_dir() . '/PHPWord_Unit_Test/');
$zip->close();
}

View File

@ -3,7 +3,7 @@
date_default_timezone_set('UTC');
// Constantes
if(!defined('PHPWORD_TESTS_DIR_ROOT')){
if (!defined('PHPWORD_TESTS_DIR_ROOT')) {
define('PHPWORD_TESTS_DIR_ROOT', __DIR__);
}