SHARE
TWEET

run.php

a guest Feb 13th, 2013 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. # Строка, выводимая при успешном выполнении теста.
  3. # Должна совпадать с аналогичной строкой из test.php.
  4. define('TEST_DONE_STR', 'TEST DONE');
  5.  
  6. define('TEST_PATH', dirname(__FILE__));
  7. define('CLI_PATH', 'sapi/cli/php');
  8.  
  9. # Ищем директории PHP в текущей папке
  10. $dirs = array();
  11. foreach(scandir('./') as $item) {
  12.     if(preg_match("#^php-#", $item) AND is_dir($item)) {
  13.         if(file_exists($item . "/sapi/cli/php"))
  14.             $dirs[] = $item;
  15.         else
  16.             print "$item - php-cli not found\n";
  17.     }
  18. }
  19.  
  20. # В каждой из них запускаем test.php
  21. foreach($dirs as $dir) {
  22.     $output = array();
  23.     exec(TEST_PATH . "/$dir/" . CLI_PATH . " " . TEST_PATH . "/test.php", $output);
  24.    
  25.     print "$dir - " . (implode("", $output) == TEST_DONE_STR ? "OK" : "FAILED") . "\n";
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top