4
4
use PHPUnit_Framework_TestCase ;
5
5
use PHPWord ;
6
6
use PHPWord_Writer_Word2007 ;
7
- use PHPWord_Writer_Word2007_Base ;
7
+ use PHPWord_Writer_Word2007_Document ;
8
8
9
9
/**
10
- * Class PHPWord_Writer_Word2007_BaseTest
10
+ * Class PHPWord_Writer_Word2007_DocumentTest
11
11
* @package PHPWord\Tests
12
12
* @runTestsInSeparateProcesses
13
13
*/
14
- class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase {
14
+ class PHPWord_Writer_Word2007_DocumentTest extends \PHPUnit_Framework_TestCase {
15
15
/**
16
16
* Executed before each method of the class
17
17
*/
@@ -20,63 +20,16 @@ public function tearDown()
20
20
TestHelperDOCX::clear ();
21
21
}
22
22
23
- public function testWriteImage_Position ()
23
+ public function testWriteEndSection_PageNumbering ()
24
24
{
25
25
$ PHPWord = new PHPWord ();
26
26
$ section = $ PHPWord ->createSection ();
27
- $ section ->addImage (
28
- PHPWORD_TESTS_DIR_ROOT . '/_files/images/earth.jpg ' ,
29
- array (
30
- 'marginTop ' => -1 ,
31
- 'marginLeft ' => -1 ,
32
- 'wrappingStyle ' => 'behind '
33
- )
34
- );
27
+ $ section ->getSettings ()->setPageNumberingStart (2 );
35
28
36
29
$ doc = TestHelperDOCX::getDocument ($ PHPWord );
37
- $ element = $ doc ->getElement ('/w:document/w:body/w:p /w:r/w:pict/v:shape ' );
30
+ $ element = $ doc ->getElement ('/w:document/w:body/w:sectPr /w:pgNumType ' );
38
31
39
- $ style = $ element ->getAttribute ('style ' );
40
-
41
- $ this ->assertRegExp ('/z\-index:\-[0-9]*/ ' , $ style );
42
- $ this ->assertRegExp ('/position:absolute;/ ' , $ style );
32
+ $ this ->assertEquals (2 , $ element ->getAttribute ('w:start ' ));
43
33
}
44
-
45
- public function testWriteParagraphStyle_Align ()
46
- {
47
- $ PHPWord = new PHPWord ();
48
- $ section = $ PHPWord ->createSection ();
49
-
50
- $ section ->addText ('This is my text ' , null , array ('align ' => 'right ' ));
51
-
52
- $ doc = TestHelperDOCX::getDocument ($ PHPWord );
53
- $ element = $ doc ->getElement ('/w:document/w:body/w:p/w:pPr/w:jc ' );
54
-
55
- $ this ->assertEquals ('right ' , $ element ->getAttribute ('w:val ' ));
56
- }
57
-
58
- public function testWriteCellStyle_CellGridSpan ()
59
- {
60
- $ PHPWord = new PHPWord ();
61
- $ section = $ PHPWord ->createSection ();
62
-
63
- $ table = $ section ->addTable ();
64
-
65
- $ table ->addRow ();
66
- $ cell = $ table ->addCell (200 );
67
- $ cell ->getStyle ()->setGridSpan (5 );
68
-
69
- $ table ->addRow ();
70
- $ table ->addCell (40 );
71
- $ table ->addCell (40 );
72
- $ table ->addCell (40 );
73
- $ table ->addCell (40 );
74
- $ table ->addCell (40 );
75
-
76
- $ doc = TestHelperDOCX::getDocument ($ PHPWord );
77
- $ element = $ doc ->getElement ('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan ' );
78
-
79
- $ this ->assertEquals (5 , $ element ->getAttribute ('w:val ' ));
80
- }
81
34
}
82
35
0 commit comments