1
1
<?php
2
- namespace PHPWord \Tests ;
2
+ namespace PHPWord \Tests \ Section ;
3
3
4
4
use PHPUnit_Framework_TestCase ;
5
5
use PHPWord_Section_Footer ;
6
6
7
- class PHPWord_Section_FooterTest extends \PHPUnit_Framework_TestCase {
8
-
9
- public function testConstruct (){
10
- $ iVal = rand (1 , 1000 );
11
- $ oFooter = new PHPWord_Section_Footer ($ iVal );
12
-
13
- $ this ->assertInstanceOf ('PHPWord_Section_Footer ' , $ oFooter );
14
- $ this ->assertEquals ($ oFooter ->getFooterCount (), $ iVal );
15
- }
16
-
17
- public function testRelationID (){
18
- $ oFooter = new PHPWord_Section_Footer (0 );
19
-
20
- $ iVal = rand (1 , 1000 );
21
- $ oFooter ->setRelationId ($ iVal );
22
- $ this ->assertEquals ($ oFooter ->getRelationId (), $ iVal );
23
- }
24
-
25
- public function testAddText (){
26
- $ oFooter = new PHPWord_Section_Footer (1 );
27
- $ element = $ oFooter ->addText ('text ' );
28
-
29
- $ this ->assertCount (1 , $ oFooter ->getElements ());
30
- $ this ->assertInstanceOf ('PHPWord_Section_Text ' , $ element );
31
-
32
- }
33
-
34
- public function testAddTextNotUTF8 (){
35
- $ oFooter = new PHPWord_Section_Footer (1 );
36
- $ element = $ oFooter ->addText (utf8_decode ('ééé ' ));
37
-
38
- $ this ->assertCount (1 , $ oFooter ->getElements ());
39
- $ this ->assertInstanceOf ('PHPWord_Section_Text ' , $ element );
40
- $ this ->assertEquals ($ element ->getText (), 'ééé ' );
41
- }
42
-
43
- public function testAddTextBreak (){
44
- $ oFooter = new PHPWord_Section_Footer (1 );
45
- $ iVal = rand (1 , 1000 );
46
- $ oFooter ->addTextBreak ($ iVal );
47
-
48
- $ this ->assertCount ($ iVal , $ oFooter ->getElements ());
49
- }
50
-
51
- public function testCreateTextRun (){
52
- $ oFooter = new PHPWord_Section_Footer (1 );
53
- $ element = $ oFooter ->createTextRun ();
54
-
55
- $ this ->assertCount (1 , $ oFooter ->getElements ());
56
- $ this ->assertInstanceOf ('PHPWord_Section_TextRun ' , $ element );
57
- }
58
-
59
- public function testAddTable (){
60
- $ oFooter = new PHPWord_Section_Footer (1 );
61
- $ element = $ oFooter ->addTable ();
62
-
63
- $ this ->assertCount (1 , $ oFooter ->getElements ());
64
- $ this ->assertInstanceOf ('PHPWord_Section_Table ' , $ element );
65
- }
66
-
67
- public function testAddImage (){
68
- $ src = \join (
69
- \DIRECTORY_SEPARATOR ,
70
- array (\PHPWORD_TESTS_DIR_ROOT , '_files ' , 'images ' , 'earth.jpg ' )
71
- );
72
- $ oFooter = new PHPWord_Section_Footer (1 );
73
- $ element = $ oFooter ->addImage ($ src );
74
-
75
- $ this ->assertCount (1 , $ oFooter ->getElements ());
76
- $ this ->assertInstanceOf ('PHPWord_Section_Image ' , $ element );
77
- }
78
-
79
- public function testAddMemoryImage (){
80
- $ oFooter = new PHPWord_Section_Footer (1 );
81
- $ element = $ oFooter ->addMemoryImage ('https://assets.mozillalabs.com/Brands-Logos/Thunderbird/logo-only/thunderbird_logo-only_RGB.png ' );
82
-
83
- $ this ->assertCount (1 , $ oFooter ->getElements ());
84
- $ this ->assertInstanceOf ('PHPWord_Section_MemoryImage ' , $ element );
85
- }
86
-
87
- public function testAddPreserveText (){
88
- $ oFooter = new PHPWord_Section_Footer (1 );
89
- $ element = $ oFooter ->addPreserveText ('text ' );
90
-
91
- $ this ->assertCount (1 , $ oFooter ->getElements ());
92
- $ this ->assertInstanceOf ('PHPWord_Section_Footer_PreserveText ' , $ element );
93
- }
94
-
95
- public function testAddPreserveTextNotUTF8 (){
96
- $ oFooter = new PHPWord_Section_Footer (1 );
97
- $ element = $ oFooter ->addPreserveText (utf8_decode ('ééé ' ));
98
-
99
- $ this ->assertCount (1 , $ oFooter ->getElements ());
100
- $ this ->assertInstanceOf ('PHPWord_Section_Footer_PreserveText ' , $ element );
101
- $ this ->assertEquals ($ element ->getText (), 'ééé ' );
102
- }
103
-
104
- public function testGetElements (){
105
- $ oFooter = new PHPWord_Section_Footer (1 );
106
-
107
- $ this ->assertInternalType ('array ' , $ oFooter ->getElements ());
108
- }
109
- }
110
-
7
+ class FooterTest extends \PHPUnit_Framework_TestCase
8
+ {
9
+ public function testConstruct ()
10
+ {
11
+ $ iVal = rand (1 , 1000 );
12
+ $ oFooter = new PHPWord_Section_Footer ($ iVal );
13
+
14
+ $ this ->assertInstanceOf ('PHPWord_Section_Footer ' , $ oFooter );
15
+ $ this ->assertEquals ($ oFooter ->getFooterCount (), $ iVal );
16
+ }
17
+
18
+ public function testRelationID ()
19
+ {
20
+ $ oFooter = new PHPWord_Section_Footer (0 );
21
+
22
+ $ iVal = rand (1 , 1000 );
23
+ $ oFooter ->setRelationId ($ iVal );
24
+ $ this ->assertEquals ($ oFooter ->getRelationId (), $ iVal );
25
+ }
26
+
27
+ public function testAddText ()
28
+ {
29
+ $ oFooter = new PHPWord_Section_Footer (1 );
30
+ $ element = $ oFooter ->addText ('text ' );
31
+
32
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
33
+ $ this ->assertInstanceOf ('PHPWord_Section_Text ' , $ element );
34
+
35
+ }
36
+
37
+ public function testAddTextNotUTF8 ()
38
+ {
39
+ $ oFooter = new PHPWord_Section_Footer (1 );
40
+ $ element = $ oFooter ->addText (utf8_decode ('ééé ' ));
41
+
42
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
43
+ $ this ->assertInstanceOf ('PHPWord_Section_Text ' , $ element );
44
+ $ this ->assertEquals ($ element ->getText (), 'ééé ' );
45
+ }
46
+
47
+ public function testAddTextBreak ()
48
+ {
49
+ $ oFooter = new PHPWord_Section_Footer (1 );
50
+ $ iVal = rand (1 , 1000 );
51
+ $ oFooter ->addTextBreak ($ iVal );
52
+
53
+ $ this ->assertCount ($ iVal , $ oFooter ->getElements ());
54
+ }
55
+
56
+ public function testCreateTextRun ()
57
+ {
58
+ $ oFooter = new PHPWord_Section_Footer (1 );
59
+ $ element = $ oFooter ->createTextRun ();
60
+
61
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
62
+ $ this ->assertInstanceOf ('PHPWord_Section_TextRun ' , $ element );
63
+ }
64
+
65
+ public function testAddTable ()
66
+ {
67
+ $ oFooter = new PHPWord_Section_Footer (1 );
68
+ $ element = $ oFooter ->addTable ();
69
+
70
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
71
+ $ this ->assertInstanceOf ('PHPWord_Section_Table ' , $ element );
72
+ }
73
+
74
+ public function testAddImage ()
75
+ {
76
+ $ src = \join (
77
+ \DIRECTORY_SEPARATOR ,
78
+ array (\PHPWORD_TESTS_DIR_ROOT , '_files ' , 'images ' , 'earth.jpg ' )
79
+ );
80
+ $ oFooter = new PHPWord_Section_Footer (1 );
81
+ $ element = $ oFooter ->addImage ($ src );
82
+
83
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
84
+ $ this ->assertInstanceOf ('PHPWord_Section_Image ' , $ element );
85
+ }
86
+
87
+ public function testAddMemoryImage ()
88
+ {
89
+ $ oFooter = new PHPWord_Section_Footer (1 );
90
+ $ element = $ oFooter ->addMemoryImage ('https://assets.mozillalabs.com/Brands-Logos/Thunderbird/logo-only/thunderbird_logo-only_RGB.png ' );
91
+
92
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
93
+ $ this ->assertInstanceOf ('PHPWord_Section_MemoryImage ' , $ element );
94
+ }
95
+
96
+ public function testAddPreserveText ()
97
+ {
98
+ $ oFooter = new PHPWord_Section_Footer (1 );
99
+ $ element = $ oFooter ->addPreserveText ('text ' );
100
+
101
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
102
+ $ this ->assertInstanceOf ('PHPWord_Section_Footer_PreserveText ' , $ element );
103
+ }
104
+
105
+ public function testAddPreserveTextNotUTF8 ()
106
+ {
107
+ $ oFooter = new PHPWord_Section_Footer (1 );
108
+ $ element = $ oFooter ->addPreserveText (utf8_decode ('ééé ' ));
109
+
110
+ $ this ->assertCount (1 , $ oFooter ->getElements ());
111
+ $ this ->assertInstanceOf ('PHPWord_Section_Footer_PreserveText ' , $ element );
112
+ $ this ->assertEquals ($ element ->getText (), 'ééé ' );
113
+ }
114
+
115
+ public function testGetElements ()
116
+ {
117
+ $ oFooter = new PHPWord_Section_Footer (1 );
118
+
119
+ $ this ->assertInternalType ('array ' , $ oFooter ->getElements ());
120
+ }
121
+ }
0 commit comments