Skip to content

Commit

Permalink
Merge pull request #90 from researchgate/libxml_entity_loader_disabled
Browse files Browse the repository at this point in the history
Load configuration even if libxml entity loader is disabled
  • Loading branch information
julianseeger committed Apr 29, 2014
2 parents 4667114 + 9dba8d4 commit f0639c6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ParaTest/Runners/PHPUnit/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ class Configuration
public function __construct($path)
{
$this->path = $path;
if(file_exists($path))
if(file_exists($path)) {
$before = libxml_disable_entity_loader(false);
$this->xml = simplexml_load_file($path);
libxml_disable_entity_loader($before);
}
}

/**
* Get the bootstrap PHPUnit configuration attribute
*
*
* @return string The bootstrap attribute or empty string if not set
*/
public function getBootstrap()
Expand Down
16 changes: 16 additions & 0 deletions test/ParaTest/Runners/PHPUnit/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,20 @@ public function testSuitesContainPathAsValue($suites)
$this->assertEquals(array($basePath . 'it' . DS . 'ParaTest'), $suites["ParaTest Integration Tests"]);
$this->assertEquals(array($basePath . 'functional'), $suites["ParaTest Functional Tests"]);
}

public function testLoadConfigEvenIfLibXmlEntityLoaderIsDisabled()
{
$before = libxml_disable_entity_loader();
$e = null;

try {
$this->config = new Configuration($this->path);
} catch (\Exception $exc) {
$e = $exc;
}

libxml_disable_entity_loader($before);

$this->assertNull($e, 'Could not instantiate Configuration: ' . ($e instanceof \Exception ? $e->getMessage() : 'no error given'));
}
}

0 comments on commit f0639c6

Please sign in to comment.