File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed
tests/PhpPresentation/Tests/Writer Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * This file is part of PHPPresentation - A pure PHP library for reading and writing
4
+ * presentations documents.
5
+ *
6
+ * PHPPresentation 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/PHPPresentation/contributors.
12
+ *
13
+ * @copyright 2009-2017 PHPPresentation contributors
14
+ * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
15
+ * @link https://github.com/PHPOffice/PHPPresentation
16
+ */
17
+
18
+ namespace PhpOffice \PhpPresentation \Tests \Writer ;
19
+ use PhpOffice \PhpPresentation \Writer ;
20
+
21
+ /**
22
+ * Mock class for AbstractWriter
23
+ *
24
+ */
25
+ class AbstractWriter extends Writer \AbstractWriter
26
+ {
27
+ /**
28
+ * public wrapper for protected method
29
+ *
30
+ * @return \PhpOffice\PhpPresentation\Shape\AbstractDrawing[] All drawings in PhpPresentation
31
+ * @throws \Exception
32
+ */
33
+ public function allDrawings ()
34
+ {
35
+ return parent ::allDrawings ();
36
+ }
37
+ }
Original file line number Diff line number Diff line change 16
16
*/
17
17
18
18
namespace PhpOffice \PhpPresentation \Tests \Writer ;
19
+ use PhpOffice \PhpPresentation \PhpPresentation ;
20
+
21
+ require 'AbstractWriter.php ' ;
19
22
20
23
/**
21
24
* Test class for AbstractWriter
@@ -36,4 +39,24 @@ public function testConstruct()
36
39
$ this ->assertInstanceOf ('PhpOffice \\PhpPresentation \\Writer \\AbstractWriter ' , $ oStubWriter ->setZipAdapter ($ oStubZip ));
37
40
$ this ->assertInstanceOf ('PhpOffice \\Common \\Adapter \\Zip \\ZipInterface ' , $ oStubWriter ->getZipAdapter ());
38
41
}
42
+
43
+ /**
44
+ * Test all drawings method
45
+ */
46
+ public function testAllDrawings_includesMasterSlides ()
47
+ {
48
+ $ presentation = new PhpPresentation ();
49
+
50
+ $ activeSlide = $ presentation ->getActiveSlide ();
51
+ $ activeSlide ->createDrawingShape ();
52
+
53
+ $ masterSlide = $ presentation ->getAllMasterSlides ()[0 ];
54
+ $ masterSlide ->createDrawingShape ();
55
+
56
+ $ writer = $ this ->getMockForAbstractClass ('PhpOffice \\PhpPresentation \\Tests \\Writer \\AbstractWriter ' );
57
+ $ writer ->setPhpPresentation ($ presentation );
58
+
59
+ $ drawings = $ writer ->allDrawings ();
60
+ $ this ->assertEquals (2 , count ($ drawings ), 'Number of drawings should equal two: one from normal slide and one from master slide ' );
61
+ }
39
62
}
You can’t perform that action at this time.
0 commit comments