Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sebastianbergmann/phpunit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.6.4
Choose a base ref
...
head repository: sebastianbergmann/phpunit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.6.5
Choose a head ref
  • 6 commits
  • 8 files changed
  • 1 contributor

Commits on Apr 13, 2015

  1. Closes #1676

    sebastianbergmann committed Apr 13, 2015
    Copy the full SHA
    e94f361 View commit details

Commits on Apr 16, 2015

  1. Fix CS/WS issues

    sebastianbergmann committed Apr 16, 2015
    Copy the full SHA
    bc3ce9c View commit details

Commits on Apr 29, 2015

  1. Fix whitespace

    sebastianbergmann committed Apr 29, 2015
    Copy the full SHA
    e22f8a1 View commit details
  2. Closes #1677

    sebastianbergmann committed Apr 29, 2015
    Copy the full SHA
    9dc93fe View commit details
  3. Closes #1688

    sebastianbergmann committed Apr 29, 2015
    Copy the full SHA
    4b8cd8a View commit details
  4. Prepare release

    sebastianbergmann committed Apr 29, 2015
    Copy the full SHA
    1c54dd1 View commit details
Showing with 230 additions and 265 deletions.
  1. +5 −0 ChangeLog-4.6.md
  2. +23 −42 build/ca.pem
  3. +0 −3 composer.json
  4. +1 −1 src/Runner/Version.php
  5. +107 −154 src/TextUI/Command.php
  6. +69 −52 src/TextUI/ResultPrinter.php
  7. +24 −12 src/Util/XML.php
  8. +1 −1 tests/Regression/GitHub/1351.phpt
5 changes: 5 additions & 0 deletions ChangeLog-4.6.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes in PHPUnit 4.6

## PHPUnit 4.6.5

