minor #13758 [PhpUnitBridge] Tweak and fix deprecation notices (nicolas-grekas)
This PR was merged into the 2.7 branch.
Discussion
----------
[PhpUnitBridge] Tweak and fix deprecation notices
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
4ef3610
[PhpUnitBridge] Tweak and fix deprecation notices
This commit is contained in:
commit
4fd9792d02
@ -7,7 +7,7 @@ matrix:
|
|||||||
- php: 5.5
|
- php: 5.5
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
- php: 5.3
|
- php: 5.3
|
||||||
env: components=low SYMFONY_DEPRECATIONS_HELPER=weak
|
env: components=low
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: components=high
|
env: components=high
|
||||||
- php: hhvm-nightly
|
- php: hhvm-nightly
|
||||||
@ -41,5 +41,6 @@ install:
|
|||||||
script:
|
script:
|
||||||
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||||
- if [ "$components" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
|
- if [ "$components" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
|
||||||
|
- if [ "$components" != "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi;
|
||||||
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data,legacy || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data,legacy || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||||
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||||
|
@ -20,7 +20,7 @@ class DeprecationErrorHandler
|
|||||||
{
|
{
|
||||||
private static $isRegistered = false;
|
private static $isRegistered = false;
|
||||||
|
|
||||||
public static function register($strict = false)
|
public static function register($mode = false)
|
||||||
{
|
{
|
||||||
if (self::$isRegistered) {
|
if (self::$isRegistered) {
|
||||||
return;
|
return;
|
||||||
@ -33,7 +33,7 @@ class DeprecationErrorHandler
|
|||||||
'legacy' => array(),
|
'legacy' => array(),
|
||||||
'other' => array(),
|
'other' => array(),
|
||||||
);
|
);
|
||||||
$deprecationHandler = function ($type, $msg, $file, $line, $context) use (&$deprecations, $strict) {
|
$deprecationHandler = function ($type, $msg, $file, $line, $context) use (&$deprecations) {
|
||||||
if (E_USER_DEPRECATED !== $type) {
|
if (E_USER_DEPRECATED !== $type) {
|
||||||
return \PHPUnit_Util_ErrorHandler::handleError($type, $msg, $file, $line, $context);
|
return \PHPUnit_Util_ErrorHandler::handleError($type, $msg, $file, $line, $context);
|
||||||
}
|
}
|
||||||
@ -66,21 +66,6 @@ class DeprecationErrorHandler
|
|||||||
++$ref;
|
++$ref;
|
||||||
}
|
}
|
||||||
++$deprecations[$group.'Count'];
|
++$deprecations[$group.'Count'];
|
||||||
unset($trace, $ref);
|
|
||||||
|
|
||||||
if ('legacy' !== $group) {
|
|
||||||
try {
|
|
||||||
$e = $strict ? error_reporting(-1) : error_reporting();
|
|
||||||
$result = \PHPUnit_Util_ErrorHandler::handleError($type, $msg, $file, $line, $context);
|
|
||||||
error_reporting($e);
|
|
||||||
} catch (\Exception $x) {
|
|
||||||
error_reporting($e);
|
|
||||||
|
|
||||||
throw $x;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
$oldErrorHandler = set_error_handler($deprecationHandler);
|
$oldErrorHandler = set_error_handler($deprecationHandler);
|
||||||
|
|
||||||
@ -88,7 +73,7 @@ class DeprecationErrorHandler
|
|||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
if (array('PHPUnit_Util_ErrorHandler', 'handleError') === $oldErrorHandler) {
|
if (array('PHPUnit_Util_ErrorHandler', 'handleError') === $oldErrorHandler) {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
self::register();
|
self::register($mode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self::$isRegistered = true;
|
self::$isRegistered = true;
|
||||||
@ -101,7 +86,7 @@ class DeprecationErrorHandler
|
|||||||
} else {
|
} else {
|
||||||
$colorize = function ($str) {return $str;};
|
$colorize = function ($str) {return $str;};
|
||||||
}
|
}
|
||||||
register_shutdown_function(function () use (&$deprecations, $deprecationHandler, $colorize) {
|
register_shutdown_function(function () use ($mode, &$deprecations, $deprecationHandler, $colorize) {
|
||||||
$currErrorHandler = set_error_handler('var_dump');
|
$currErrorHandler = set_error_handler('var_dump');
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
@ -135,6 +120,14 @@ class DeprecationErrorHandler
|
|||||||
if (!empty($notices)) {
|
if (!empty($notices)) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
if ('weak' !== $mode) {
|
||||||
|
if ($deprecations['remaining'] || $deprecations['other']) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ('strict' === $mode && $deprecations['legacy'] && $deprecations['legacyCount'] !== $ref =& $deprecations['legacy']['Silenced']['count']) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,19 +12,19 @@ It comes with the following features:
|
|||||||
Handling user deprecation notices is sensitive to the SYMFONY_DEPRECATIONS_HELPER
|
Handling user deprecation notices is sensitive to the SYMFONY_DEPRECATIONS_HELPER
|
||||||
environment variable. This env var configures 3 behaviors depending on its value:
|
environment variable. This env var configures 3 behaviors depending on its value:
|
||||||
|
|
||||||
* when set to `strict`, all but legacy-tagged deprecation notices will make tests
|
* when set to `strict`, all but silenced-legacy-tagged deprecation notices will
|
||||||
fail. This is the recommended mode for best forward compatibility.
|
make tests fail. This is the recommended mode for best forward compatibility
|
||||||
* `weak` on the contrary will make tests ignore all deprecation notices.
|
* `weak` on the contrary will make tests ignore all deprecation notices.
|
||||||
This is the recommended mode for legacy projects that must use deprecated
|
This is the recommended mode for legacy projects that must use deprecated
|
||||||
interfaces for backward compatibility reasons.
|
interfaces for backward compatibility reasons.
|
||||||
* any other value will respect the current error reporting level.
|
* with any other value, all but silenced-or-not-legacy-tagged deprecation
|
||||||
|
notices will make tests fail.
|
||||||
|
|
||||||
All three modes will display a summary of deprecation notices at the end of the
|
All three modes will display a summary of deprecation notices at the end of the
|
||||||
test suite, split in two groups:
|
test suite, split in two groups:
|
||||||
|
|
||||||
* **Legacy** deprecation notices denote tests that explicitly test some legacy
|
* **Legacy** deprecation notices denote tests that explicitly test some legacy
|
||||||
interfaces. In all 3 modes, deprecation notices triggered in a legacy-tagged
|
interfaces. There are four ways to mark a test as legacy:
|
||||||
test do never make a test fail. There are four ways to mark a test as legacy:
|
|
||||||
- make its class start with the `Legacy` prefix;
|
- make its class start with the `Legacy` prefix;
|
||||||
- make its method start with `testLegacy`;
|
- make its method start with `testLegacy`;
|
||||||
- make its data provider start with `provideLegacy` or `getLegacy`;
|
- make its data provider start with `provideLegacy` or `getLegacy`;
|
||||||
|
@ -17,15 +17,4 @@ if (class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
|
|||||||
AnnotationRegistry::registerLoader('class_exists');
|
AnnotationRegistry::registerLoader('class_exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (getenv('SYMFONY_DEPRECATIONS_HELPER')) {
|
DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
|
||||||
case 'strict':
|
|
||||||
DeprecationErrorHandler::register(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'weak':
|
|
||||||
error_reporting(error_reporting() & ~E_USER_DEPRECATED);
|
|
||||||
// No break;
|
|
||||||
default:
|
|
||||||
DeprecationErrorHandler::register(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.9"
|
"php": ">=5.3.9"
|
||||||
},
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [ "bootstrap.php" ],
|
"files": [ "bootstrap.php" ],
|
||||||
"psr-0": { "Symfony\\Bridge\\PhpUnit\\": "" }
|
"psr-0": { "Symfony\\Bridge\\PhpUnit\\": "" }
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/phpunit-bridge": "~2.7|~3.0.0",
|
"symfony/phpunit-bridge": "~2.7|~3.0.0",
|
||||||
|
"symfony/asset": "~2.7|~3.0.0",
|
||||||
"symfony/finder": "~2.3|~3.0.0",
|
"symfony/finder": "~2.3|~3.0.0",
|
||||||
"symfony/form": "~2.6|~3.0.0",
|
"symfony/form": "~2.6|~3.0.0",
|
||||||
"symfony/http-kernel": "~2.3|~3.0.0",
|
"symfony/http-kernel": "~2.3|~3.0.0",
|
||||||
|
@ -18,6 +18,11 @@ use Symfony\Component\DependencyInjection\Reference;
|
|||||||
|
|
||||||
class LegacyTemplatingAssetHelperPassTest extends \PHPUnit_Framework_TestCase
|
class LegacyTemplatingAssetHelperPassTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
|
|
||||||
public function getScopesTests()
|
public function getScopesTests()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
@ -90,8 +90,10 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||||
* @expectedExceptionMessage You cannot use assets settings under "framework.templating" and "assets" configurations in the same project.
|
* @expectedExceptionMessage You cannot use assets settings under "framework.templating" and "assets" configurations in the same project.
|
||||||
*/
|
*/
|
||||||
public function testInvalidValueAssets()
|
public function testLegacyInvalidValueAssets()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
$configuration = new Configuration(true);
|
$configuration = new Configuration(true);
|
||||||
$processor->processConfiguration($configuration, array(
|
$processor->processConfiguration($configuration, array(
|
||||||
|
@ -471,6 +471,8 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
|
|
||||||
public function testLegacyFormCsrfFieldNameUnderFormSettingsTakesPrecedence()
|
public function testLegacyFormCsrfFieldNameUnderFormSettingsTakesPrecedence()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$container = $this->createContainerFromFile('form_csrf_under_form_sets_field_name');
|
$container = $this->createContainerFromFile('form_csrf_under_form_sets_field_name');
|
||||||
|
|
||||||
$this->assertTrue($container->getParameter('form.type_extension.csrf.enabled'));
|
$this->assertTrue($container->getParameter('form.type_extension.csrf.enabled'));
|
||||||
|
@ -15,10 +15,18 @@ use Symfony\Bundle\TwigBundle\Extension\AssetsExtension;
|
|||||||
use Symfony\Bundle\TwigBundle\Tests\TestCase;
|
use Symfony\Bundle\TwigBundle\Tests\TestCase;
|
||||||
use Symfony\Component\Routing\RequestContext;
|
use Symfony\Component\Routing\RequestContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
class LegacyAssetsExtensionTest extends TestCase
|
class LegacyAssetsExtensionTest extends TestCase
|
||||||
{
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideGetGetAssetUrlArguments
|
* @dataProvider provideGetAssetUrlArguments
|
||||||
*/
|
*/
|
||||||
public function testGetAssetUrl($path, $packageName, $absolute, $relativeUrl, $expectedUrl, $scheme, $host, $httpPort, $httpsPort)
|
public function testGetAssetUrl($path, $packageName, $absolute, $relativeUrl, $expectedUrl, $scheme, $host, $httpPort, $httpsPort)
|
||||||
{
|
{
|
||||||
@ -46,7 +54,7 @@ class LegacyAssetsExtensionTest extends TestCase
|
|||||||
$this->assertEquals($relativeUrl, $extension->getAssetUrl($path, $packageName, true));
|
$this->assertEquals($relativeUrl, $extension->getAssetUrl($path, $packageName, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideGetGetAssetUrlArguments()
|
public function provideGetAssetUrlArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('/path/to/asset', 'package-name', false, '/bundle-name/path/to/asset', '/bundle-name/path/to/asset', 'http', 'symfony.com', 80, null),
|
array('/path/to/asset', 'package-name', false, '/bundle-name/path/to/asset', '/bundle-name/path/to/asset', 'http', 'symfony.com', 80, null),
|
||||||
|
@ -35,12 +35,11 @@ class ClassNotFoundFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @group legacy
|
||||||
* @dataProvider provideLegacyClassNotFoundData
|
* @dataProvider provideLegacyClassNotFoundData
|
||||||
*/
|
*/
|
||||||
public function testLegacyHandleClassNotFound($error, $translatedMessage, $autoloader)
|
public function testLegacyHandleClassNotFound($error, $translatedMessage, $autoloader)
|
||||||
{
|
{
|
||||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
// Unregister all autoloaders to ensure the custom provided
|
// Unregister all autoloaders to ensure the custom provided
|
||||||
// autoloader is the only one to be used during the test run.
|
// autoloader is the only one to be used during the test run.
|
||||||
$autoloaders = spl_autoload_functions();
|
$autoloaders = spl_autoload_functions();
|
||||||
@ -114,13 +113,19 @@ class ClassNotFoundFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function provideLegacyClassNotFoundData()
|
public function provideLegacyClassNotFoundData()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$prefixes = array('Symfony\Component\Debug\Exception\\' => realpath(__DIR__.'/../../Exception'));
|
$prefixes = array('Symfony\Component\Debug\Exception\\' => realpath(__DIR__.'/../../Exception'));
|
||||||
|
|
||||||
$symfonyAutoloader = new SymfonyClassLoader();
|
$symfonyAutoloader = new SymfonyClassLoader();
|
||||||
$symfonyAutoloader->addPrefixes($prefixes);
|
$symfonyAutoloader->addPrefixes($prefixes);
|
||||||
|
|
||||||
$symfonyUniversalClassLoader = new SymfonyUniversalClassLoader();
|
if (class_exists('Symfony\Component\ClassLoader\UniversalClassLoader')) {
|
||||||
$symfonyUniversalClassLoader->registerPrefixes($prefixes);
|
$symfonyUniversalClassLoader = new SymfonyUniversalClassLoader();
|
||||||
|
$symfonyUniversalClassLoader->registerPrefixes($prefixes);
|
||||||
|
} else {
|
||||||
|
$symfonyUniversalClassLoader = $symfonyAutoloader;
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
@ -25,6 +25,8 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testLegacyDump()
|
public function testLegacyDump()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$container = include self::$fixturesPath.'/containers/legacy-container9.php';
|
$container = include self::$fixturesPath.'/containers/legacy-container9.php';
|
||||||
$dumper = new GraphvizDumper($container);
|
$dumper = new GraphvizDumper($container);
|
||||||
$this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/legacy-services9.dot')), $dumper->dump(), '->dump() dumps services');
|
$this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/legacy-services9.dot')), $dumper->dump(), '->dump() dumps services');
|
||||||
|
@ -15,6 +15,11 @@ use Symfony\Component\DependencyInjection\Definition;
|
|||||||
|
|
||||||
class LegacyDefinitionTest extends \PHPUnit_Framework_TestCase
|
class LegacyDefinitionTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetGetFactoryClass()
|
public function testSetGetFactoryClass()
|
||||||
{
|
{
|
||||||
$def = new Definition('stdClass');
|
$def = new Definition('stdClass');
|
||||||
|
@ -122,6 +122,8 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testLegacyLoadServices()
|
public function testLegacyLoadServices()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
|
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
|
||||||
$loader->load('legacy-services6.yml');
|
$loader->load('legacy-services6.yml');
|
||||||
|
@ -188,6 +188,8 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
// BC with Symfony < 2.4
|
// BC with Symfony < 2.4
|
||||||
public function testLegacySingleMethodBc()
|
public function testLegacySingleMethodBc()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$object = new CallbackValidatorTest_Object();
|
$object = new CallbackValidatorTest_Object();
|
||||||
$constraint = new Callback(array('validate'));
|
$constraint = new Callback(array('validate'));
|
||||||
|
|
||||||
@ -201,6 +203,8 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
// BC with Symfony < 2.4
|
// BC with Symfony < 2.4
|
||||||
public function testLegacySingleMethodBcExplicitName()
|
public function testLegacySingleMethodBcExplicitName()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$object = new CallbackValidatorTest_Object();
|
$object = new CallbackValidatorTest_Object();
|
||||||
$constraint = new Callback(array('methods' => array('validate')));
|
$constraint = new Callback(array('methods' => array('validate')));
|
||||||
|
|
||||||
@ -214,6 +218,8 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
// BC with Symfony < 2.4
|
// BC with Symfony < 2.4
|
||||||
public function testLegacyMultipleMethodsBc()
|
public function testLegacyMultipleMethodsBc()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$object = new CallbackValidatorTest_Object();
|
$object = new CallbackValidatorTest_Object();
|
||||||
$constraint = new Callback(array('validate', 'validateStatic'));
|
$constraint = new Callback(array('validate', 'validateStatic'));
|
||||||
|
|
||||||
@ -229,6 +235,8 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
// BC with Symfony < 2.4
|
// BC with Symfony < 2.4
|
||||||
public function testLegacyMultipleMethodsBcExplicitName()
|
public function testLegacyMultipleMethodsBcExplicitName()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$object = new CallbackValidatorTest_Object();
|
$object = new CallbackValidatorTest_Object();
|
||||||
$constraint = new Callback(array(
|
$constraint = new Callback(array(
|
||||||
'methods' => array('validate', 'validateStatic'),
|
'methods' => array('validate', 'validateStatic'),
|
||||||
@ -246,6 +254,8 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
// BC with Symfony < 2.4
|
// BC with Symfony < 2.4
|
||||||
public function testLegacySingleStaticMethodBc()
|
public function testLegacySingleStaticMethodBc()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$object = new CallbackValidatorTest_Object();
|
$object = new CallbackValidatorTest_Object();
|
||||||
$constraint = new Callback(array(
|
$constraint = new Callback(array(
|
||||||
array(__CLASS__.'_Class', 'validateCallback'),
|
array(__CLASS__.'_Class', 'validateCallback'),
|
||||||
@ -261,6 +271,8 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
// BC with Symfony < 2.4
|
// BC with Symfony < 2.4
|
||||||
public function testLegacySingleStaticMethodBcExplicitName()
|
public function testLegacySingleStaticMethodBcExplicitName()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$object = new CallbackValidatorTest_Object();
|
$object = new CallbackValidatorTest_Object();
|
||||||
$constraint = new Callback(array(
|
$constraint = new Callback(array(
|
||||||
'methods' => array(array(__CLASS__.'_Class', 'validateCallback')),
|
'methods' => array(array(__CLASS__.'_Class', 'validateCallback')),
|
||||||
@ -298,6 +310,8 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
*/
|
*/
|
||||||
public function testLegacyExpectEitherCallbackOrMethods()
|
public function testLegacyExpectEitherCallbackOrMethods()
|
||||||
{
|
{
|
||||||
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
$object = new CallbackValidatorTest_Object();
|
$object = new CallbackValidatorTest_Object();
|
||||||
|
|
||||||
$this->validator->validate($object, new Callback(array(
|
$this->validator->validate($object, new Callback(array(
|
||||||
|
Reference in New Issue
Block a user