|
22 | 22 | /**
|
23 | 23 | * Test class for PhpOffice\PhpWord\Style
|
24 | 24 | *
|
| 25 | + * @coversDefaultClass \PhpOffice\PhpWord\Style |
25 | 26 | * @runTestsInSeparateProcesses
|
26 | 27 | */
|
27 | 28 | class StyleTest extends \PHPUnit_Framework_TestCase
|
28 | 29 | {
|
29 | 30 | /**
|
30 | 31 | * 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 |
31 | 44 | */
|
32 | 45 | public function testStyles()
|
33 | 46 | {
|
34 | 47 | $paragraph = array('align' => 'center');
|
35 | 48 | $font = array('italic' => true, '_bold' => true);
|
36 | 49 | $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 | + ); |
41 | 58 |
|
42 | 59 | Style::addParagraphStyle('Paragraph', $paragraph);
|
43 | 60 | Style::addFontStyle('Font', $font);
|
44 | 61 | Style::addLinkStyle('Link', $font);
|
45 |
| - Style::addTableStyle('Table', $table); |
| 62 | + // @todo Style::addNumberingStyle |
46 | 63 | Style::addTitleStyle(1, $font);
|
| 64 | + Style::addTableStyle('Table', $table); |
47 | 65 | Style::setDefaultParagraphStyle($paragraph);
|
48 | 66 |
|
49 |
| - $this->assertEquals($elementCount, count(Style::getStyles())); |
| 67 | + $this->assertEquals(count($styles), Style::countStyles()); |
50 | 68 | foreach ($styles as $name => $style) {
|
51 | 69 | $this->assertInstanceOf("PhpOffice\\PhpWord\\Style\\{$style}", Style::getStyle($name));
|
52 | 70 | }
|
53 | 71 | $this->assertNull(Style::getStyle('Unknown'));
|
54 | 72 |
|
55 | 73 | Style::resetStyles();
|
56 |
| - $this->assertEquals(0, count(Style::getStyles())); |
57 |
| - |
| 74 | + $this->assertCount(0, Style::getStyles()); |
58 | 75 | }
|
59 | 76 |
|
60 | 77 | /**
|
61 |
| - * Set default paragraph style |
| 78 | + * @covers ::setDefaultParagraphStyle |
| 79 | + * @test |
62 | 80 | */
|
63 | 81 | public function testDefaultParagraphStyle()
|
64 | 82 | {
|
|
0 commit comments