-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from Fake51/develop
Bugfixes for masterslide issues: issue #330, problems with broken powerpoints needing repair, missing images in shapes
- Loading branch information
Showing
6 changed files
with
143 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @copyright 2009-2017 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
* @link https://github.com/PHPOffice/PHPPresentation | ||
*/ | ||
|
||
namespace PhpOffice\PhpPresentation\Tests\Writer; | ||
|
||
use PhpOffice\PhpPresentation\Writer; | ||
|
||
/** | ||
* Mock class for AbstractWriter | ||
* | ||
*/ | ||
class AbstractWriter extends Writer\AbstractWriter | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
{ | ||
/** | ||
* public wrapper for protected method | ||
* | ||
* @return \PhpOffice\PhpPresentation\Shape\AbstractDrawing[] All drawings in PhpPresentation | ||
* @throws \Exception | ||
*/ | ||
public function allDrawings() | ||
{ | ||
return parent::allDrawings(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlideMastersTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace PhpPresentation\Tests\Writer\PowerPoint2007; | ||
|
||
use PhpOffice\PhpPresentation\Writer\PowerPoint2007\PptSlideMasters; | ||
use PhpOffice\PhpPresentation\Slide\SlideLayout; | ||
use PhpOffice\PhpPresentation\Shape\Drawing\File as ShapeDrawingFile; | ||
|
||
/** | ||
* Test class for PowerPoint2007 | ||
* | ||
* @coversDefaultClass PowerPoint2007 | ||
*/ | ||
class PptSlideMastersTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testWriteSlideMasterRelationships() | ||
{ | ||
$writer = new PptSlideMasters(); | ||
$slideMaster = $this->getMockBuilder('PhpOffice\\PhpPresentation\\Slide\\SlideMaster') | ||
->setMethods(array('getAllSlideLayouts', 'getRelsIndex', 'getShapeCollection')) | ||
->getMock(); | ||
|
||
$layouts = array(new SlideLayout($slideMaster)); | ||
|
||
$slideMaster->expects($this->once()) | ||
->method('getAllSlideLayouts') | ||
->will($this->returnValue($layouts)); | ||
|
||
$collection = new \ArrayObject(); | ||
$collection[] = new ShapeDrawingFile(); | ||
$collection[] = new ShapeDrawingFile(); | ||
$collection[] = new ShapeDrawingFile(); | ||
|
||
$slideMaster->expects($this->exactly(2)) | ||
->method('getShapeCollection') | ||
->will($this->returnValue($collection)); | ||
|
||
$data = $writer->writeSlideMasterRelationships($slideMaster); | ||
|
||
$dom = new \DomDocument(); | ||
$dom->loadXml($data); | ||
|
||
$xpath = new \DomXpath($dom); | ||
$xpath->registerNamespace('r', 'http://schemas.openxmlformats.org/package/2006/relationships'); | ||
$list = $xpath->query('//r:Relationship'); | ||
|
||
$this->assertEquals(5, $list->length); | ||
|
||
$this->assertEquals('rId1', $list->item(0)->getAttribute('Id')); | ||
$this->assertEquals('rId2', $list->item(1)->getAttribute('Id')); | ||
$this->assertEquals('rId3', $list->item(2)->getAttribute('Id')); | ||
$this->assertEquals('rId4', $list->item(3)->getAttribute('Id')); | ||
$this->assertEquals('rId5', $list->item(4)->getAttribute('Id')); | ||
} | ||
} |
Is this really an abstract class? Then please add
abstract
to it.