コード例 #1
0
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
// Detect if we're loaded by an actual run of phpunit
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false)) {
    return;
}
// Enforce a consistent locale
setlocale(LC_ALL, 'C');
if (class_exists('Doctrine\\Common\\Annotations\\AnnotationRegistry')) {
    AnnotationRegistry::registerLoader('class_exists');
}
DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
コード例 #2
0
 private function registerDeprecationErrorHandler()
 {
     if (class_exists('\\Symfony\\Bridge\\PhpUnit\\DeprecationErrorHandler')) {
         // DeprecationErrorHandler only will be installed if array('PHPUnit_Util_ErrorHandler', 'handleError')
         // is installed or no other error handlers are installed.
         // So we will remove Symfony\Component\Debug\ErrorHandler if it's installed.
         $old = set_error_handler('var_dump');
         restore_error_handler();
         if ($old && is_array($old) && count($old) > 0 && is_object($old[0]) && get_class($old[0]) === 'Symfony\\Component\\Debug\\ErrorHandler') {
             restore_error_handler();
         }
         $this->deprecationsInstalled = true;
         \Symfony\Bridge\PhpUnit\DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
     }
 }