runalltests.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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-2012 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 = `which phpunit`;
  28. $PHPUNIT = trim($PHPUNIT);
  29. }
  30. $PHPUNIT = trim($PHPUNIT);
  31. if (!$PHPUNIT) {
  32. echo "PHPUnit was not found on your OS!" . PHP_EOL;
  33. exit(1);
  34. }
  35. }
  36. if (!is_executable($PHPUNIT)) {
  37. echo "PHPUnit is not executable ($PHPUNIT)";
  38. }
  39. // locate all tests
  40. $files = glob('{Zend/*/AllTests.php,Zend/*Test.php}', GLOB_BRACE);
  41. sort($files);
  42. // run through phpunit
  43. while(list(, $file)=each($files)) {
  44. echo "Executing {$file}" . PHP_EOL;
  45. shell_exec($PHPUNIT . ' --stderr -d memory_limit=-1 -d error_reporting=E_ALL\&E_STRICT -d display_errors=1 ' . escapeshellarg($file));
  46. echo PHP_EOL;
  47. }
  48. exit(0);