runalltests.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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-2015 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. if ($_SERVER['TRAVIS_PHP_VERSION'] == '5.2') {
  43. //PHPUnit from git clone
  44. $PHPUNIT = 'php -d include_path=\'.:./phpunit/phpunit/:./phpunit/dbunit/:./phpunit/php-code-coverage/:./phpunit/php-file-iterator/:./phpunit/php-invoker/:./phpunit/php-text-template/:./phpunit/php-timer:./phpunit/php-token-stream:./phpunit/phpunit-mock-objects/:./phpunit/phpunit-selenium/:./phpunit/phpunit-story/:/usr/local/lib/php\' ./phpunit/phpunit/phpunit.php';
  45. } else {
  46. $PHPUNIT = '../bin/phpunit'; //PHPUnit from composer
  47. }
  48. // locate all tests
  49. $files = glob('{Zend/*/AllTests.php,Zend/*Test.php}', GLOB_BRACE);
  50. sort($files);
  51. // we'll capture the result of each phpunit execution in this value, so we'll know if something broke
  52. $result = 0;
  53. // run through phpunit
  54. foreach ($files as $file) {
  55. if ($_SERVER['TRAVIS_PHP_VERSION'] == 'hhvm' && $file == 'Zend/CodeGenerator/AllTests.php') {
  56. echo "Skipping $file on HHVM" . PHP_EOL; //gets stuck on the HHVM
  57. continue;
  58. }
  59. echo "Executing {$file}" . PHP_EOL;
  60. system($PHPUNIT . ' --stderr -d memory_limit=-1 -d error_reporting=E_ALL\&E_STRICT -d display_errors=1 ' . escapeshellarg($file), $c_result);
  61. echo PHP_EOL;
  62. echo "Finished executing {$file}" . PHP_EOL;
  63. if ($c_result) {
  64. echo PHP_EOL . "Result of $file is $c_result" . PHP_EOL . PHP_EOL;
  65. $result = $c_result;
  66. }
  67. }
  68. echo PHP_EOL . "All done. Result: $result" . PHP_EOL;
  69. exit($result);