Skip to content

Commit

Permalink
phpstan fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyEssence committed Aug 31, 2023
1 parent a804c6b commit 03de398
Showing 1 changed file with 39 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,47 @@
*/
class PptSlideMastersTest extends TestCase
{

public function testWriteSlideMasterRelationships(): void
{
$this->markTestSkipped('Broken and should be fixed... eventually...');

$writer = new PptSlideMasters();
/** @var \PHPUnit\Framework\MockObject\MockObject|SlideMaster $slideMaster */
$slideMaster = $this->getMockBuilder(SlideMaster::class)
->setMethods(['getAllSlideLayouts', 'getRelsIndex', 'getShapeCollection'])
->getMock();

$layouts = [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);

foreach (range(0, 4) as $id) {
/** @var DOMElement $domItem */
$domItem = $list->item($id);
$this->assertInstanceOf(DOMElement::class, $domItem);
$this->assertEquals('rId' . (string) ($id + 1), $domItem->getAttribute('Id'));
}
//
// $writer = new PptSlideMasters();
// /** @var \PHPUnit\Framework\MockObject\MockObject|SlideMaster $slideMaster */
// $slideMaster = $this->getMockBuilder(SlideMaster::class)
// ->setMethods(['getAllSlideLayouts', 'getRelsIndex', 'getShapeCollection'])
// ->getMock();
//
// $layouts = [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);
//
// foreach (range(0, 4) as $id) {
// /** @var DOMElement $domItem */
// $domItem = $list->item($id);
// $this->assertInstanceOf(DOMElement::class, $domItem);
// $this->assertEquals('rId' . (string) ($id + 1), $domItem->getAttribute('Id'));
// }
}
}

0 comments on commit 03de398

Please sign in to comment.