Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PhpUnitBridge] Assert missing deprecations #21296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
different approach
  • Loading branch information
ro0NL committed Jan 15, 2017
commit e24d9134de8ff9826e5bfa957b6191d12909c6e3
15 changes: 6 additions & 9 deletions 15 src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Bridge\PhpUnit;

use Doctrine\Common\Annotations\AnnotationRegistry;
use SebastianBergmann\Diff\Differ;

/**
* Collects and replays skipped tests.
Expand Down Expand Up @@ -191,15 +192,11 @@ public function endTest(\PHPUnit_Framework_Test $test, $time)
restore_error_handler();

if (!in_array($test->getStatus(), array(\PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED, \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE, \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE, \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR), true)) {
try {
$prefix = "@expectedDeprecation:\n";
$test->assertStringMatchesFormat($prefix.'%A '.implode("\n%A ", $this->expectedDeprecations)."\n%A", $prefix.' '.implode("\n ", $this->gatheredDeprecations)."\n");

if ($missing = array_diff($this->gatheredDeprecations, $this->expectedDeprecations)) {
$test->assertStringMatchesFormat($prefix.'%A '.implode("\n%A ", $missing)."\n%A", $prefix.' '.implode("\n ", array())."\n");
}
} catch (\PHPUnit_Framework_AssertionFailedError $e) {
$test->getTestResultObject()->addFailure($test, $e, $time);
if ($this->gatheredDeprecations !== $this->expectedDeprecations) {
$differ = new Differ("--- Expected\n+++ Actual\n");
$test->getTestResultObject()->addFailure($test, new \PHPUnit_Framework_AssertionFailedError(
"Failed asserting expected deprecations.\n\n".$differ->diff(implode("\n", $this->gatheredDeprecations), implode("\n", $this->expectedDeprecations))
), $time);
}
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.