File tree Expand file tree Collapse file tree 11 files changed +461
-3
lines changed Expand file tree Collapse file tree 11 files changed +461
-3
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ public function getTabPos()
85
85
*/
86
86
public function setTabPos ($ pValue )
87
87
{
88
- $ this ->_tabLeader = $ pValue ;
88
+ $ this ->_tabPos = $ pValue ;
89
89
}
90
90
91
91
/**
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ public function setBgColor($pValue = null)
247
247
/**
248
248
* Set TLRBVH Border Size
249
249
*
250
- * @param int $pValue
250
+ * @param int $pValue Border size in eighths of a point (1/8 point)
251
251
*/
252
252
public function setBorderSize ($ pValue = null )
253
253
{
@@ -466,6 +466,11 @@ public function getCellMarginBottom()
466
466
return $ this ->_cellMarginBottom ;
467
467
}
468
468
469
+ /**
470
+ * Set TLRB cell margin
471
+ *
472
+ * @param int $pValue Margin in twips
473
+ */
469
474
public function setCellMargin ($ pValue = null )
470
475
{
471
476
$ this ->_cellMarginTop = $ pValue ;
Original file line number Diff line number Diff line change 12
12
*/
13
13
class CellTest extends \PHPUnit_Framework_TestCase
14
14
{
15
+
15
16
/**
16
17
* Test setting style with normal value
17
18
*/
@@ -34,7 +35,6 @@ public function testSetGetNormal()
34
35
'gridSpan ' => 2 ,
35
36
'vMerge ' => 2 ,
36
37
);
37
- //'defaultBorderColor' => null,
38
38
foreach ($ attributes as $ key => $ value ) {
39
39
$ set = "set {$ key }" ;
40
40
$ get = "get {$ key }" ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace PHPWord \Tests \Style ;
3
+
4
+ use PHPUnit_Framework_TestCase ;
5
+ use PHPWord_Style_Image ;
6
+
7
+ /**
8
+ * Class ImageTest
9
+ *
10
+ * @package PHPWord\Tests
11
+ * @runTestsInSeparateProcesses
12
+ */
13
+ class ImageTest extends \PHPUnit_Framework_TestCase
14
+ {
15
+
16
+ /**
17
+ * Test setting style with normal value
18
+ */
19
+ public function testSetGetNormal ()
20
+ {
21
+ $ object = new PHPWord_Style_Image ();
22
+
23
+ $ properties = array (
24
+ 'width ' => 200 ,
25
+ 'height ' => 200 ,
26
+ 'align ' => 'left ' ,
27
+ 'marginTop ' => 240 ,
28
+ 'marginLeft ' => 240 ,
29
+ 'wrappingStyle ' => 'inline ' ,
30
+ );
31
+ foreach ($ properties as $ key => $ value ) {
32
+ $ set = "set {$ key }" ;
33
+ $ get = "get {$ key }" ;
34
+ $ object ->$ set ($ value );
35
+ $ this ->assertEquals ($ value , $ object ->$ get ());
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Test setStyleValue method
41
+ */
42
+ public function testSetStyleValue ()
43
+ {
44
+ $ object = new PHPWord_Style_Image ();
45
+
46
+ $ properties = array (
47
+ 'width ' => 200 ,
48
+ 'height ' => 200 ,
49
+ 'align ' => 'left ' ,
50
+ 'marginTop ' => 240 ,
51
+ 'marginLeft ' => 240 ,
52
+ );
53
+ foreach ($ properties as $ key => $ value ) {
54
+ $ get = "get {$ key }" ;
55
+ $ object ->setStyleValue ("_ {$ key }" , $ value );
56
+ $ this ->assertEquals ($ value , $ object ->$ get ());
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Test setWrappingStyle exception
62
+ *
63
+ * @expectedException InvalidArgumentException
64
+ */
65
+ public function testSetWrappingStyleException ()
66
+ {
67
+ $ object = new PHPWord_Style_Image ();
68
+ $ object ->setWrappingStyle ('foo ' );
69
+ }
70
+
71
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace PHPWord \Tests \Style ;
3
+
4
+ use PHPUnit_Framework_TestCase ;
5
+ use PHPWord_Style_ListItem ;
6
+
7
+ /**
8
+ * Class ListItemTest
9
+ *
10
+ * @package PHPWord\Tests
11
+ * @runTestsInSeparateProcesses
12
+ */
13
+ class ListItemTest extends \PHPUnit_Framework_TestCase
14
+ {
15
+
16
+ /**
17
+ * Test construct
18
+ */
19
+ public function testConstruct ()
20
+ {
21
+ $ object = new PHPWord_Style_ListItem ();
22
+
23
+ $ value = PHPWord_Style_ListItem::TYPE_BULLET_FILLED ;
24
+ $ this ->assertEquals ($ value , $ object ->getListType ());
25
+ }
26
+
27
+ /**
28
+ * Test set style value
29
+ */
30
+ public function testSetStyleValue ()
31
+ {
32
+ $ object = new PHPWord_Style_ListItem ();
33
+
34
+ $ value = PHPWord_Style_ListItem::TYPE_ALPHANUM ;
35
+ $ object ->setStyleValue ('_listType ' , $ value );
36
+ $ this ->assertEquals ($ value , $ object ->getListType ());
37
+ }
38
+
39
+ /**
40
+ * Test list type
41
+ */
42
+ public function testListType ()
43
+ {
44
+ $ object = new PHPWord_Style_ListItem ();
45
+
46
+ $ value = PHPWord_Style_ListItem::TYPE_ALPHANUM ;
47
+ $ object ->setListType ($ value );
48
+ $ this ->assertEquals ($ value , $ object ->getListType ());
49
+ }
50
+
51
+ }
Original file line number Diff line number Diff line change @@ -123,4 +123,15 @@ public function testLineHeight()
123
123
$ this ->assertEquals (720 , $ lineHeight );
124
124
$ this ->assertEquals ('auto ' , $ lineRule );
125
125
}
126
+
127
+ /**
128
+ * Test setLineHeight validation
129
+ */
130
+ public function testLineHeightValidation ()
131
+ {
132
+ $ object = new PHPWord_Style_Paragraph ();
133
+ $ object ->setLineHeight ('12.5pt ' );
134
+ $ this ->assertEquals (12.5 , $ object ->getLineHeight ());
135
+ }
136
+
126
137
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace PHPWord \Tests \Style ;
3
+
4
+ use PHPUnit_Framework_TestCase ;
5
+ use PHPWord_Style_Row ;
6
+
7
+ /**
8
+ * Class RowTest
9
+ *
10
+ * @package PHPWord\Tests
11
+ * @runTestsInSeparateProcesses
12
+ */
13
+ class RowTest extends \PHPUnit_Framework_TestCase
14
+ {
15
+
16
+ /**
17
+ * Test properties with normal value
18
+ */
19
+ public function testProperties ()
20
+ {
21
+ $ object = new PHPWord_Style_Row ();
22
+
23
+ $ properties = array (
24
+ 'tblHeader ' => true ,
25
+ 'cantSplit ' => false ,
26
+ );
27
+ foreach ($ properties as $ key => $ value ) {
28
+ // set/get
29
+ $ set = "set {$ key }" ;
30
+ $ get = "get {$ key }" ;
31
+ $ expected = $ value ? 1 : 0 ;
32
+ $ object ->$ set ($ value );
33
+ $ this ->assertEquals ($ expected , $ object ->$ get ());
34
+
35
+ // setStyleValue
36
+ $ value = !$ value ;
37
+ $ expected = $ value ? 1 : 0 ;
38
+ $ object ->setStyleValue ("_ {$ key }" , $ value );
39
+ $ this ->assertEquals ($ expected , $ object ->$ get ());
40
+ }
41
+ }
42
+
43
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace PHPWord \Tests \Style ;
3
+
4
+ use PHPUnit_Framework_TestCase ;
5
+ use PHPWord_Style_TOC ;
6
+
7
+ /**
8
+ * Class TOCTest
9
+ *
10
+ * @package PHPWord\Tests
11
+ * @runTestsInSeparateProcesses
12
+ */
13
+ class TOCTest extends \PHPUnit_Framework_TestCase
14
+ {
15
+
16
+ /**
17
+ * Test properties with normal value
18
+ */
19
+ public function testProperties ()
20
+ {
21
+ $ object = new PHPWord_Style_TOC ();
22
+
23
+ $ properties = array (
24
+ 'tabPos ' => 9062 ,
25
+ 'tabLeader ' => PHPWord_Style_TOC::TABLEADER_DOT ,
26
+ 'indent ' => 200 ,
27
+ );
28
+ foreach ($ properties as $ key => $ value ) {
29
+ // set/get
30
+ $ set = "set {$ key }" ;
31
+ $ get = "get {$ key }" ;
32
+ $ object ->$ set ($ value );
33
+ $ this ->assertEquals ($ value , $ object ->$ get ());
34
+
35
+ // setStyleValue
36
+ $ object ->setStyleValue ("_ {$ key }" , null );
37
+ $ this ->assertEquals (null , $ object ->$ get ());
38
+ }
39
+ }
40
+
41
+ }
You can’t perform that action at this time.
0 commit comments