Skip to content

Commit

Permalink
Move DeprecationErrorHandler to Test folder so it's not removed when …
Browse files Browse the repository at this point in the history
…building the zip file
  • Loading branch information
colinfrei authored and tvlooy committed Dec 16, 2012
1 parent 566e73e commit 93152e5
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion AbstractType.php
Expand Up @@ -51,7 +51,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
$resolver->setDefaults($this->getDefaultOptions(array()));
$resolver->addAllowedValues($this->getAllowedOptionValues(array()));
restore_error_handler();
Expand Down
2 changes: 1 addition & 1 deletion AbstractTypeExtension.php
Expand Up @@ -44,7 +44,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
$resolver->setDefaults($this->getDefaultOptions());
$resolver->addAllowedValues($this->getAllowedOptionValues());
restore_error_handler();
Expand Down
8 changes: 4 additions & 4 deletions Form.php
Expand Up @@ -366,7 +366,7 @@ public function setData($modelData)

// Hook to change content of the data
if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA) || $dispatcher->hasListeners(FormEvents::SET_DATA)) {
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
$event = new FormEvent($this, $modelData);
restore_error_handler();
$dispatcher->dispatch(FormEvents::PRE_SET_DATA, $event);
Expand Down Expand Up @@ -531,7 +531,7 @@ public function bind($submittedData)

// Hook to change content of the data bound by the browser
if ($dispatcher->hasListeners(FormEvents::PRE_BIND) || $dispatcher->hasListeners(FormEvents::BIND_CLIENT_DATA)) {
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
$event = new FormEvent($this, $submittedData);
restore_error_handler();
$dispatcher->dispatch(FormEvents::PRE_BIND, $event);
Expand Down Expand Up @@ -593,7 +593,7 @@ public function bind($submittedData)
// Hook to change content of the data into the normalized
// representation
if ($dispatcher->hasListeners(FormEvents::BIND) || $dispatcher->hasListeners(FormEvents::BIND_NORM_DATA)) {
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
$event = new FormEvent($this, $normData);
restore_error_handler();
$dispatcher->dispatch(FormEvents::BIND, $event);
Expand All @@ -619,7 +619,7 @@ public function bind($submittedData)
$dispatcher->dispatch(FormEvents::POST_BIND, $event);
}

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
foreach ($this->config->getValidators() as $validator) {
$validator->validate($this);
}
Expand Down
2 changes: 1 addition & 1 deletion FormFactory.php
Expand Up @@ -99,7 +99,7 @@ public function createBuilderForProperty($class, $property, $data = null, array
$typeGuess = $guesser->guessType($class, $property);
$maxLengthGuess = $guesser->guessMaxLength($class, $property);
// Keep $minLengthGuess for BC until Symfony 2.3
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
$minLengthGuess = $guesser->guessMinLength($class, $property);
restore_error_handler();
$requiredGuess = $guesser->guessRequired($class, $property);
Expand Down
2 changes: 1 addition & 1 deletion FormRegistry.php
Expand Up @@ -131,7 +131,7 @@ private function resolveAndAddType(FormTypeInterface $type)
);
}

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
$this->addType($this->resolvedTypeFactory->createResolvedType(
$type,
$typeExtensions,
Expand Down
@@ -1,6 +1,6 @@
<?php

namespace Symfony\Component\Form\Tests;
namespace Symfony\Component\Form\Test;

use Symfony\Component\Form\FormInterface as NonTestFormInterface;
use Symfony\Component\Form\FormEvent;
Expand All @@ -27,7 +27,7 @@ public static function handleBC($errorNumber, $message, $file, $line, $context)

public static function getFormEvent(NonTestFormInterface $form, $data)
{
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$event = new FormEvent($form, $data);
restore_error_handler();

Expand Down
6 changes: 3 additions & 3 deletions Tests/CompoundFormTest.php
Expand Up @@ -118,14 +118,14 @@ public function testHasChildren()
{
$this->form->add($this->getBuilder()->getForm());

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->assertTrue($this->form->hasChildren());
restore_error_handler();
}

public function testHasNoChildren()
{
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->assertFalse($this->form->hasChildren());
restore_error_handler();
}
Expand Down Expand Up @@ -155,7 +155,7 @@ public function testRemove()
$this->form->remove('foo');

$this->assertNull($child->getParent());
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->assertFalse($this->form->hasChildren());
restore_error_handler();
}
Expand Down
Expand Up @@ -13,7 +13,7 @@

use Symfony\Component\Form\Extension\Core\EventListener\FixRadioInputListener;
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;

use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;

use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

abstract class MergeCollectionListenerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
Expand Up @@ -13,7 +13,7 @@

use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Extension/Core/EventListener/TrimListenerTest.php
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;

use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

class TrimListenerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
Expand Up @@ -13,7 +13,7 @@

use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

class CsrfValidationListenerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\Form\FormConfigBuilder;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

/**
* @author Bernhard Schussek <bschussek@gmail.com>
Expand Down
Expand Up @@ -18,7 +18,7 @@
use Symfony\Component\Form\Extension\Validator\Constraints\Form;
use Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Form\Tests\DeprecationErrorHandler;
use Symfony\Component\Form\Test\DeprecationErrorHandler;

class ValidationListenerTest extends \PHPUnit_Framework_TestCase
{
Expand Down
6 changes: 3 additions & 3 deletions Tests/FormFactoryTest.php
Expand Up @@ -85,7 +85,7 @@ public function testAddType()
->method('addType')
->with($resolvedType);

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->factory->addType($type);
restore_error_handler();
}
Expand All @@ -97,7 +97,7 @@ public function testHasType()
->with('name')
->will($this->returnValue('RESULT'));

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->assertSame('RESULT', $this->factory->hasType('name'));
restore_error_handler();
}
Expand All @@ -116,7 +116,7 @@ public function testGetType()
->with('name')
->will($this->returnValue($resolvedType));

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->assertEquals($type, $this->factory->getType('name'));
restore_error_handler();
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/FormIntegrationTestCase.php
Expand Up @@ -33,7 +33,7 @@ protected function setUp()
->addExtensions($this->getExtensions())
->getFormFactory();

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
}

protected function tearDown()
Expand Down
4 changes: 2 additions & 2 deletions Tests/FormRegistryTest.php
Expand Up @@ -76,7 +76,7 @@ public function testGetTypeReturnsAddedType()
->method('getName')
->will($this->returnValue('foo'));

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->registry->addType($resolvedType);
restore_error_handler();

Expand Down Expand Up @@ -225,7 +225,7 @@ public function testHasTypeAfterAdding()

$this->assertFalse($this->registry->hasType('foo'));

set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$this->registry->addType($resolvedType);
restore_error_handler();

Expand Down
2 changes: 1 addition & 1 deletion Tests/SimpleFormTest.php
Expand Up @@ -644,7 +644,7 @@ public function testBindValidatesAfterTransformation()
{
$test = $this;
$validator = $this->getFormValidator();
set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
$form = $this->getBuilder()
->addValidator($validator)
->getForm();
Expand Down

0 comments on commit 93152e5

Please sign in to comment.