Skip to content

Commit eeca396

Browse files
author
Roman Syroeshko
committed
[CHANGED] Added annotations to StyleTest and performed minor refactoring.
1 parent f193534 commit eeca396

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

tests/PhpWord/Tests/StyleTest.php

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,61 @@
2222
/**
2323
* Test class for PhpOffice\PhpWord\Style
2424
*
25+
* @coversDefaultClass \PhpOffice\PhpWord\Style
2526
* @runTestsInSeparateProcesses
2627
*/
2728
class StyleTest extends \PHPUnit_Framework_TestCase
2829
{
2930
/**
3031
* Add and get paragraph, font, link, title, and table styles
32+
*
33+
* @covers ::addParagraphStyle
34+
* @covers ::addFontStyle
35+
* @covers ::addLinkStyle
36+
* @covers ::addTitleStyle
37+
* @covers ::addTableStyle
38+
* @covers ::setDefaultParagraphStyle
39+
* @covers ::countStyles
40+
* @covers ::getStyle
41+
* @covers ::resetStyles
42+
* @covers ::getStyles
43+
* @test
3144
*/
3245
public function testStyles()
3346
{
3447
$paragraph = array('align' => 'center');
3548
$font = array('italic' => true, '_bold' => true);
3649
$table = array('bgColor' => 'CCCCCC');
37-
$styles = array('Paragraph' => 'Paragraph', 'Font' => 'Font',
38-
'Link' => 'Font', 'Table' => 'Table',
39-
'Heading_1' => 'Font', 'Normal' => 'Paragraph');
40-
$elementCount = 6;
50+
$styles = array(
51+
'Paragraph' => 'Paragraph',
52+
'Font' => 'Font',
53+
'Link' => 'Font',
54+
'Table' => 'Table',
55+
'Heading_1' => 'Font',
56+
'Normal' => 'Paragraph'
57+
);
4158

4259
Style::addParagraphStyle('Paragraph', $paragraph);
4360
Style::addFontStyle('Font', $font);
4461
Style::addLinkStyle('Link', $font);
45-
Style::addTableStyle('Table', $table);
62+
// @todo Style::addNumberingStyle
4663
Style::addTitleStyle(1, $font);
64+
Style::addTableStyle('Table', $table);
4765
Style::setDefaultParagraphStyle($paragraph);
4866

49-
$this->assertEquals($elementCount, count(Style::getStyles()));
67+
$this->assertEquals(count($styles), Style::countStyles());
5068
foreach ($styles as $name => $style) {
5169
$this->assertInstanceOf("PhpOffice\\PhpWord\\Style\\{$style}", Style::getStyle($name));
5270
}
5371
$this->assertNull(Style::getStyle('Unknown'));
5472

5573
Style::resetStyles();
56-
$this->assertEquals(0, count(Style::getStyles()));
57-
74+
$this->assertCount(0, Style::getStyles());
5875
}
5976

6077
/**
61-
* Set default paragraph style
78+
* @covers ::setDefaultParagraphStyle
79+
* @test
6280
*/
6381
public function testDefaultParagraphStyle()
6482
{

0 commit comments

Comments
 (0)