예제 #1
0
<?php

/*
 * This file is part of the Lime framework.
 *
 * (c) Fabien Potencier <*****@*****.**>
 * (c) Bernhard Schussek <*****@*****.**>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
LimeAnnotationSupport::enable();
$t = new LimeTest();
// @Before
$executable = new LimeExecutable(LimeExecutable::php() . ' %file%');
$file = tempnam(sys_get_temp_dir(), 'lime');
$output = $t->mock('LimeOutputInterface');
$input = new LimeInputTap($output);
// @After
$file = null;
$output = null;
$input = null;
// @Test: Successful tests are passed to pass()
// fixtures
$output->pass('A passed test', '', 0, '', '');
$output->replay();
// test
$input->parse("ok 1 - A passed test\n");
// assertions
$t->ok($input->done(), 'The input is done');
// @Test: Successful tests without message are passed to pass()
예제 #2
0
 *     ...
 *   }
 *
 *   $config->registerCallback('read_test_files', $lime);
 *
 * All register*() methods accept an optional parameter which either accepts
 * a single label or an array with multiple labels tjat will be added to all
 * matched files. If a file is matched twice by separate register*() calls,
 * it will have the labels of both calls.
 *
 * Examples:
 *
 *   $config->registerDir('path/to/dir', $lime, 'label');
 *   $config->registerDir('path/to/dir', $lime, array('unit', 'slow'));
 */
$lime = LimeExecutable::php('lime', 'raw', array('--output' => 'raw'));
$config->registerDir('test', $lime);
/*
 * Sets whether legacy classes like lime_test etc. should be loaded.
 */
$config->setLegacyMode(false);
/*
 * Sets whether annotation support should be enabled by default.
 */
$config->setAnnotationSupport(true);
/*
 * If you set verbose to true, some test outputs will output additional
 * information. Only supported by some outputs.
 */
$config->setVerbose(false);
/*
예제 #3
0
 *   }
 *
 *   $config->registerCallback('read_test_files');
 *
 * All register*() methods accept an optional parameter which either accepts
 * a single label or an array with multiple labels tjat will be added to all
 * matched files. If a file is matched twice by separate register*() calls,
 * it will have the labels of both calls.
 *
 * Examples:
 *
 *   $config->registerDir('path/to/dir', 'label');
 *   $config->registerDir('path/to/dir', array('unit', 'slow'));
 */
$lime = LimeExecutable::php('lime', 'raw', array('--output' => 'raw'));
$phpt = LimeExecutable::shell(null, 'tap');
$config->registerGlob('test/unit/*Test.php', $lime);
$config->registerGlob('test/unit/*/*Test.php', $lime);
$config->registerFile('test/bin/prove.sh', $phpt);
/*
 * If you set verbose to true, some test outputs will output additional
 * information. Only supported by some outputs.
 */
$config->setVerbose(false);
/*
 * Enforces colorization in the console output. Only supported by some
 * outputs.
 */
$config->setForceColors(false);
/*
 * Enforces serialization of the output. Only supported by some outputs.
예제 #4
0
 *     ...
 *   }
 *
 *   $config->registerCallback('read_test_files');
 *
 * All register*() methods accept an optional parameter which either accepts
 * a single label or an array with multiple labels tjat will be added to all
 * matched files. If a file is matched twice by separate register*() calls,
 * it will have the labels of both calls.
 *
 * Examples:
 *
 *   $config->registerDir('path/to/dir', 'label');
 *   $config->registerDir('path/to/dir', array('unit', 'slow'));
 */
$lime = new LimeExecutable(LimeExecutable::php() . ' lime --output=raw --test=%file%', 'raw');
$config->registerGlob('test/unit/*Test.php', $lime);
$config->registerGlob('test/unit/*/*Test.php', $lime);
/*
 * Sets whether legacy classes like lime_test etc. should be loaded.
 */
$config->setLegacyMode(false);
/*
 * Sets whether annotation support should be enabled by default.
 */
$config->setAnnotationSupport(false);
/*
 * If you set verbose to true, some test outputs will output additional
 * information. Only supported by some outputs.
 */
$config->setVerbose(false);
예제 #5
0
 /**
  * Tries to find the system's PHP command and returns it.
  *
  * @return string
  */
 public static function php()
 {
     if (is_null(self::$php)) {
         if (getenv('PHP_PATH')) {
             self::$command = getenv('PHP_PATH');
             if (!is_executable(self::$php)) {
                 throw new Exception('The defined PHP_PATH environment variable is not a valid PHP command.');
             }
         } else {
             self::$php = PHP_BINDIR . DIRECTORY_SEPARATOR . 'php';
         }
     }
     if (!is_executable(self::$php)) {
         $path = getenv('PATH') ? getenv('PATH') : getenv('Path');
         $extensions = DIRECTORY_SEPARATOR == '\\' ? getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com') : array('');
         foreach (array('php5', 'php') as $command) {
             foreach ($extensions as $extension) {
                 foreach (explode(PATH_SEPARATOR, $path) as $dir) {
                     $file = $dir . DIRECTORY_SEPARATOR . $command . $extension;
                     if (is_executable($file)) {
                         self::$php = $file;
                         break 3;
                     }
                 }
             }
         }
         if (!is_executable(self::$php)) {
             throw new Exception("Unable to find PHP command.");
         }
     }
     return self::$php;
 }