DocProps 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace PhpPresentation\Tests\Writer\PowerPoint2007;
  3. use PhpOffice\PhpPresentation\Tests\PhpPresentationTestCase;
  4. class DocPropsCustomTest extends PhpPresentationTestCase
  5. {
  6. protected $writerName = 'PowerPoint2007';
  7. public function testRender()
  8. {
  9. $this->assertZipFileExists('docProps/custom.xml');
  10. $this->assertZipXmlElementNotExists('docProps/custom.xml', '/Properties/property[@name="_MarkAsFinal"]');
  11. }
  12. public function testMarkAsFinalTrue()
  13. {
  14. $this->oPresentation->getPresentationProperties()->markAsFinal(true);
  15. $this->assertZipXmlElementExists('docProps/custom.xml', '/Properties');
  16. $this->assertZipXmlElementExists('docProps/custom.xml', '/Properties/property');
  17. $this->assertZipXmlElementExists('docProps/custom.xml', '/Properties/property[@pid="2"][@fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"][@name="_MarkAsFinal"]');
  18. $this->assertZipXmlElementExists('docProps/custom.xml', '/Properties/property[@pid="2"][@fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"][@name="_MarkAsFinal"]/vt:bool');
  19. }
  20. public function testMarkAsFinalFalse()
  21. {
  22. $this->oPresentation->getPresentationProperties()->markAsFinal(false);
  23. $this->assertZipXmlElementNotExists('docProps/custom.xml', '/Properties/property[@name="_MarkAsFinal"]');
  24. }
  25. }