File tree Expand file tree Collapse file tree 5 files changed +101
-1
lines changed Expand file tree Collapse file tree 5 files changed +101
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * This file is part of PHPWord - A pure PHP library for reading and writing
4
+ * word processing documents.
5
+ *
6
+ * PHPWord is free software distributed under the terms of the GNU Lesser
7
+ * General Public License version 3 as published by the Free Software Foundation.
8
+ *
9
+ * For the full copyright and license information, please read the LICENSE
10
+ * file that was distributed with this source code. For the full list of
11
+ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
12
+ *
13
+ * @see https://github.com/PHPOffice/PHPWord
14
+ * @copyright 2010-2017 PHPWord contributors
15
+ * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16
+ */
17
+
18
+ namespace PhpOffice \PhpWord \Element ;
19
+
20
+ /**
21
+ * Test class for PhpOffice\PhpWord\Element\Footer
22
+ *
23
+ * @runTestsInSeparateProcesses
24
+ */
25
+ class BookmarkTest extends \PHPUnit_Framework_TestCase
26
+ {
27
+ /**
28
+ * New instance
29
+ */
30
+ public function testConstruct ()
31
+ {
32
+ $ bookmarkName = 'test ' ;
33
+ $ oBookmark = new Bookmark ($ bookmarkName );
34
+
35
+ $ this ->assertInstanceOf ('PhpOffice \\PhpWord \\Element \\Bookmark ' , $ oBookmark );
36
+ $ this ->assertEquals ($ bookmarkName , $ oBookmark ->getName ());
37
+ }
38
+ }
Original file line number Diff line number Diff line change @@ -80,4 +80,24 @@ public function testRelationId()
80
80
$ oComment ->setRelationId ($ iVal );
81
81
$ this ->assertEquals ($ iVal , $ oComment ->getRelationId ());
82
82
}
83
+
84
+ /**
85
+ * @expectedException \InvalidArgumentException
86
+ */
87
+ public function testExceptionOnCommentStartOnComment ()
88
+ {
89
+ $ dummyComment = new Comment ('Test User ' , new \DateTime (), 'my_initials ' );
90
+ $ oComment = new Comment ('Test User ' , new \DateTime (), 'my_initials ' );
91
+ $ oComment ->setCommentRangeStart ($ dummyComment );
92
+ }
93
+
94
+ /**
95
+ * @expectedException \InvalidArgumentException
96
+ */
97
+ public function testExceptionOnCommentEndOnComment ()
98
+ {
99
+ $ dummyComment = new Comment ('Test User ' , new \DateTime (), 'my_initials ' );
100
+ $ oComment = new Comment ('Test User ' , new \DateTime (), 'my_initials ' );
101
+ $ oComment ->setCommentRangeEnd ($ dummyComment );
102
+ }
83
103
}
Original file line number Diff line number Diff line change 26
26
class ObjectTest extends \PHPUnit_Framework_TestCase
27
27
{
28
28
/**
29
- * Create new instance with supported files
29
+ * Create new instance with supported files, 4 character extention
30
30
*/
31
31
public function testConstructWithSupportedFiles ()
32
+ {
33
+ $ src = __DIR__ . '/../_files/documents/reader.docx ' ;
34
+ $ oObject = new Object ($ src );
35
+
36
+ $ this ->assertInstanceOf ('PhpOffice \\PhpWord \\Element \\Object ' , $ oObject );
37
+ $ this ->assertInstanceOf ('PhpOffice \\PhpWord \\Style \\Image ' , $ oObject ->getStyle ());
38
+ $ this ->assertEquals ($ src , $ oObject ->getSource ());
39
+ }
40
+
41
+ /**
42
+ * Create new instance with supported files
43
+ */
44
+ public function testConstructWithSupportedFilesLong ()
32
45
{
33
46
$ src = __DIR__ . '/../_files/documents/sheet.xls ' ;
34
47
$ oObject = new Object ($ src );
Original file line number Diff line number Diff line change @@ -129,6 +129,17 @@ public function testAddHeaderFooter()
129
129
$ this ->assertFalse ($ object ->hasDifferentFirstPage ());
130
130
}
131
131
132
+ /**
133
+ * @covers ::addHeader
134
+ * @covers ::hasDifferentFirstPage
135
+ */
136
+ public function testHasDifferentFirstPageFooter ()
137
+ {
138
+ $ object = new Section (1 );
139
+ $ object ->addFooter (Header::FIRST );
140
+ $ this ->assertTrue ($ object ->hasDifferentFirstPage ());
141
+ }
142
+
132
143
/**
133
144
* @covers ::addHeader
134
145
* @covers ::hasDifferentFirstPage
Original file line number Diff line number Diff line change @@ -116,6 +116,24 @@ public function testProofState()
116
116
$ this ->assertEquals (ProofState::DIRTY , $ oSettings ->getProofState ()->getSpelling ());
117
117
}
118
118
119
+ /**
120
+ * @expectedException \InvalidArgumentException
121
+ */
122
+ public function testWrongProofStateGrammar ()
123
+ {
124
+ $ proofState = new ProofState ();
125
+ $ proofState ->setGrammar ('wrong ' );
126
+ }
127
+
128
+ /**
129
+ * @expectedException \InvalidArgumentException
130
+ */
131
+ public function testWrongProofStateSpelling ()
132
+ {
133
+ $ proofState = new ProofState ();
134
+ $ proofState ->setSpelling ('wrong ' );
135
+ }
136
+
119
137
/**
120
138
* Zoom as percentage
121
139
*/
You can’t perform that action at this time.
0 commit comments