Skip to content
Snippets Groups Projects
Commit 31c4fed7 authored by David Prévot's avatar David Prévot
Browse files

New upstream version 0.11.2

parents cf004545 0e1dbf4b
No related branches found
No related tags found
No related merge requests found
# Changelog of phpDox
## phpDox 0.11.1 (7 May 2018)
## phpDox 0.11.2 (22 May 2018)
Note: 0.11.x is the last series of releases that supports running under PHP 5.x
### Fixed
* [#333](https://github.com/theseer/phpdox/issues/333): PHPUnit Enricher: Wrong namspace - not a PHPUnit code coverage file
* [#325](https://github.com/theseer/phpdox/issues/325): Git Enricher does not work properly with Git 1.7.1
## phpDox 0.11.1 (7 May 2018)
### Fixed
* [#332](https://github.com/theseer/phpdox/issues/332): PHPUnit Enricher: classnode is always null
......
......@@ -37,7 +37,7 @@ You can now execute phpdox on the command line:
If everything worked out, you should get an output like this:
phpDox 0.11.1 - Copyright (C) 2010 - 2018 by Arne Blankerts and Contributors
phpDox 0.11.2 - Copyright (C) 2010 - 2018 by Arne Blankerts and Contributors
_Note: Some Linux distributions ship PHP with ext/suhosin and disabled phar execution. To make use of phpDox in such an environment, you need to enable phar execution by adding phar to the executor white list: suhosin.executor.include.whitelist="phar"_
......@@ -55,7 +55,7 @@ You can now execute phpdox on the command line:
If everything worked out, you should get an output like this:
phpDox 0.11.1 - Copyright (C) 2010 - 2018 by Arne Blankerts and Contributors
phpDox 0.11.2 - Copyright (C) 2010 - 2018 by Arne Blankerts and Contributors
Developer Installation
......
......@@ -47,6 +47,7 @@ namespace TheSeer\phpDox\Generator\Enricher {
public function __construct(GitConfig $config) {
$this->ensureExecFunctionEnabled();
$this->ensureGitVersionSupported($config->getGitBinary());
$this->config = $config;
}
......@@ -323,6 +324,20 @@ namespace TheSeer\phpDox\Generator\Enricher {
}
}
private function ensureGitVersionSupported($binary) {
$output = exec(sprintf('%s --version', $binary));
$parts = explode(' ', $output);
$version = array_pop($parts);
if (version_compare($version, '1.7.2', '<')) {
throw new GitEnricherException(
sprintf('Your version of GIT is too old. Please upgrade to at least version 1.7.2 (Found: %s)', $version),
GitEnricherException::GitVersionTooOld
);
}
}
}
}
......@@ -5,6 +5,7 @@ namespace TheSeer\phpDox\Generator\Enricher {
const ExecDisabled = 1;
const FetchingHistoryFailed = 2;
const GitVersionTooOld = 3;
}
}
......@@ -13,13 +13,19 @@ namespace TheSeer\phpDox\Generator\Enricher {
class PHPUnit extends AbstractEnricher implements
EndEnricherInterface, ClassEnricherInterface, TraitEnricherInterface, TokenFileEnricherInterface {
const XMLNS = 'http://schema.phpunit.de/coverage/1.0';
const XMLNS_HTTP = 'http://schema.phpunit.de/coverage/1.0';
const XMLNS_HTTPS = 'https://schema.phpunit.de/coverage/1.0';
/**
* @var Fileinfo
*/
private $coveragePath;
/**
* @var string
*/
private $namespaceURI;
/**
* @var FileInfo
*/
......@@ -63,7 +69,7 @@ namespace TheSeer\phpDox\Generator\Enricher {
}
/** @var fDOMElement $classNode */
$container = $this->getEnrichtmentContainer($classNode, 'phpunit');
$resultNode = $container->appendElementNS(self::XMLNS, 'result');
$resultNode = $container->appendElementNS($this->namespaceURI, 'result');
foreach($results as $key => $value) {
$resultNode->setAttribute(mb_strtolower($key), $value);
}
......@@ -125,13 +131,16 @@ namespace TheSeer\phpDox\Generator\Enricher {
$dom = new fDOMDocument();
$dom->load($fname);
if ($dom->documentElement->namespaceURI != self::XMLNS) {
$this->namespaceURI = $dom->documentElement->namespaceURI;
if (!in_array($this->namespaceURI, [self::XMLNS_HTTP, self::XMLNS_HTTPS])) {
throw new EnricherException(
'Wrong namspace - not a PHPUnit code coverage file',
EnricherException::LoadError
);
}
$dom->registerNamespace('pu', self::XMLNS);
$dom->registerNamespace('pu', $this->namespaceURI);
return $dom;
} catch (fDOMException $e) {
......@@ -156,7 +165,7 @@ namespace TheSeer\phpDox\Generator\Enricher {
// This class seems to be newer than the last phpunit run
return;
}
$coverageTarget = $enrichment->appendElementNS(self::XMLNS, 'coverage');
$coverageTarget = $enrichment->appendElementNS($this->namespaceURI, 'coverage');
foreach(array('executable','executed', 'crap') as $attr) {
$coverageTarget->appendChild(
$coverageTarget->ownerDocument->importNode($classNode->getAttributeNode($attr))
......@@ -181,7 +190,7 @@ namespace TheSeer\phpDox\Generator\Enricher {
$end = $method->getAttribute('end');
$enrichment = $this->getEnrichtmentContainer($method, 'phpunit');
$coverageTarget = $enrichment->appendElementNS(self::XMLNS, 'coverage');
$coverageTarget = $enrichment->appendElementNS($this->namespaceURI, 'coverage');
/** @var fDOMElement $coverageMethod */
$coverageMethod = $coverage->queryOne(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment