PageRenderTime 49ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/Group-I/jobeet/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php

https://bitbucket.org/hosseinzolfi/db-lab-spring-2011/
PHP | 56 lines | 38 code | 9 blank | 9 comment | 2 complexity | 83beb17689020333c4c3c11063cd226b MD5 | raw file
Possible License(s): ISC, AGPL-3.0, LGPL-2.1, BSD-3-Clause, LGPL-3.0
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. include(dirname(__FILE__).'/../../../../../test/bootstrap/unit.php');
  10. if (!isset($root_dir))
  11. {
  12. $root_dir = realpath(dirname(__FILE__).sprintf('/../%s/fixtures', isset($type) ? $type : 'functional'));
  13. }
  14. include $root_dir.'/config/ProjectConfiguration.class.php';
  15. $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true);
  16. sfContext::createInstance($configuration);
  17. // remove all cache
  18. sf_functional_test_shutdown();
  19. register_shutdown_function('sf_functional_test_shutdown');
  20. $configuration->initializeDoctrine();
  21. if (isset($fixtures))
  22. {
  23. $configuration->loadFixtures($fixtures);
  24. }
  25. function sf_functional_test_shutdown_cleanup()
  26. {
  27. sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
  28. sfToolkit::clearDirectory(sfConfig::get('sf_log_dir'));
  29. $databases = glob(sfConfig::get('sf_data_dir') . '/*.sqlite');
  30. foreach ($databases as $database)
  31. {
  32. unlink($database);
  33. }
  34. }
  35. function sf_functional_test_shutdown()
  36. {
  37. // try/catch needed due to http://bugs.php.net/bug.php?id=33598
  38. try
  39. {
  40. sf_functional_test_shutdown_cleanup();
  41. }
  42. catch (Exception $e)
  43. {
  44. echo $e.PHP_EOL;
  45. }
  46. }
  47. return true;