Issue #2550641 by damiankloip: Use assert() in Drupal\Core\DependencyInjection\Container::__sleep instead of trigger error
parent
e5018e6054
commit
25f26ed119
|
@ -31,7 +31,7 @@ class Container extends DrupalContainer {
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function __sleep() {
|
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));
|
return array_keys(get_object_vars($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ class ContainerBuilder extends SymfonyContainerBuilder {
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function __sleep() {
|
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));
|
return array_keys(get_object_vars($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,4 +70,14 @@ class ContainerBuilderTest extends UnitTestCase {
|
||||||
$container->register('Bar');
|
$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.
|
* Tests serialization.
|
||||||
*
|
*
|
||||||
* @expectedException \PHPUnit_Framework_Error
|
* @expectedException \AssertionError
|
||||||
*/
|
*/
|
||||||
public function testSerialize() {
|
public function testSerialize() {
|
||||||
$container = new Container();
|
$container = new Container();
|
||||||
|
|
Loading…
Reference in New Issue