* Fixed [#1677](https://github.com/sebastianbergmann/phpunit/issues/1677): Number of risky tests not printed when there are failing tests
* Fixed [#1688](https://github.com/sebastianbergmann/phpunit/issues/1688): Self-Update operation does not work due to outdated SSL certificate

## PHPUnit 4.6.4

* The default list of blacklisted classes is now always passed to PHP_CodeCoverage
65 changes: 23 additions & 42 deletions build/ca.pem
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
-----BEGIN CERTIFICATE-----
MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW
MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg
Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh
dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9
MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi
U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh
cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA
A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk
pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf
OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C
Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT
Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi
HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM
Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w
+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQ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pTYghdae9C8x49OhgQ=
-----END CERTIFICATE-----
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -47,9 +47,6 @@
"bin": [
"phpunit"
],
"config": {
"bin-dir": "bin"
},
"autoload": {
"classmap": [
"src/"
2 changes: 1 addition & 1 deletion src/Runner/Version.php
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public static function id()
}

if (self::$version === null) {
$version = new SebastianBergmann\Version('4.6.4', dirname(dirname(__DIR__)));
$version = new SebastianBergmann\Version('4.6.5', dirname(dirname(__DIR__)));
self::$version = $version->getVersion();
}

261 changes: 107 additions & 154 deletions src/TextUI/Command.php

Large diffs are not rendered by default.

121 changes: 69 additions & 52 deletions src/TextUI/ResultPrinter.php
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@ public function __construct($out = null, $verbose = false, $colors = self::COLOR
}

$availableColors = array(self::COLOR_NEVER, self::COLOR_AUTO, self::COLOR_ALWAYS);

if (!in_array($colors, $availableColors)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(
3,
@@ -138,8 +139,7 @@ public function __construct($out = null, $verbose = false, $colors = self::COLOR
throw PHPUnit_Util_InvalidArgumentHelper::factory(5, 'integer or "max"');
}

$console = new Console;

$console = new Console;
$maxNumberOfColumns = $console->getNumberOfColumns();

if ($numberOfColumns == 'max' || $numberOfColumns > $maxNumberOfColumns) {
@@ -341,49 +341,33 @@ protected function printFooter(PHPUnit_Framework_TestResult $result)
($this->numAssertions == 1) ? '' : 's'
)
);
} elseif ((!$result->allCompletelyImplemented() ||
!$result->allHarmless() ||
!$result->noneSkipped()) &&
$result->wasSuccessful()) {
$this->writeWithColor(
'fg-black, bg-yellow',
sprintf(
"%sOK, but incomplete, skipped, or risky tests!\n" .
'Tests: %d, Assertions: %d%s%s%s.',
$this->verbose ? "\n" : '',
count($result),
$this->numAssertions,
$this->getCountString(
$result->notImplementedCount(),
'Incomplete'
),
$this->getCountString(
$result->skippedCount(),
'Skipped'
),
$this->getCountString(
$result->riskyCount(),
'Risky'
)
)
);
} else {
$this->writeWithColor(
'fg-white, bg-red',
sprintf(
"\nFAILURES!\n" .
'Tests: %d, Assertions: %s%s%s%s%s.',
count($result),
$this->numAssertions,
$this->getCountString($result->failureCount(), 'Failures'),
$this->getCountString($result->errorCount(), 'Errors'),
$this->getCountString(
$result->notImplementedCount(),
'Incomplete'
),
$this->getCountString($result->skippedCount(), 'Skipped')
)
);
if ($result->wasSuccessful()) {
$color = 'fg-black, bg-yellow';

if ($this->verbose) {
$this->write("\n");
}

$this->writeWithColor(
$color,
'OK, but incomplete, skipped, or risky tests!'
);
} else {
$color = 'fg-white, bg-red';

$this->write("\n");
$this->writeWithColor($color, 'FAILURES!');
}

$this->writeCountString(count($result), 'Tests', $color, true);
$this->writeCountString($this->numAssertions, 'Assertions', $color, true);
$this->writeCountString($result->errorCount(), 'Errors', $color);
$this->writeCountString($result->failureCount(), 'Failures', $color);
$this->writeCountString($result->skippedCount(), 'Skipped', $color);
$this->writeCountString($result->notImplementedCount(), 'Incomplete', $color);
$this->writeCountString($result->riskyCount(), 'Risky', $color);
$this->write(".\n");
}
}

@@ -596,17 +580,19 @@ protected function formatWithColor($color, $buffer)
return $buffer;
}

$codes = array_map('trim', explode(',', $color));
$lines = explode("\n", $buffer);
$codes = array_map('trim', explode(',', $color));
$lines = explode("\n", $buffer);
$padding = max(array_map('strlen', $lines));
$styles = array();

$styles = array();
foreach ($codes as $code) {
$styles[] = self::$ansiCodes[$code];
}

$style = sprintf("\x1b[%sm", implode(';', $styles));

$styledLines = array();

foreach ($lines as $line) {
$styledLines[] = $style . str_pad($line, $padding) . "\x1b[0m";
}
@@ -617,14 +603,18 @@ protected function formatWithColor($color, $buffer)
/**
* Writes a buffer out with a color sequence if colors are enabled.
*
* @param string $color
* @param string $buffer
* @param string $color
* @param string $buffer
* @param boolean $lf
* @since Method available since Release 4.0.0
*/
protected function writeWithColor($color, $buffer)
protected function writeWithColor($color, $buffer, $lf = true)
{
$buffer = $this->formatWithColor($color, $buffer);
$this->write($buffer . "\n");
$this->write($this->formatWithColor($color, $buffer));

if ($lf) {
$this->write("\n");
}
}

/**
@@ -639,4 +629,31 @@ protected function writeProgressWithColor($color, $buffer)
$buffer = $this->formatWithColor($color, $buffer);
$this->writeProgress($buffer);
}

/**
* @param integer $count
* @param string $name
* @param string $color
* @param boolean $always
* @since Method available since Release 4.6.5
*/
private function writeCountString($count, $name, $color, $always = false)
{
static $first = true;

if ($always || $count > 0) {
$this->writeWithColor(
$color,
sprintf(
'%s%s: %d',
!$first ? ', ' : '',
$name,
$count
),
false
);

$first = false;
}
}
}
36 changes: 24 additions & 12 deletions src/Util/XML.php
Original file line number Diff line number Diff line change
@@ -38,7 +38,9 @@ public static function prepareString($string)
'/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]/',
'',
htmlspecialchars(
PHPUnit_Util_String::convertToUtf8($string), ENT_QUOTES, 'UTF-8'
PHPUnit_Util_String::convertToUtf8($string),
ENT_QUOTES,
'UTF-8'
)
);
}
@@ -221,7 +223,7 @@ public static function xmlToVariable(DOMElement $element)
$variable[] = $value;
}
}
}
}
break;

