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

Commit 9a9c0f6

Browse filesBrowse files
[Bridge/PhpUnit] Fix tests by backporting #25997 to 3.4
1 parent edd507a commit 9a9c0f6
Copy full SHA for 9a9c0f6

File tree

Expand file treeCollapse file tree

5 files changed

+13
-11
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+13
-11
lines changed

‎src/Symfony/Bridge/PhpUnit/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ CHANGELOG
55
-----
66

77
* added a `CoverageListener` to enhance the code coverage report
8+
* all deprecations but those from tests marked with `@group legacy` are always
9+
displayed when not in `weak` mode
810

911
3.3.0
1012
-----

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ public static function register($mode = 0)
110110

111111
$trace = debug_backtrace(true);
112112
$group = 'other';
113-
$isVendor = false;
114-
$isWeak = DeprecationErrorHandler::MODE_WEAK === $mode || (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $isVendor = $inVendors($file));
113+
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
115114

116115
$i = count($trace);
117116
while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_') || 0 === strpos($trace[$i]['class'], 'PHPUnit\\')))) {
@@ -128,7 +127,7 @@ public static function register($mode = 0)
128127
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
129128
// then we need to use the serialized information to determine
130129
// if the error has been triggered from vendor code.
131-
$isWeak = DeprecationErrorHandler::MODE_WEAK === $mode || (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $isVendor = isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']));
130+
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
132131
} else {
133132
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
134133
$method = $trace[$i]['function'];
@@ -145,7 +144,7 @@ public static function register($mode = 0)
145144
|| in_array('legacy', $Test::getGroups($class, $method), true)
146145
) {
147146
$group = 'legacy';
148-
} elseif (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $isVendor) {
147+
} elseif ($isVendor) {
149148
$group = 'remaining vendor';
150149
} else {
151150
$group = 'remaining';
@@ -165,13 +164,13 @@ public static function register($mode = 0)
165164

166165
exit(1);
167166
}
168-
if ('legacy' !== $group && !$isWeak) {
167+
if ('legacy' !== $group && DeprecationErrorHandler::MODE_WEAK !== $mode) {
169168
$ref = &$deprecations[$group][$msg]['count'];
170169
++$ref;
171170
$ref = &$deprecations[$group][$msg][$class.'::'.$method];
172171
++$ref;
173172
}
174-
} elseif (!$isWeak) {
173+
} elseif (DeprecationErrorHandler::MODE_WEAK !== $mode) {
175174
$ref = &$deprecations[$group][$msg]['count'];
176175
++$ref;
177176
}

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public function testLegacyFoo()
2121
{
2222
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
2323
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
24+
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
25+
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
2426
}
2527

2628
public function testNonLegacyBar()

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ Unsilenced deprecation notices (1)
3737
Legacy deprecation notices (1)
3838

3939
Other deprecation notices (1)
40-

‎src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ require __DIR__.'/fake_vendor/acme/lib/deprecation_riddled.php';
2020

2121
?>
2222
--EXPECTF--
23-
Unsilenced deprecation notices (2)
23+
Unsilenced deprecation notices (3)
2424

25-
1x: unsilenced foo deprecation
26-
1x in FooTestCase::testLegacyFoo
25+
2x: unsilenced foo deprecation
26+
2x in FooTestCase::testLegacyFoo
2727

2828
1x: unsilenced bar deprecation
2929
1x in FooTestCase::testNonLegacyBar
@@ -33,7 +33,7 @@ Remaining vendor deprecation notices (1)
3333
1x: silenced bar deprecation
3434
1x in FooTestCase::testNonLegacyBar
3535

36-
Legacy deprecation notices (1)
36+
Legacy deprecation notices (2)
3737

3838
Other deprecation notices (1)
3939

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.