runalltests.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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-2014 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. $PHPUNIT = null;
  23. if (!$PHPUNIT) {
  24. if (!$PHPUNIT && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
  25. $PHPUNIT = `for %i in (phpunit.bat) do @echo. %~\$PATH:i)`;
  26. } else {
  27. $PHPUNIT = trim(`echo \$PHPUNIT`);
  28. if ( empty($PHPUNIT) ) {
  29. $PHPUNIT = `which phpunit`;
  30. $PHPUNIT = trim($PHPUNIT);
  31. }
  32. }
  33. $PHPUNIT = trim($PHPUNIT);
  34. if (!$PHPUNIT) {
  35. echo "PHPUnit was not found on your OS!" . PHP_EOL;
  36. exit(1);
  37. }
  38. }
  39. if (!is_executable($PHPUNIT)) {
  40. echo "PHPUnit is not executable ($PHPUNIT)";
  41. }
  42. // locate all tests
  43. $files = glob('{Zend/*/AllTests.php,Zend/*Test.php}', GLOB_BRACE);
  44. sort($files);
  45. // we'll capture the result of each phpunit execution in this value, so we'll know if something broke
  46. $result = 0;
  47. // run through phpunit
  48. while(list(, $file)=each($files)) {
  49. echo "Executing {$file}" . PHP_EOL;
  50. system($PHPUNIT . ' --stderr -d memory_limit=-1 -d error_reporting=E_ALL\&E_STRICT -d display_errors=1 ' . escapeshellarg($file), $c_result);
  51. echo PHP_EOL;
  52. echo "Finished executing {$file}" . PHP_EOL;
  53. if ($c_result) {
  54. echo PHP_EOL . "Result of $file is $c_result" . PHP_EOL . PHP_EOL;
  55. $result = $c_result;
  56. }
  57. }
  58. exit($result);