Commit 25f26ed1 authored by webchick's avatar webchick

Issue #2550641 by damiankloip: Use assert() in...

Issue #2550641 by damiankloip: Use assert() in Drupal\Core\DependencyInjection\Container::__sleep instead of trigger error
parent e5018e60
......@@ -31,7 +31,7 @@ public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER)
* {@inheritdoc}
*/
public function __sleep() {
trigger_error('The container was serialized.', E_USER_ERROR);
assert(FALSE, 'The container was serialized.');
return array_keys(get_object_vars($this));
}
......
......@@ -118,7 +118,7 @@ protected function callMethod($service, $call) {
* {@inheritdoc}
*/
public function __sleep() {
trigger_error('The container was serialized.', E_USER_ERROR);
assert(FALSE, 'The container was serialized.');
return array_keys(get_object_vars($this));
}
......
......@@ -70,4 +70,14 @@ public function testRegisterException() {
$container->register('Bar');
}
/**
* Tests serialization.
*
* @expectedException \AssertionError
*/
public function testSerialize() {
$container = new ContainerBuilder();
serialize($container);
}
}
......@@ -20,7 +20,7 @@ class ContainerTest extends UnitTestCase {
/**
* Tests serialization.
*
* @expectedException \PHPUnit_Framework_Error
* @expectedException \AssertionError
*/
public function testSerialize() {
$container = new Container();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment