Skip to content

Commit 7abd5be

Browse files
committed
Reformatted Tests to PSR-2 coding standards
1 parent 63a535b commit 7abd5be

File tree

15 files changed

+200
-209
lines changed

15 files changed

+200
-209
lines changed

Classes/PHPWord/Style/Font.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
*/
3131
class PHPWord_Style_Font
3232
{
33-
3433
const UNDERLINE_NONE = 'none';
3534
const UNDERLINE_DASH = 'dash';
3635
const UNDERLINE_DASHHEAVY = 'dashHeavy';
@@ -153,8 +152,8 @@ class PHPWord_Style_Font
153152
/**
154153
* New font style
155154
*
156-
* @param string $type Type of font
157-
* @param array $styleParagraph Paragraph styles definition
155+
* @param string $type Type of font
156+
* @param array $styleParagraph Paragraph styles definition
158157
*/
159158
public function __construct($type = 'text', $styleParagraph = null)
160159
{
@@ -187,8 +186,8 @@ public function __construct($type = 'text', $styleParagraph = null)
187186
/**
188187
* Set style value
189188
*
190-
* @param string $key
191-
* @param mixed $value
189+
* @param string $key
190+
* @param mixed $value
192191
*/
193192
public function setStyleValue($key, $value)
194193
{
@@ -211,7 +210,7 @@ public function getName()
211210
/**
212211
* Set font name
213212
*
214-
* @param string $pValue
213+
* @param string $pValue
215214
* @return PHPWord_Style_Font
216215
*/
217216
public function setName($pValue = PHPWord::DEFAULT_FONT_NAME)
@@ -236,7 +235,7 @@ public function getSize()
236235
/**
237236
* Set font size
238237
*
239-
* @param int|float $pValue
238+
* @param int|float $pValue
240239
* @return PHPWord_Style_Font
241240
*/
242241
public function setSize($pValue = PHPWord::DEFAULT_FONT_SIZE)
@@ -261,7 +260,7 @@ public function getBold()
261260
/**
262261
* Set bold
263262
*
264-
* @param bool $pValue
263+
* @param bool $pValue
265264
* @return PHPWord_Style_Font
266265
*/
267266
public function setBold($pValue = false)
@@ -286,7 +285,7 @@ public function getItalic()
286285
/**
287286
* Set italics
288287
*
289-
* @param bool $pValue
288+
* @param bool $pValue
290289
* @return PHPWord_Style_Font
291290
*/
292291
public function setItalic($pValue = false)
@@ -311,7 +310,7 @@ public function getSuperScript()
311310
/**
312311
* Set superscript
313312
*
314-
* @param bool $pValue
313+
* @param bool $pValue
315314
* @return PHPWord_Style_Font
316315
*/
317316
public function setSuperScript($pValue = false)
@@ -337,7 +336,7 @@ public function getSubScript()
337336
/**
338337
* Set subscript
339338
*
340-
* @param bool $pValue
339+
* @param bool $pValue
341340
* @return PHPWord_Style_Font
342341
*/
343342
public function setSubScript($pValue = false)
@@ -363,7 +362,7 @@ public function getUnderline()
363362
/**
364363
* Set underline
365364
*
366-
* @param string $pValue
365+
* @param string $pValue
367366
* @return PHPWord_Style_Font
368367
*/
369368
public function setUnderline($pValue = PHPWord_Style_Font::UNDERLINE_NONE)
@@ -388,7 +387,7 @@ public function getStrikethrough()
388387
/**
389388
* Set strikethrough
390389
*
391-
* @param bool $pValue
390+
* @param bool $pValue
392391
* @return PHPWord_Style_Font
393392
*/
394393
public function setStrikethrough($pValue = false)
@@ -413,7 +412,7 @@ public function getColor()
413412
/**
414413
* Set font color
415414
*
416-
* @param string $pValue
415+
* @param string $pValue
417416
* @return PHPWord_Style_Font
418417
*/
419418
public function setColor($pValue = PHPWord::DEFAULT_FONT_COLOR)
@@ -438,7 +437,7 @@ public function getFgColor()
438437
/**
439438
* Set foreground/highlight color
440439
*
441-
* @param string $pValue
440+
* @param string $pValue
442441
* @return PHPWord_Style_Font
443442
*/
444443
public function setFgColor($pValue = null)

Classes/PHPWord/Style/Paragraph.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public function __construct()
145145
/**
146146
* Set Style value
147147
*
148-
* @param string $key
149-
* @param mixed $value
148+
* @param string $key
149+
* @param mixed $value
150150
*/
151151
public function setStyleValue($key, $value)
152152
{
@@ -335,7 +335,7 @@ public function getBasedOn()
335335
/**
336336
* Set parent style ID
337337
*
338-
* @param string $pValue
338+
* @param string $pValue
339339
* @return PHPWord_Style_Paragraph
340340
*/
341341
public function setBasedOn($pValue = 'Normal')
@@ -357,7 +357,7 @@ public function getNext()
357357
/**
358358
* Set style for next paragraph
359359
*
360-
* @param string $pValue
360+
* @param string $pValue
361361
* @return PHPWord_Style_Paragraph
362362
*/
363363
public function setNext($pValue = null)
@@ -379,7 +379,7 @@ public function getWidowControl()
379379
/**
380380
* Set keep paragraph with next paragraph setting
381381
*
382-
* @param bool $pValue
382+
* @param bool $pValue
383383
* @return PHPWord_Style_Paragraph
384384
*/
385385
public function setWidowControl($pValue = true)
@@ -404,7 +404,7 @@ public function getKeepNext()
404404
/**
405405
* Set keep paragraph with next paragraph setting
406406
*
407-
* @param bool $pValue
407+
* @param bool $pValue
408408
* @return PHPWord_Style_Paragraph
409409
*/
410410
public function setKeepNext($pValue = false)
@@ -429,7 +429,7 @@ public function getKeepLines()
429429
/**
430430
* Set keep all lines on one page setting
431431
*
432-
* @param bool $pValue
432+
* @param bool $pValue
433433
* @return PHPWord_Style_Paragraph
434434
*/
435435
public function setKeepLines($pValue = false)
@@ -454,7 +454,7 @@ public function getPageBreakBefore()
454454
/**
455455
* Set start paragraph on next page setting
456456
*
457-
* @param bool $pValue
457+
* @param bool $pValue
458458
* @return PHPWord_Style_Paragraph
459459
*/
460460
public function setPageBreakBefore($pValue = false)

Tests/PHPWord/IOFactoryTest.php

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,51 @@
1111
* @package PHPWord\Tests
1212
* @runTestsInSeparateProcesses
1313
*/
14-
class PHPWord_IOFactoryTest extends \PHPUnit_Framework_TestCase {
15-
public function testGetSearchLocations()
16-
{
17-
$this->assertAttributeEquals(PHPWord_IOFactory::getSearchLocations(), '_searchLocations','PHPWord_IOFactory');
18-
}
19-
20-
public function testSetSearchLocationsWithArray()
21-
{
22-
PHPWord_IOFactory::setSearchLocations(array());
23-
$this->assertAttributeEquals(array(), '_searchLocations','PHPWord_IOFactory');
24-
}
25-
26-
/**
27-
* @expectedException Exception
28-
* @expectedExceptionMessage Invalid parameter passed.
29-
*/
30-
public function testSetSearchLocationsWithNotArray()
31-
{
32-
PHPWord_IOFactory::setSearchLocations('String');
33-
}
34-
35-
public function testAddSearchLocation()
36-
{
37-
PHPWord_IOFactory::setSearchLocations(array());
38-
PHPWord_IOFactory::addSearchLocation('type', 'location', 'classname');
39-
$this->assertAttributeEquals(array(array('type' => 'type', 'path' => 'location', 'class' => 'classname')), '_searchLocations','PHPWord_IOFactory');
40-
}
41-
42-
/**
43-
* @expectedException Exception
44-
* @expectedExceptionMessage No IWriter found for type
45-
*/
46-
public function testCreateWriterException(){
47-
$oPHPWord = new PHPWord();
48-
49-
PHPWord_IOFactory::setSearchLocations(array());
50-
PHPWord_IOFactory::createWriter($oPHPWord);
51-
}
52-
53-
public function testCreateWriter(){
54-
$oPHPWord = new PHPWord();
55-
56-
$this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord));
57-
}
58-
}
59-
14+
class PHPWord_IOFactoryTest extends \PHPUnit_Framework_TestCase
15+
{
16+
public function testGetSearchLocations()
17+
{
18+
$this->assertAttributeEquals(PHPWord_IOFactory::getSearchLocations(), '_searchLocations', 'PHPWord_IOFactory');
19+
}
20+
21+
public function testSetSearchLocationsWithArray()
22+
{
23+
PHPWord_IOFactory::setSearchLocations(array());
24+
$this->assertAttributeEquals(array(), '_searchLocations', 'PHPWord_IOFactory');
25+
}
26+
27+
/**
28+
* @expectedException Exception
29+
* @expectedExceptionMessage Invalid parameter passed.
30+
*/
31+
public function testSetSearchLocationsWithNotArray()
32+
{
33+
PHPWord_IOFactory::setSearchLocations('String');
34+
}
35+
36+
public function testAddSearchLocation()
37+
{
38+
PHPWord_IOFactory::setSearchLocations(array());
39+
PHPWord_IOFactory::addSearchLocation('type', 'location', 'classname');
40+
$this->assertAttributeEquals(array(array('type' => 'type', 'path' => 'location', 'class' => 'classname')), '_searchLocations', 'PHPWord_IOFactory');
41+
}
42+
43+
/**
44+
* @expectedException Exception
45+
* @expectedExceptionMessage No IWriter found for type
46+
*/
47+
public function testCreateWriterException()
48+
{
49+
$oPHPWord = new PHPWord();
50+
51+
PHPWord_IOFactory::setSearchLocations(array());
52+
PHPWord_IOFactory::createWriter($oPHPWord);
53+
}
54+
55+
public function testCreateWriter()
56+
{
57+
$oPHPWord = new PHPWord();
58+
59+
$this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord));
60+
}
61+
}

