[2.3] Cleanup deprecations

This commit is contained in:
Nicolas Grekas 2015-01-02 17:09:32 +01:00
parent e09b4f9a5a
commit 1d68ad3265
48 changed files with 160 additions and 113 deletions

View File

@ -16,7 +16,7 @@ use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
/**
* Class DoctrineOrmTestCase.
*
* @deprecated Deprecated as of Symfony 2.4, to be removed in Symfony 3.0.
* @deprecated Deprecated as of Symfony 2.3, to be removed in Symfony 3.0.
* Use {@link DoctrineTestHelper} instead.
*/
abstract class DoctrineOrmTestCase extends \PHPUnit_Framework_TestCase

View File

@ -12,10 +12,10 @@
namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Doctrine\DBAL\Connection;
class ORMQueryBuilderLoaderTest extends DoctrineOrmTestCase
class ORMQueryBuilderLoaderTest extends DoctrineTestHelper
{
/**
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException

View File

@ -14,7 +14,7 @@ namespace Symfony\Bridge\Doctrine\Tests\Form\Type;
use Symfony\Component\Form\Test\FormPerformanceTestCase;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
use Doctrine\ORM\Tools\SchemaTool;
use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
@ -66,7 +66,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
$this->markTestSkipped('Doctrine ORM is not available.');
}
$this->em = DoctrineOrmTestCase::createTestEntityManager();
$this->em = DoctrineTestHelper::createTestEntityManager();
parent::setUp();

View File

@ -30,22 +30,6 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
protected function setUp()
{
if (!class_exists('Symfony\Component\Locale\Locale')) {
$this->markTestSkipped('The "Locale" component is not available');
}
if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
$this->markTestSkipped('The "EventDispatcher" component is not available');
}
if (!class_exists('Symfony\Component\Form\Form')) {
$this->markTestSkipped('The "Form" component is not available');
}
if (!class_exists('Twig_Environment')) {
$this->markTestSkipped('Twig is not available.');
}
parent::setUp();
$rendererEngine = new TwigRendererEngine(array(

View File

@ -29,22 +29,6 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
protected function setUp()
{
if (!class_exists('Symfony\Component\Locale\Locale')) {
$this->markTestSkipped('The "Locale" component is not available');
}
if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
$this->markTestSkipped('The "EventDispatcher" component is not available');
}
if (!class_exists('Symfony\Component\Form\Form')) {
$this->markTestSkipped('The "Form" component is not available');
}
if (!class_exists('Twig_Environment')) {
$this->markTestSkipped('Twig is not available.');
}
parent::setUp();
$rendererEngine = new TwigRendererEngine(array(

View File

@ -23,7 +23,7 @@
"symfony/finder": "~2.3",
"symfony/form": "~2.3.5",
"symfony/http-kernel": "~2.3",
"symfony/locale": "~2.0,>=2.0.5",
"symfony/intl": "~2.3",
"symfony/routing": "~2.2",
"symfony/templating": "~2.1",
"symfony/translation": "~2.2",

View File

@ -74,10 +74,6 @@ class AppKernel extends Kernel
return include $filename;
}
public function init()
{
}
public function getRootDir()
{
return __DIR__;

View File

@ -77,7 +77,11 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
protected function renderEnctype(FormView $view)
{
return (string) $this->engine->get('form')->enctype($view);
if (!method_exists($form = $this->engine->get('form'), 'enctype')) {
$this->markTestSkipped(sprintf("Deprecated method %s->enctype() is not implemented.", get_class($form)));
}
return (string) $form->enctype($view);
}
protected function renderLabel(FormView $view, $label = null, array $vars = array())

View File

@ -78,7 +78,11 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
protected function renderEnctype(FormView $view)
{
return (string) $this->engine->get('form')->enctype($view);
if (!method_exists($form = $this->engine->get('form'), 'enctype')) {
$this->markTestSkipped(sprintf("Deprecated method %s->enctype() is not implemented.", get_class($form)));
}
return (string) $form->enctype($view);
}
protected function renderLabel(FormView $view, $label = null, array $vars = array())

View File

@ -35,7 +35,7 @@
"symfony/css-selector": "~2.0,>=2.0.5",
"symfony/dom-crawler": "~2.0,>=2.0.5",
"symfony/finder": "~2.0,>=2.0.5",
"symfony/locale": "~2.0,>=2.0.5",
"symfony/intl": "~2.3",
"symfony/security": "~2.3",
"symfony/form": "~2.3.0,>=2.3.5",
"symfony/class-loader": "~2.1",

View File

@ -74,10 +74,6 @@ class AppKernel extends Kernel
return include $filename;
}
public function init()
{
}
public function getRootDir()
{
return __DIR__;

View File

@ -19,7 +19,7 @@ class ExceptionControllerTest extends TestCase
{
public function testOnlyClearOwnOutputBuffers()
{
$flatten = $this->getMock('Symfony\Component\HttpKernel\Exception\FlattenException');
$flatten = $this->getMock('Symfony\Component\Debug\Exception\FlattenException');
$flatten
->expects($this->once())
->method('getStatusCode')

View File

@ -18,7 +18,7 @@
"require": {
"php": ">=5.3.3",
"symfony/twig-bridge": "~2.3,>=2.3.10",
"symfony/http-kernel": "~2.1"
"symfony/http-kernel": "~2.3,>=2.3.24"
},
"require-dev": {
"symfony/stopwatch": "~2.2",

View File

@ -90,7 +90,7 @@
{% macro display_message(log_index, log) %}
{% if constant('Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler::TYPE_DEPRECATION') == log.context.type|default(0) %}
{% if constant('Symfony\\Component\\Debug\\ErrorHandler::TYPE_DEPRECATION') == log.context.type|default(0) %}
DEPRECATION - {{ log.message }}
{% set id = 'sf-call-stack-' ~ log_index %}
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">

View File

@ -414,8 +414,10 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
}
public function testAsText()
public function testLegacyAsText()
{
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
$application = new Application();
$application->add(new \FooCommand());
$this->ensureStaticCommandHelp($application);
@ -423,8 +425,10 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application');
}
public function testAsXml()
public function testLegacyAsXml()
{
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
$application = new Application();
$application->add(new \FooCommand());
$this->ensureStaticCommandHelp($application);

View File

@ -318,8 +318,10 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$output->writeln('from the code...');
}
public function testAsText()
public function testLegacyAsText()
{
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
$command = new \TestCommand();
$command->setApplication(new Application());
$tester = new CommandTester($command);
@ -327,8 +329,10 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command');
}
public function testAsXml()
public function testLegacyAsXml()
{
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
$command = new \TestCommand();
$command->setApplication(new Application());
$tester = new CommandTester($command);

View File

@ -373,8 +373,10 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('foo1 ... [fooN]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options');
}
public function testAsText()
public function testLegacyAsText()
{
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
$definition = new InputDefinition(array(
new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'),
new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true),
@ -388,8 +390,10 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
$this->assertStringEqualsFile(self::$fixtures.'/definition_astext.txt', $definition->asText(), '->asText() returns a textual representation of the InputDefinition');
}
public function testAsXml()
public function testLegacyAsXml()
{
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
$definition = new InputDefinition(array(
new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'),
new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true),
@ -398,7 +402,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
new InputOption('baz', null, InputOption::VALUE_OPTIONAL, 'The baz option', false),
new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL, 'The bar option', 'bar'),
));
$this->assertXmlStringEqualsXmlFile(self::$fixtures.'/definition_asxml.txt', $definition->asXml(), '->asText() returns a textual representation of the InputDefinition');
$this->assertXmlStringEqualsXmlFile(self::$fixtures.'/definition_asxml.txt', $definition->asXml(), '->asXml() returns an XML representation of the InputDefinition');
}
protected function initializeArguments()

View File

@ -11,11 +11,26 @@
namespace Symfony\Component\Debug\Exception;
use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
/**
* Fatal Error Exception.
*
* @author Konstanton Myakshin <koc-dp@yandex.ru>
*/
class FatalErrorException extends LegacyFatalErrorException
{
}
namespace Symfony\Component\HttpKernel\Exception;
/**
* Fatal Error Exception.
*
* @author Konstanton Myakshin <koc-dp@yandex.ru>
*
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
*/
class FatalErrorException extends \ErrorException
{
}

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Debug\Exception;
use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
/**
@ -20,7 +21,7 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class FlattenException
class FlattenException extends LegacyFlattenException
{
private $message;
private $code;
@ -278,3 +279,35 @@ class FlattenException
return $array['__PHP_Incomplete_Class_Name'];
}
}
namespace Symfony\Component\HttpKernel\Exception;
use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
/**
* FlattenException wraps a PHP Exception to be able to serialize it.
*
* Basically, this class removes all objects from the trace.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
*/
class FlattenException
{
private $handler;
public static function __callStatic($method, $args)
{
return forward_static_call_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
}
public function __call($method, $args)
{
if (!isset($this->handler)) {
$this->handler = new DebugFlattenException();
}
return call_user_func_array(array($this->handler, $method), $args);
}
}

View File

@ -19,7 +19,7 @@
"php": ">=5.3.3"
},
"require-dev": {
"symfony/http-kernel": "~2.2",
"symfony/http-kernel": "~2.3,>=2.3.24",
"symfony/http-foundation": "~2.1"
},
"suggest": {

View File

@ -386,6 +386,9 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
* @param bool $virtual
*
* @throws BadMethodCallException
*
* @deprecated since version 2.3, to be removed in 3.0. Use
* {@link setInheritData()} instead.
*/
public function setVirtual($virtual)
{
@ -588,6 +591,9 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
* Unsupported method.
*
* @return bool Always returns false.
*
* @deprecated since version 2.3, to be removed in 3.0. Use
* {@link getInheritData()} instead.
*/
public function getVirtual()
{

View File

@ -13,6 +13,9 @@ namespace Symfony\Component\Form\Test;
use Symfony\Component\Form\FormEvent;
/**
* @deprecated since version 2.3, to be removed in 3.0.
*/
class DeprecationErrorHandler
{
public static function handle($errorNumber, $message, $file, $line, $context)

View File

@ -101,7 +101,10 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
abstract protected function renderForm(FormView $view, array $vars = array());
abstract protected function renderEnctype(FormView $view);
protected function renderEnctype(FormView $view)
{
$this->markTestSkipped(sprintf('Legacy %s::renderEnctype() is not implemented.', get_class($this)));
}
abstract protected function renderLabel(FormView $view, $label = null, array $vars = array());
@ -119,8 +122,10 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
abstract protected function setTheme(FormView $view, array $themes);
public function testEnctype()
public function testLegacyEnctype()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
$form = $this->factory->createNamedBuilder('name', 'form')
->add('file', 'file')
->getForm();
@ -128,8 +133,10 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
$this->assertEquals('enctype="multipart/form-data"', $this->renderEnctype($form->createView()));
}
public function testNoEnctype()
public function testLegacyNoEnctype()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
$form = $this->factory->createNamedBuilder('name', 'form')
->add('text', 'text')
->getForm();

View File

@ -15,14 +15,13 @@ use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestLis
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigBuilder;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\Test\DeprecationErrorHandler;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
class LegacyBindRequestListenerTest extends \PHPUnit_Framework_TestCase
{
private $values;
@ -37,6 +36,8 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
$path = tempnam(sys_get_temp_dir(), 'sf2');
touch($path);
@ -102,7 +103,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
$this->assertEquals(array(
'name' => 'Bernhard',
@ -129,7 +130,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
$this->assertEquals(array(
'name' => 'Bernhard',
@ -158,7 +159,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
// Default to empty array
$this->assertEquals(array(), $event->getData());
@ -184,7 +185,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
// Default to null
$this->assertNull($event->getData());
@ -207,7 +208,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
$this->assertEquals(array(
'name' => 'Bernhard',
@ -231,7 +232,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
$this->assertEquals(array(
'name' => 'Bernhard',
@ -257,7 +258,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
$this->assertEquals(array(), $event->getData());
}
@ -279,7 +280,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
$event = new FormEvent($form, $request);
$listener = new BindRequestListener();
DeprecationErrorHandler::preBind($listener, $event);
$listener->preBind($event);
$this->assertNull($event->getData());
}

View File

@ -6,7 +6,7 @@ CHANGELOG
* [BC BREAK] renamed `Symfony\Component\HttpKernel\EventListener\DeprecationLoggerListener` to `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener` and changed its constructor
* deprecated `Symfony\Component\HttpKernel\Debug\ErrorHandler`, `Symfony\Component\HttpKernel\Debug\ExceptionHandler`,
`Symfony\Component\HttpKernel\Exception\FatalErrorException`, and `Symfony\Component\HttpKernel\Exception\FlattenException`
`Symfony\Component\HttpKernel\Exception\FatalErrorException` and `Symfony\Component\HttpKernel\Exception\FlattenException`
* deprecated `Symfony\Component\HttpKernel\Kernel::init()``
* added the possibility to specify an id an extra attributes to hinclude tags
* added the collect of data if a controller is a Closure in the Request collector

View File

@ -11,9 +11,9 @@
namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\FlattenException;
/**
* ExceptionDataCollector.

View File

@ -11,8 +11,8 @@
namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;

View File

@ -12,7 +12,7 @@
namespace Symfony\Component\HttpKernel\EventListener;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;

View File

@ -12,11 +12,11 @@
namespace Symfony\Component\HttpKernel\EventListener;
use Psr\Log\LoggerInterface;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\HttpKernel\Exception;
use Symfony\Component\Debug\Exception\FatalErrorException as DebugFatalErrorException;
/**
* Fatal Error Exception.
*
@ -20,6 +18,4 @@ use Symfony\Component\Debug\Exception\FatalErrorException as DebugFatalErrorExce
*
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
*/
class FatalErrorException extends DebugFatalErrorException
{
}
class_exists('Symfony\Component\Debug\Exception\FatalErrorException');

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\HttpKernel\Exception;
use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
/**
* FlattenException wraps a PHP Exception to be able to serialize it.
*
@ -22,6 +20,4 @@ use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
*
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
*/
class FlattenException extends DebugFlattenException
{
}
class_exists('Symfony\Component\Debug\Exception\FlattenException');

View File

@ -76,10 +76,6 @@ class KernelForTest extends Kernel
{
}
public function init()
{
}
public function getBundles()
{
return array();

View File

@ -11,8 +11,8 @@
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

View File

@ -11,8 +11,8 @@
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector;
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

View File

@ -25,10 +25,6 @@ class KernelForTest extends Kernel
{
}
public function init()
{
}
public function registerBundleDirs()
{
}

View File

@ -19,7 +19,7 @@
"php": ">=5.3.3",
"symfony/event-dispatcher": "~2.1",
"symfony/http-foundation": "~2.3,>=2.3.4",
"symfony/debug": "~2.3",
"symfony/debug": "~2.3,>=2.3.24",
"psr/log": "~1.0"
},
"require-dev": {

View File

@ -1,6 +1,12 @@
CHANGELOG
=========
2.3.0
-----
The Locale component is deprecated since version 2.3 and will be removed in
Symfony 3.0. You should use the more capable Intl component instead.
2.1.0
-----

View File

@ -23,6 +23,8 @@ class LocaleTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
// Locale extends \Locale, so intl must be present
IntlTestHelper::requireIntl($this);
}

View File

@ -21,9 +21,10 @@ class StubLocaleTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
IntlTestHelper::requireIntl($this);
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
parent::setUp();
// Locale extends \Locale, so intl must be present
IntlTestHelper::requireIntl($this);
}
public function testGetCurrenciesData()

View File

@ -39,7 +39,7 @@ final class PropertyAccess
}
/**
* Alias of {@link getPropertyAccessor}.
* Alias of {@link createPropertyAccessor}.
*
* @return PropertyAccessor The new property accessor
*

View File

@ -28,7 +28,7 @@ class PropertyAccessor implements PropertyAccessorInterface
/**
* Should not be used by application code. Use
* {@link PropertyAccess::getPropertyAccessor()} instead.
* {@link PropertyAccess::createPropertyAccessor()} instead.
*/
public function __construct($magicCall = false)
{

View File

@ -25,7 +25,7 @@ interface PropertyAccessorInterface
*
* use Symfony\Component\PropertyAccess\PropertyAccess;
*
* $propertyAccessor = PropertyAccess::getPropertyAccessor();
* $propertyAccessor = PropertyAccess::createPropertyAccessor();
*
* echo $propertyAccessor->setValue($object, 'child.name', 'Fabien');
* // equals echo $object->getChild()->setName('Fabien');
@ -56,7 +56,7 @@ interface PropertyAccessorInterface
*
* use Symfony\Component\PropertyAccess\PropertyAccess;
*
* $propertyAccessor = PropertyAccess::getPropertyAccessor();
* $propertyAccessor = PropertyAccess::createPropertyAccessor();
*
* echo $propertyAccessor->getValue($object, 'child.name);
* // equals echo $object->getChild()->getName();

View File

@ -35,7 +35,6 @@ class RouteTest extends \PHPUnit_Framework_TestCase
public function getValidParameters()
{
return array(
array('value', '/Blog', 'getPattern'),
array('value', '/Blog', 'getPath'),
array('requirements', array('_method' => 'GET'), 'getRequirements'),
array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'),
@ -46,4 +45,12 @@ class RouteTest extends \PHPUnit_Framework_TestCase
array('host', array('{locale}.example.com'), 'getHost'),
);
}
public function testLegacyGetPattern()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
$route = new Route(array('value' => '/Blog'));
$this->assertEquals($route->getPattern(), '/Blog');
}
}

View File

@ -340,7 +340,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase
$subColl->add('bar', new Route('/bar'));
$subColl->addPrefix('/prefix');
// overwrite the pattern, so the prefix is not valid anymore for this route in the collection
$subColl->get('bar')->setPattern('/new');
$subColl->get('bar')->setPath('/new');
$coll->addCollection($subColl);

View File

@ -150,7 +150,7 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase
$collection2->add('bar', $bar = new Route('/bar'));
$collection->addCollection($collection2);
$collection->addPrefix(' / ');
$this->assertSame('/foo', $collection->get('foo')->getPattern(), '->addPrefix() trims the prefix and a single slash has no effect');
$this->assertSame('/foo', $collection->get('foo')->getPath(), '->addPrefix() trims the prefix and a single slash has no effect');
$collection->addPrefix('/{admin}', array('admin' => 'admin'), array('admin' => '\d+'));
$this->assertEquals('/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() adds a prefix to all routes');
$this->assertEquals('/{admin}/bar', $collection->get('bar')->getPath(), '->addPrefix() adds a prefix to all routes');
@ -159,7 +159,7 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array('admin' => '\d+'), $collection->get('foo')->getRequirements(), '->addPrefix() adds requirements to all routes');
$this->assertEquals(array('admin' => '\d+'), $collection->get('bar')->getRequirements(), '->addPrefix() adds requirements to all routes');
$collection->addPrefix('0');
$this->assertEquals('/0/{admin}/foo', $collection->get('foo')->getPattern(), '->addPrefix() ensures a prefix must start with a slash and must not end with a slash');
$this->assertEquals('/0/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() ensures a prefix must start with a slash and must not end with a slash');
$collection->addPrefix('/ /');
$this->assertSame('/ /0/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() can handle spaces if desired');
$this->assertSame('/ /0/{admin}/bar', $collection->get('bar')->getPath(), 'the route pattern of an added collection is in synch with the added prefix');

View File

@ -201,8 +201,10 @@ class RouteTest extends \PHPUnit_Framework_TestCase
$this->assertNotSame($compiled, $route->compile(), '->compile() recompiles if the route was modified');
}
public function testPattern()
public function testLegacyPattern()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
$route = new Route('/{foo}');
$this->assertEquals('/{foo}', $route->getPattern());

View File

@ -23,7 +23,7 @@
},
"require-dev": {
"symfony/form": "~2.0,>=2.0.5",
"symfony/locale": "~2.0,>=2.0.5",
"symfony/intl": "~2.3",
"symfony/routing": "~2.2",
"symfony/validator": "~2.2",
"doctrine/common": "~2.2",

View File

@ -159,7 +159,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
$translator = new Translator('fr', new MessageSelector());
$translator->addLoader('array', new ArrayLoader());
$translator->setFallbackLocale(array('en'));
$translator->setFallbackLocales(array('en'));
$translator->addResource('array', array('foo' => 'foofoo'), 'en');
$this->assertEquals('foofoo', $translator->trans('foo'));