case 'object': {
@@ -242,12 +244,12 @@ public static function xmlToVariable(DOMElement $element)
} else {
$variable = new $className;
}
}
}
break;

case 'boolean': {
$variable = $element->nodeValue == 'true' ? true : false;
}
}
break;

case 'integer':
@@ -256,7 +258,7 @@ public static function xmlToVariable(DOMElement $element)
$variable = $element->nodeValue;

settype($variable, $element->tagName);
}
}
break;
}

@@ -327,7 +329,9 @@ public static function convertSelectToTag($selector, $content = true)
// substitute spaces within attribute value
while (preg_match('/\[[^\]]+"[^"]+\s[^"]+"\]/', $selector)) {
$selector = preg_replace(
'/(\[[^\]]+"[^"]+)\s([^"]+"\])/', "$1__SPACE__$2", $selector
'/(\[[^\]]+"[^"]+)\s([^"]+"\])/',
"$1__SPACE__$2",
$selector
);
}

@@ -366,7 +370,9 @@ public static function convertSelectToTag($selector, $content = true)
// match attributes (\[[^\]]*\]*), ids (#[^\.#\[]*),
// and classes (\.[^\.#\[]*))
preg_match_all(
"/(\[[^\]]*\]*|#[^\.#\[]*|\.[^\.#\[]*)/", $element, $matches
"/(\[[^\]]*\]*|#[^\.#\[]*|\.[^\.#\[]*)/",
$element,
$matches
);

if (!empty($matches[1])) {
@@ -499,7 +505,8 @@ public static function findNodes(DOMDocument $dom, array $options, $isHtml = tru
if ($options['tag']) {
if ($isHtml) {
$elements = self::getElementsByCaseInsensitiveTagName(
$dom, $options['tag']
$dom,
$options['tag']
);
} else {
$elements = $dom->getElementsByTagName($options['tag']);
@@ -537,7 +544,8 @@ public static function findNodes(DOMDocument $dom, array $options, $isHtml = tru
foreach ($tags as $tag) {
if ($isHtml) {
$elements = self::getElementsByCaseInsensitiveTagName(
$dom, $tag
$dom,
$tag
);
} else {
$elements = $dom->getElementsByTagName($tag);
@@ -568,7 +576,8 @@ public static function findNodes(DOMDocument $dom, array $options, $isHtml = tru
elseif ($name == 'class') {
// split to individual classes
$findClasses = explode(
' ', preg_replace("/\s+/", " ", $value)
' ',
preg_replace("/\s+/", " ", $value)
);

$allClasses = explode(
@@ -765,7 +774,8 @@ public static function findNodes(DOMDocument $dom, array $options, $isHtml = tru
if ($options['children']) {
$validChild = array('count', 'greater_than', 'less_than', 'only');
$childOptions = self::assertValidKeys(
$options['children'], $validChild
$options['children'],
$validChild
);

foreach ($nodes as $node) {
@@ -807,7 +817,9 @@ public static function findNodes(DOMDocument $dom, array $options, $isHtml = tru
// match each child against a specific tag
if ($childOptions['only']) {
$onlyNodes = self::findNodes(
$dom, $childOptions['only'], $isHtml
$dom,
$childOptions['only'],
$isHtml
);

// try to match each child to one of the 'only' nodes
2 changes: 1 addition & 1 deletion tests/Regression/GitHub/1351.phpt
Original file line number Diff line number Diff line change
@@ -45,4 +45,4 @@ There was 1 failure:
Expected failure.
%A
FAILURES!
Tests: 5, Assertions: 5, Failures: 1, Errors: 2.
Tests: 5, Assertions: 5, Errors: 2, Failures: 1.