Tests/PHPWord/MediaTest.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,25 @@
44
use PHPUnit_Framework_TestCase;
55
use PHPWord_Media;
66

7-
class PHPWord_MediaTest extends \PHPUnit_Framework_TestCase {
7+
class PHPWord_MediaTest extends \PHPUnit_Framework_TestCase
8+
{
9+
public function testGetSectionMediaElementsWithNull()
10+
{
11+
$this->assertEquals(PHPWord_Media::getSectionMediaElements(), array());
12+
}
813

9-
public function testGetSectionMediaElementsWithNull()
10-
{
11-
$this->assertEquals(PHPWord_Media::getSectionMediaElements(), array());
12-
}
14+
public function testCountSectionMediaElementsWithNull()
15+
{
16+
$this->assertEquals(PHPWord_Media::countSectionMediaElements(), 0);
17+
}
1318

14-
public function testCountSectionMediaElementsWithNull()
15-
{
16-
$this->assertEquals(PHPWord_Media::countSectionMediaElements(), 0);
17-
}
19+
public function testGetHeaderMediaElements()
20+
{
21+
$this->assertAttributeEquals(PHPWord_Media::getHeaderMediaElements(), '_headerMedia', 'PHPWord_Media');
22+
}
1823

19-
public function testGetHeaderMediaElements()
20-
{
21-
$this->assertAttributeEquals(PHPWord_Media::getHeaderMediaElements(), '_headerMedia','PHPWord_Media');
22-
}
23-
24-
public function testGetFooterMediaElements()
25-
{
26-
$this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia','PHPWord_Media');
27-
}
28-
}
29-
24+
public function testGetFooterMediaElements()
25+
{
26+
$this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia', 'PHPWord_Media');
27+
}
28+
}

