diff --git a/Tests/Extractor/ApiDocExtratorTest.php b/Tests/Extractor/ApiDocExtratorTest.php index 81b437c..524c689 100644 --- a/Tests/Extractor/ApiDocExtratorTest.php +++ b/Tests/Extractor/ApiDocExtratorTest.php @@ -20,7 +20,7 @@ class ApiDocExtractorTest extends WebTestCase { $container = $this->getContainer(); $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle')); + set_error_handler(array($this, 'handleDeprecation')); $data = $extractor->all(); restore_error_handler(); diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php index 7196cb2..b46ba27 100644 --- a/Tests/Formatter/MarkdownFormatterTest.php +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -20,7 +20,7 @@ class MarkdownFormatterTest extends WebTestCase $container = $this->getContainer(); $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle')); + set_error_handler(array($this, 'handleDeprecation')); $data = $extractor->all(); restore_error_handler(); $result = $container->get('nelmio_api_doc.formatter.markdown_formatter')->format($data); diff --git a/Tests/Formatter/SimpleFormatterTest.php b/Tests/Formatter/SimpleFormatterTest.php index d1630dc..5b5aae1 100644 --- a/Tests/Formatter/SimpleFormatterTest.php +++ b/Tests/Formatter/SimpleFormatterTest.php @@ -20,7 +20,7 @@ class SimpleFormatterTest extends WebTestCase $container = $this->getContainer(); $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); - set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle')); + set_error_handler(array($this, 'handleDeprecation')); $data = $extractor->all(); restore_error_handler(); $result = $container->get('nelmio_api_doc.formatter.simple_formatter')->format($data); diff --git a/Tests/WebTestCase.php b/Tests/WebTestCase.php index dba3f87..f6387f3 100644 --- a/Tests/WebTestCase.php +++ b/Tests/WebTestCase.php @@ -27,6 +27,15 @@ abstract class WebTestCase extends BaseWebTestCase $fs->remove($dir); } + public static function handleDeprecation($errorNumber, $message, $file, $line, $context) + { + if ($errorNumber & E_USER_DEPRECATED) { + return true; + } + + return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line); + } + protected function getContainer(array $options = array()) { if (!static::$kernel) {