|  | 
| 10 | 10 | 
 | 
| 11 | 11 | use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; | 
| 12 | 12 | 
 | 
| 13 |  | -// setup expected test environment (per check_configuration.php) | 
| 14 |  | -ini_set('magic_quotes_runtime', 'off'); | 
| 15 |  | -ini_set('session.auto_start', 'off'); | 
| 16 |  | -ini_set('arg_separator.output', '&'); | 
| 17 |  | -ini_set('allow_url_fopen', 'on'); | 
| 18 |  | - | 
| 19 |  | -require_once __DIR__.'/../vendor/autoload.php'; | 
| 20 |  | - | 
| 21 |  | -$libDir = realpath(__DIR__.'/../lib'); | 
| 22 |  | - | 
| 23 |  | -require_once __DIR__.'/../lib/config/sfConfig.class.php'; | 
| 24 |  | -sfConfig::set('sf_symfony_lib_dir', $libDir); | 
| 25 |  | - | 
| 26 |  | -require_once $libDir.'/autoload/sfCoreAutoload.class.php'; | 
| 27 |  | -sfCoreAutoload::register(); | 
| 28 |  | - | 
| 29 |  | -require_once $libDir.'/util/sfToolkit.class.php'; | 
| 30 |  | -sfConfig::set('sf_test_cache_dir', sys_get_temp_dir().'/sf_test_project'); | 
| 31 |  | - | 
| 32 |  | -// TODO enable later require_once __DIR__.'/fixtures/symfony/config/ProjectConfiguration.class.php'; | 
| 33 |  | - | 
| 34 |  | -// remove all test cache | 
| 35 |  | -sf_unit_test_shutdown(); | 
| 36 |  | - | 
| 37 |  | -// create test cache dir | 
| 38 |  | -$sf_root_dir = sys_get_temp_dir().'/sf_test_project'; | 
| 39 |  | -@mkdir($sf_root_dir, 0777, true); | 
| 40 |  | - | 
| 41 |  | -register_shutdown_function('sf_unit_test_shutdown'); | 
| 42 |  | - | 
| 43 |  | -function sf_unit_test_shutdown() | 
| 44 |  | -{ | 
| 45 |  | -    $sf_root_dir = sys_get_temp_dir().'/sf_test_project'; | 
| 46 |  | -    if (is_dir($sf_root_dir)) { | 
| 47 |  | -        sfToolkit::clearDirectory($sf_root_dir); | 
| 48 |  | -        @rmdir($sf_root_dir); | 
| 49 |  | -    } | 
| 50 |  | - | 
| 51 |  | -    $sessions = glob(sys_get_temp_dir().'/sessions*'); | 
| 52 |  | -    $tmp_files = glob(sys_get_temp_dir().'/sf*'); | 
| 53 |  | - | 
| 54 |  | -    $files = array_merge(empty($sessions) ? array() : $sessions, empty($tmp_files) ? array() : $tmp_files); | 
| 55 |  | -    foreach ($files as $file) { | 
| 56 |  | -        if (is_dir($file)) { | 
| 57 |  | -            sfToolkit::clearDirectory($file); | 
| 58 |  | -            @rmdir($file); | 
| 59 |  | -        } else { | 
| 60 |  | -            @unlink($file); | 
| 61 |  | -        } | 
| 62 |  | -    } | 
| 63 |  | -} | 
| 64 |  | - | 
| 65 |  | -// Helper for cross platform testcases that validate output | 
| 66 |  | -function fix_linebreaks($content) | 
| 67 |  | -{ | 
| 68 |  | -    return str_replace(array("\r\n", "\n", "\r"), "\n", $content); | 
| 69 |  | -} | 
| 70 |  | - | 
| 71 | 13 | if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) { | 
| 72 | 14 |     DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER')); | 
| 73 | 15 | } | 
0 commit comments