Tests/PHPWord/SectionTest.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,35 @@
44
use PHPUnit_Framework_TestCase;
55
use PHPWord_Section;
66

7-
class PHPWord_SectionTest extends \PHPUnit_Framework_TestCase {
8-
public function testGetSettings()
9-
{
10-
$oSection = new PHPWord_Section(0);
11-
$this->assertAttributeEquals($oSection->getSettings(), '_settings', new PHPWord_Section(0));
12-
}
7+
class PHPWord_SectionTest extends \PHPUnit_Framework_TestCase
8+
{
9+
public function testGetSettings()
10+
{
11+
$oSection = new PHPWord_Section(0);
12+
$this->assertAttributeEquals($oSection->getSettings(), '_settings', new PHPWord_Section(0));
13+
}
1314

14-
public function testGetElementss()
15-
{
16-
$oSection = new PHPWord_Section(0);
17-
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection',new PHPWord_Section(0));
18-
}
15+
public function testGetElementss()
16+
{
17+
$oSection = new PHPWord_Section(0);
18+
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection', new PHPWord_Section(0));
19+
}
1920

20-
public function testGetFooter()
21-
{
22-
$oSection = new PHPWord_Section(0);
23-
$this->assertAttributeEquals($oSection->getFooter(), '_footer',new PHPWord_Section(0));
24-
}
21+
public function testGetFooter()
22+
{
23+
$oSection = new PHPWord_Section(0);
24+
$this->assertAttributeEquals($oSection->getFooter(), '_footer', new PHPWord_Section(0));
25+
}
2526

26-
public function testGetHeaders()
27-
{
28-
$oSection = new PHPWord_Section(0);
29-
$this->assertAttributeEquals($oSection->getHeaders(), '_headers',new PHPWord_Section(0));
30-
}
27+
public function testGetHeaders()
28+
{
29+
$oSection = new PHPWord_Section(0);
30+
$this->assertAttributeEquals($oSection->getHeaders(), '_headers', new PHPWord_Section(0));
31+
}
3132

32-
public function testGetElements()
33-
{
34-
$oSection = new PHPWord_Section(0);
35-
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection',new PHPWord_Section(0));
36-
}
37-
}
38-
33+
public function testGetElements()
34+
{
35+
$oSection = new PHPWord_Section(0);
36+
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection', new PHPWord_Section(0));
37+
}
38+
}

0 commit comments

Comments
 (0)