Skip to content

Commit 39ce62f

Browse files
committed
use PhpPresentationTestCase and make getXmlDom protected
1 parent dcfc99c commit 39ce62f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

tests/PhpPresentation/Tests/Writer/PowerPoint2007/SchemaTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,28 @@
1616
use PhpOffice\PhpPresentation\Style\Color;
1717
use PhpOffice\PhpPresentation\Style\Fill;
1818
use PhpOffice\PhpPresentation\Style\Shadow;
19-
use PhpOffice\PhpPresentation\Tests\TestHelperDOCX;
19+
use PhpOffice\PhpPresentation\Tests\PhpPresentationTestCase;
2020
use PhpOffice\PhpPresentation\Shape\Drawing;
2121
use PhpOffice\PhpPresentation\Shape\Media;
2222
use Symfony\Component\Finder\SplFileInfo;
2323

24-
class SchemaTest extends \PHPUnit_Framework_TestCase
24+
class SchemaTest extends PhpPresentationTestCase
2525
{
2626
private $internalErrors;
2727

28-
protected function setUp()
28+
public function setUp()
2929
{
30+
parent::setUp();
31+
3032
libxml_clear_errors();
3133
$this->internalErrors = libxml_use_internal_errors(true);
3234
}
3335

34-
protected function tearDown()
36+
public function tearDown()
3537
{
38+
parent::tearDown();
39+
3640
libxml_use_internal_errors($this->internalErrors);
37-
TestHelperDOCX::clear();
3841
}
3942

4043
/**
@@ -45,10 +48,10 @@ protected function tearDown()
4548
*/
4649
public function testSchema(PhpPresentation $presentation)
4750
{
48-
$xml = TestHelperDOCX::getDocument($presentation, 'PowerPoint2007');
51+
$this->writePresentationFile($presentation, 'PowerPoint2007');
4952

5053
// validate all XML files
51-
$path = realpath($xml->getPath() . '/ppt');
54+
$path = realpath($this->workDirectory . '/ppt');
5255
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
5356

5457
foreach ($iterator as $file) {
@@ -58,7 +61,7 @@ public function testSchema(PhpPresentation $presentation)
5861
}
5962

6063
$fileName = str_replace('\\', '/', substr($file->getRealPath(), strlen($path) + 1));
61-
$dom = $xml->getFileDom('ppt/' . $fileName);
64+
$dom = $this->getXmlDom('ppt/' . $fileName);
6265
$xmlSource = $dom->saveXML();
6366

6467
// In the ISO/ECMA standard the namespace has changed from

tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function deleteDir($dir)
8989
rmdir($dir);
9090
}
9191

92-
private function getXmlDom($file)
92+
protected function getXmlDom($file)
9393
{
9494
$baseFile = $file;
9595
if (null !== $this->xmlDom && $file === $this->xmlFile) {

0 commit comments

Comments
 (0)