AllTests.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'TestHelper.php';
  23. if (!defined('PHPUnit_MAIN_METHOD')) {
  24. define('PHPUnit_MAIN_METHOD', 'AllTests::main');
  25. }
  26. require_once 'Zend/AllTests.php';
  27. require_once 'resources/AllTests.php';
  28. /**
  29. * @category Zend
  30. * @package Zend
  31. * @subpackage UnitTests
  32. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class AllTests
  36. {
  37. public static function main()
  38. {
  39. $parameters = array();
  40. if (TESTS_GENERATE_REPORT && extension_loaded('xdebug')) {
  41. $parameters['reportDirectory'] = TESTS_GENERATE_REPORT_TARGET;
  42. }
  43. if (defined('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE') && TESTS_ZEND_LOCALE_FORMAT_SETLOCALE) {
  44. // run all tests in a special locale
  45. setlocale(LC_ALL, TESTS_ZEND_LOCALE_FORMAT_SETLOCALE);
  46. }
  47. // Run buffered tests as a separate suite first
  48. ob_start();
  49. PHPUnit_TextUI_TestRunner::run(self::suiteBuffered(), $parameters);
  50. if (ob_get_level()) {
  51. ob_end_flush();
  52. }
  53. PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
  54. }
  55. /**
  56. * Buffered test suites
  57. *
  58. * These tests require no output be sent prior to running as they rely
  59. * on internal PHP functions.
  60. *
  61. * @return PHPUnit_Framework_TestSuite
  62. */
  63. public static function suiteBuffered()
  64. {
  65. $suite = new PHPUnit_Framework_TestSuite('Zend Framework - Buffered');
  66. $suite->addTest(Zend_AllTests::suiteBuffered());
  67. return $suite;
  68. }
  69. /**
  70. * Regular suite
  71. *
  72. * All tests except those that require output buffering.
  73. *
  74. * @return PHPUnit_Framework_TestSuite
  75. */
  76. public static function suite()
  77. {
  78. $suite = new PHPUnit_Framework_TestSuite('Zend Framework');
  79. $suite->addTest(Zend_AllTests::suite());
  80. $suite->addTest(resources_AllTests::suite());
  81. return $suite;
  82. }
  83. }
  84. if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
  85. AllTests::main();
  86. }