[Form] [FrameworkBundle] catch deprecation errors in tests

This commit is contained in:
Colin Frei 2012-12-14 23:16:06 +01:00
parent c21b12e896
commit ebcb432f07
5 changed files with 13 additions and 8 deletions

View File

@ -68,6 +68,8 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
protected function tearDown() protected function tearDown()
{ {
$this->engine = null; $this->engine = null;
parent::tearDown();
} }
protected function renderEnctype(FormView $view) protected function renderEnctype(FormView $view)

View File

@ -69,6 +69,8 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
protected function tearDown() protected function tearDown()
{ {
$this->engine = null; $this->engine = null;
parent::tearDown();
} }
protected function renderEnctype(FormView $view) protected function renderEnctype(FormView $view)

View File

@ -45,6 +45,8 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
{ {
$this->csrfProvider = null; $this->csrfProvider = null;
$this->factory = null; $this->factory = null;
parent::tearDown();
} }
protected function assertXpathNodeValue(\DomElement $element, $expression, $nodeValue) protected function assertXpathNodeValue(\DomElement $element, $expression, $nodeValue)

View File

@ -33,14 +33,6 @@ abstract class TypeTestCase extends FormIntegrationTestCase
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
}
protected function tearDown()
{
restore_error_handler();
} }
public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual) public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual)

View File

@ -32,6 +32,13 @@ abstract class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase
$this->factory = Forms::createFormFactoryBuilder() $this->factory = Forms::createFormFactoryBuilder()
->addExtensions($this->getExtensions()) ->addExtensions($this->getExtensions())
->getFormFactory(); ->getFormFactory();
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
}
protected function tearDown()
{
restore_error_handler();
} }
protected function getExtensions() protected function getExtensions()