Skip to content

Commit 6a90581

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: [ci] Get ICU/intl from github instead of nebm.ist.utl.pt/~glopes [Debug] Fix case sensitivity checks [Debug] Fix handling of php7 throwables fix high deps tests fix testing deprecation messages [Process] remove dead code [WebProfilerBundle] Add missing use statement. [ClassLoader] Fix storing not-found classes in APC cache [Form] cs fixes in date types [phpunit] disable prophecy
2 parents 996de0b + 6f777ed commit 6a90581

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Tests/ContainerBuilderTest.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,28 @@ public function testDefinitions()
6060

6161
public function testCreateDeprecatedService()
6262
{
63-
$definition = new Definition('stdClass');
64-
$definition->setDeprecated(true);
63+
$deprecations = array();
64+
set_error_handler(function ($type, $msg) use (&$deprecations) {
65+
if (E_USER_DEPRECATED !== $type) {
66+
restore_error_handler();
6567

66-
$that = $this;
67-
$wasTriggered = false;
68+
return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
69+
}
6870

69-
set_error_handler(function ($errno, $errstr) use ($that, &$wasTriggered) {
70-
$that->assertSame(E_USER_DEPRECATED, $errno);
71-
$that->assertSame('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', $errstr);
72-
$wasTriggered = true;
71+
$deprecations[] = $msg;
7372
});
7473

74+
$definition = new Definition('stdClass');
75+
$definition->setDeprecated(true);
76+
7577
$builder = new ContainerBuilder();
7678
$builder->setDefinition('deprecated_foo', $definition);
7779
$builder->get('deprecated_foo');
7880

7981
restore_error_handler();
8082

81-
$this->assertTrue($wasTriggered);
83+
$this->assertCount(1, $deprecations);
84+
$this->assertContains('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', $deprecations[0]);
8285
}
8386

8487
public function testRegister()

0 commit comments

Comments
 (0)