Author: bschussek
Date: 2010-02-18 17:46:32 +0100 (Thu, 18 Feb 2010)
New Revision: 28111

Added:
   tools/lime/branches/2.0/lib/LimeCommand.php
   tools/lime/branches/2.0/lib/LimeExecutable.php
   tools/lime/branches/2.0/lib/LimeProcess.php
   tools/lime/branches/2.0/lib/parser/LimeParserFactory.php
   tools/lime/branches/2.0/lib/parser/LimeParserFactoryInterface.php
   tools/lime/branches/2.0/test/unit/LimeCommandTest.php
   tools/lime/branches/2.0/test/unit/LimeProcessTest.php
Removed:
   tools/lime/branches/2.0/lib/shell/
   tools/lime/branches/2.0/test/unit/shell/
Modified:
   tools/lime/branches/2.0/data/skeleton/lime.config.php
   tools/lime/branches/2.0/lib/LimeCli.php
   tools/lime/branches/2.0/lib/LimeConfiguration.php
   tools/lime/branches/2.0/lib/LimeCoverage.php
   tools/lime/branches/2.0/lib/LimeFile.php
   tools/lime/branches/2.0/lib/LimeHarness.php
   tools/lime/branches/2.0/lib/LimeLabel.php
   tools/lime/branches/2.0/lib/LimeLauncher.php
   tools/lime/branches/2.0/lib/LimeLoader.php
   tools/lime/branches/2.0/lib/LimeTest.php
   tools/lime/branches/2.0/lib/output/LimeOutputFactory.php
   tools/lime/branches/2.0/lib/output/LimeOutputFactoryInterface.php
   tools/lime/branches/2.0/lib/output/LimeOutputRaw.php
   tools/lime/branches/2.0/lib/parser/LimeParserRaw.php
   tools/lime/branches/2.0/lime.config.php
   tools/lime/branches/2.0/test/bin/benchmark.php
   tools/lime/branches/2.0/test/unit/LimeAnnotationSupportTest.php
   tools/lime/branches/2.0/test/unit/LimeLabelTest.php
   tools/lime/branches/2.0/test/unit/LimeLauncherTest.php
   tools/lime/branches/2.0/test/unit/output/LimeOutputRawTest.php
   tools/lime/branches/2.0/test/unit/output/LimeOutputSuiteTest.php
   tools/lime/branches/2.0/test/unit/parser/LimeParserRawTest.php
   tools/lime/branches/2.0/test/unit/parser/LimeParserTapTest.php
Log:
Added the new class LimeExecutable which allows to add any test files to the 
harness (f.i. PHPT)

Modified: tools/lime/branches/2.0/data/skeleton/lime.config.php
===================================================================
--- tools/lime/branches/2.0/data/skeleton/lime.config.php       2010-02-18 
11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/data/skeleton/lime.config.php       2010-02-18 
16:46:32 UTC (rev 28111)
@@ -14,20 +14,24 @@
  * Register your test files here. The file paths can be absolute or relative to
  * the configured base directory.
  *
+ * Each test file or bunch of test files needs an executable used to
+ * execute the test files. Read the documentation of LimeExecutable for more
+ * information. The default executable $lime is provided in this script.
+ *
  * Examples:
  *
  * Registers the file MyClassTest.php:
  *
- *   $config->registerFile('test/MyClassTest.php');
+ *   $config->registerFile('test/MyClassTest.php', $lime);
  *
  * Registers all files in a specific directory with the configured suffix
  * (see below):
  *
- *   $config->registerDir('path/to/dir');
+ *   $config->registerDir('path/to/dir', $lime);
  *
  * Registers all files matched by the given glob:
  *
- *   $config->registerGlob('test/*.test.php');
+ *   $config->registerGlob('test/*.test.php', $lime);
  *
  * Registers all file paths returned by the given callback:
  *
@@ -36,7 +40,7 @@
  *     ...
  *   }
  *
- *   $config->registerCallback('read_test_files');
+ *   $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
@@ -45,12 +49,14 @@
  *
  * Examples:
  *
- *   $config->registerDir('path/to/dir', 'label');
- *   $config->registerDir('path/to/dir', array('unit', 'slow'));
+ *   $config->registerDir('path/to/dir', $lime, 'label');
+ *   $config->registerDir('path/to/dir', $lime, array('unit', 'slow'));
  */
 
-//$config->registerDir('test');
+$lime = LimeExecutable::php('lime', 'raw', array('--output' => 'raw'));
 
+//$config->registerDir('test', $lime);
+
 /*
  * Sets the directory where the registered files are searched for.
  */

Modified: tools/lime/branches/2.0/lib/LimeCli.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeCli.php     2010-02-18 11:12:08 UTC (rev 
28110)
+++ tools/lime/branches/2.0/lib/LimeCli.php     2010-02-18 16:46:32 UTC (rev 
28111)
@@ -17,7 +17,7 @@
  */
 class LimeCli
 {
-  private static $allowedOptions = array(
+  protected static $allowedOptions = array(
     'help',
     'init',
     'processes',
@@ -38,7 +38,7 @@
   {
     try
     {
-      list($options, $labels) = LimeShell::parseArguments($arguments);
+      list($options, $labels) = $this->parseArguments($arguments);
 
       if ($diff = array_diff(array_keys($options), self::$allowedOptions))
       {
@@ -71,7 +71,7 @@
    *
    * @return integer  The return value of the command (0 if successful)
    */
-  private function usage(array $options)
+  protected function usage(array $options)
   {
     echo <<<EOF
 Command line utility for the Lime 2 test framework.
@@ -150,7 +150,7 @@
    *
    * @return integer  The return value of the command (0 if successful)
    */
-  private function init(array $options)
+  protected function init(array $options)
   {
     $limeDir = realpath(dirname(__FILE__).'/..');
     $skeletonDir = 
$limeDir.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'skeleton';
@@ -186,7 +186,7 @@
    * @param  array $labels  The label names
    * @return integer        The return value of the command (0 if successful)
    */
-  private function test(array $labels, array $options)
+  protected function test(array $labels, array $options)
   {
     $configuration = LimeConfiguration::getInstance(getcwd());
 
@@ -261,4 +261,39 @@
       }
     }
   }
+
+  /**
+   * Parses the given CLI arguments and returns an array of options.
+   *
+   * @param  array $arguments
+   * @return array
+   */
+  protected function parseArguments(array $arguments)
+  {
+    $options = array();
+    $parameters = array();
+
+    foreach ($arguments as $argument)
+    {
+      if (preg_match('/^--([a-zA-Z\-]+)=(.+)$/', $argument, $matches))
+      {
+        if (in_array($matches[2], array('true', 'false')))
+        {
+          $matches[2] = eval($matches[2]);
+        }
+
+        $options[$matches[1]] = $matches[2];
+      }
+      else if (preg_match('/^--([a-zA-Z\-]+)$/', $argument, $matches))
+      {
+        $options[$matches[1]] = true;
+      }
+      else
+      {
+        $parameters[] = $argument;
+      }
+    }
+
+    return array($options, $parameters);
+  }
 }
\ No newline at end of file

Copied: tools/lime/branches/2.0/lib/LimeCommand.php (from rev 25915, 
tools/lime/branches/2.0/lib/shell/LimeShellCommand.php)
===================================================================
--- tools/lime/branches/2.0/lib/LimeCommand.php                         (rev 0)
+++ tools/lime/branches/2.0/lib/LimeCommand.php 2010-02-18 16:46:32 UTC (rev 
28111)
@@ -0,0 +1,69 @@
+<?php
+
+class LimeCommand
+{
+  protected
+    $command    = null,
+    $status     = null,
+    $output     = '',
+    $errors     = '',
+    $errorFile  = '';
+
+  public function __construct($file, LimeExecutable $executable, array 
$arguments = array())
+  {
+    $arguments = array_merge($executable->getArguments(), $arguments);
+
+    foreach ($arguments as $argument => $value)
+    {
+      $arguments[$argument] = $argument;
+
+      if ($value !== true)
+      {
+        if (!is_string($value))
+        {
+          $value = var_export($value, true);
+        }
+
+        $arguments[$argument] .= '='.escapeshellarg($value);
+      }
+    }
+
+    $this->errorFile = tempnam(sys_get_temp_dir(), 'lime');
+
+    // see http://trac.symfony-project.org/ticket/5437 for the explanation on 
the weird "cd" thing
+    $this->command = sprintf(
+      'cd & %s %s %s 2>%s',
+      $executable->getExecutable(),
+      escapeshellarg($file),
+      implode(' ', $arguments),
+      $this->errorFile
+    );
+  }
+
+  public function execute()
+  {
+    // clear old errors
+    $this->errors = '';
+    file_put_contents($this->errorFile, '');
+
+    ob_start();
+    passthru($this->command, $this->status);
+    $this->output = ob_get_clean();
+    $this->errors = file_get_contents($this->errorFile);
+  }
+
+  public function getStatus()
+  {
+    return $this->status;
+  }
+
+  public function getOutput()
+  {
+    return $this->output;
+  }
+
+  public function getErrors()
+  {
+    return $this->errors;
+  }
+}
\ No newline at end of file


Property changes on: tools/lime/branches/2.0/lib/LimeCommand.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: tools/lime/branches/2.0/lib/LimeConfiguration.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeConfiguration.php   2010-02-18 11:12:08 UTC 
(rev 28110)
+++ tools/lime/branches/2.0/lib/LimeConfiguration.php   2010-02-18 16:46:32 UTC 
(rev 28111)
@@ -14,7 +14,7 @@
  * points to the instance of the LimeConfiguration class. You can there
  * modify the configuration.
  *
- * @author Bernhard Schussek <[email protected]>
+ * @author Bernhard Schussek <[email protected]>
  */
 class LimeConfiguration
 {
@@ -183,6 +183,26 @@
   }
 
   /**
+   * Sets the factory used for creating parser instances.
+   *
+   * @param LimeParserFactoryInterface $factory
+   */
+  public function setParserFactory(LimeParserFactoryInterface $factory)
+  {
+    $this->parserFactory = $factory;
+  }
+
+  /**
+   * Returns the factory used for creating parser instances.
+   *
+   * @return LimeParserFactoryInterface
+   */
+  public function getParserFactory()
+  {
+    return $this->parserFactory;
+  }
+
+  /**
    * Sets the name of the output used for test suites.
    *
    * @param string $output
@@ -308,14 +328,14 @@
    * @param string $path
    * @param array $labels
    */
-  public function registerFile($path, $labels = array())
+  public function registerFile($path, LimeExecutable $executable, $labels = 
array())
   {
     if (!is_file($path))
     {
       throw new InvalidArgumentException(sprintf('The file "%s" does not 
exist', $path));
     }
 
-    $this->files[] = array($path, $labels);
+    $this->files[] = array($path, $executable, $labels);
   }
 
   /**
@@ -324,14 +344,14 @@
    * @param string $path
    * @param array $labels
    */
-  public function registerDir($path, $labels = array())
+  public function registerDir($path, LimeExecutable $executable, $labels = 
array())
   {
     if (!is_dir($path))
     {
       throw new InvalidArgumentException(sprintf('The directory "%s" does not 
exist', $path));
     }
 
-    $this->dirs[] = array($path, $labels);
+    $this->dirs[] = array($path, $executable, $labels);
   }
 
   /**
@@ -340,9 +360,9 @@
    * @param string $glob
    * @param array $labels
    */
-  public function registerGlob($glob, $labels = array())
+  public function registerGlob($glob, LimeExecutable $executable, $labels = 
array())
   {
-    $this->globs[] = array($glob, $labels);
+    $this->globs[] = array($glob, $executable, $labels);
   }
 
   /**
@@ -353,9 +373,9 @@
    * @param callable $callback
    * @param array $labels
    */
-  public function registerCallback($callback, $labels = array())
+  public function registerCallback($callback, LimeExecutable $executable, 
$labels = array())
   {
-    $this->callbacks[] = array($callback, $labels);
+    $this->callbacks[] = array($callback, $executable, $labels);
   }
 
   /**

Modified: tools/lime/branches/2.0/lib/LimeCoverage.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeCoverage.php        2010-02-18 11:12:08 UTC 
(rev 28110)
+++ tools/lime/branches/2.0/lib/LimeCoverage.php        2010-02-18 16:46:32 UTC 
(rev 28111)
@@ -87,11 +87,11 @@
 
     foreach ($files as $file)
     {
-      $command = new LimeShellCommand($file, array('coverage' => true));
+      $command = new LimeCommand($file, array('coverage' => true));
       $command->execute();
 
       // script failed
-      if ($command->getStatus() != LimeShell::SUCCESS)
+      if ($command->getStatus() != 0)
       {
         $this->output->echoln(sprintf('Warning: %s returned status %d, results 
may be inaccurate', $file, $command->getStatus()), LimeOutput::ERROR);
       }
@@ -99,7 +99,7 @@
       // script succeeded, coverage not readable
       if (false === $coverage = @unserialize($command->getOutput()))
       {
-        if ($command->getStatus() == LimeShell::SUCCESS)
+        if ($command->getStatus() == 0)
         {
           throw new Exception(sprintf('Unable to unserialize coverage for file 
"%s"', $file));
         }

Added: tools/lime/branches/2.0/lib/LimeExecutable.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeExecutable.php                              
(rev 0)
+++ tools/lime/branches/2.0/lib/LimeExecutable.php      2010-02-18 16:46:32 UTC 
(rev 28111)
@@ -0,0 +1,180 @@
+<?php
+
+/*
+ * This file is part of the Lime framework.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ * (c) Bernhard Schussek <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+/**
+ * An executable used to execute test files.
+ *
+ * Executables know about the programm that is used to execute the test files,
+ * the parser that is used to read their output and optionally some arguments
+ * that are passed to the test file execution.
+ *
+ * This class offers two factory method for creating new executables:
+ *
+ * LimeExecutable::php() automatically prepends the call with the local PHP
+ * binary. You can pass the name of the PHP script to which you want to pass 
the
+ * test file in the first parameter. If you want to execute the script directly
+ * with PHP, you can leave the first parameter at its default null.
+ *
+ * LimeExecutable::shell() creates an executable that executes a test file
+ * in the console without PHP. If you pass the name of a program to the first
+ * parameter, this program will be launched with the test file as first
+ * argument.
+ *
+ * @author Bernhard Schussek <[email protected]>
+ */
+class LimeExecutable
+{
+  protected static
+    $php             = null;
+
+  protected
+    $executable      = null,
+    $arguments       = array(),
+    $parserName      = null;
+
+  /**
+   * Creates a new executable executed with the PHP binary.
+   *
+   * The PHP binary is launched to execute the given executable with the test
+   * file as first argument. If the executable is omitted or set to NULL, the
+   * test file is launched directly with PHP.
+   *
+   * @param  string $executable  The name of the executable PHP script
+   * @param  string $parserName  The parser used to parse the test file output
+   * @param  array $arguments    The default arguments passed to the script
+   * @return LimeExecutable
+   */
+  public static function php($executable = null, $parserName = null, array 
$arguments = array())
+  {
+    return new LimeExecutable(trim(self::findPhp().' '.$executable), 
$parserName, $arguments);
+  }
+
+  /**
+   * Creates a new executable.
+   *
+   * The given executable is launched with the test file as first argument. If
+   * the executable is omitted or set to NULL, the test file is launched
+   * directly.
+   *
+   * @param  string $executable  The name of the executable
+   * @param  string $parserName  The parser used to parse the test file output
+   * @param  array $arguments    The default arguments passed to the executable
+   * @return LimeExecutable
+   */
+  public static function shell($executable = null, $parserName = null, array 
$arguments = array())
+  {
+    return new LimeExecutable($executable, $parserName, $arguments);
+  }
+
+  /**
+   * Private constructor.
+   *
+   * This constructor is private. You should use the factory methods php() or
+   * shell() instead.
+   *
+   * @param string $executable
+   * @param string $parserName
+   * @param array $arguments
+   */
+  private function __construct($executable = null, $parserName = null, array 
$arguments = array())
+  {
+    $this->executable = $executable;
+    $this->arguments = $arguments;
+    $this->parserName = $parserName;
+  }
+
+  /**
+   * Returns the name of the executable.
+   *
+   * @return string
+   */
+  public function getExecutable()
+  {
+    return $this->executable;
+  }
+
+  /**
+   * Returns the default arguments for the executable.
+   *
+   * @return array
+   */
+  public function getArguments()
+  {
+    return $this->arguments;
+  }
+
+  /**
+   * Returns the name of the parser used to read test file output.
+   *
+   * This name should be known to the used parser factory configured in
+   * LimeConfiguration (LimeParserFactory by default).
+   *
+   * @return string
+   */
+  public function getParserName()
+  {
+    return $this->parserName;
+  }
+
+  /**
+   * Tries to find the system's PHP executable and returns it.
+   *
+   * @return string
+   */
+  protected static function findPhp()
+  {
+    if (is_null(self::$php))
+    {
+      if (getenv('PHP_PATH'))
+      {
+        self::$executable = getenv('PHP_PATH');
+
+        if (!is_executable(self::$php))
+        {
+          throw new Exception('The defined PHP_PATH environment variable is 
not a valid PHP executable.');
+        }
+      }
+      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 $executable)
+      {
+        foreach ($extensions as $extension)
+        {
+          foreach (explode(PATH_SEPARATOR, $path) as $dir)
+          {
+            $file = $dir.DIRECTORY_SEPARATOR.$executable.$extension;
+            if (is_executable($file))
+            {
+              self::$php = $file;
+              break 3;
+            }
+          }
+        }
+      }
+
+      if (!is_executable(self::$php))
+      {
+        throw new Exception("Unable to find PHP executable.");
+      }
+    }
+
+    return self::$php;
+  }
+}
\ No newline at end of file


Property changes on: tools/lime/branches/2.0/lib/LimeExecutable.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: tools/lime/branches/2.0/lib/LimeFile.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeFile.php    2010-02-18 11:12:08 UTC (rev 
28110)
+++ tools/lime/branches/2.0/lib/LimeFile.php    2010-02-18 16:46:32 UTC (rev 
28111)
@@ -15,22 +15,24 @@
  *
  * The file may be assigned to labels.
  *
- * @author Bernhard Schussek <[email protected]>
+ * @author Bernhard Schussek <[email protected]>
  */
 class LimeFile
 {
   private
     $path          = null,
-    $labels      = array();
+    $executable    = null,
+    $labels        = array();
 
   /**
    * Constructor.
    *
    * @param string $path  The path to the file
    */
-  public function __construct($path)
+  public function __construct($path, LimeExecutable $executable)
   {
     $this->path = $path;
+    $this->executable = $executable;
   }
 
   /**
@@ -44,6 +46,16 @@
   }
 
   /**
+   * Returns the executable for the file.
+   *
+   * @return LimeExecutable
+   */
+  public function getExecutable()
+  {
+    return $this->executable;
+  }
+
+  /**
    * Adds the given labels to the file.
    *
    * @param array $la bels

Modified: tools/lime/branches/2.0/lib/LimeHarness.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeHarness.php 2010-02-18 11:12:08 UTC (rev 
28110)
+++ tools/lime/branches/2.0/lib/LimeHarness.php 2010-02-18 16:46:32 UTC (rev 
28111)
@@ -48,7 +48,7 @@
 
     for ($i = 0; $i < $this->configuration->getProcesses(); ++$i)
     {
-      $launchers[] = new LimeLauncher($this->output, array('focus', 'close', 
'flush'));
+      $launchers[] = new LimeLauncher($this->output, 
$this->configuration->getParserFactory());
     }
 
     do

Modified: tools/lime/branches/2.0/lib/LimeLabel.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeLabel.php   2010-02-18 11:12:08 UTC (rev 
28110)
+++ tools/lime/branches/2.0/lib/LimeLabel.php   2010-02-18 16:46:32 UTC (rev 
28111)
@@ -13,7 +13,7 @@
 /**
  * A label for test files.
  *
- * @author Bernhard Schussek <[email protected]>
+ * @author Bernhard Schussek <[email protected]>
  */
 class LimeLabel
 {

Modified: tools/lime/branches/2.0/lib/LimeLauncher.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeLauncher.php        2010-02-18 11:12:08 UTC 
(rev 28110)
+++ tools/lime/branches/2.0/lib/LimeLauncher.php        2010-02-18 16:46:32 UTC 
(rev 28111)
@@ -13,12 +13,12 @@
 /**
  * Launches test files and passes their output to its own output instance.
  *
- * @author Bernhard Schussek <[email protected]>
+ * @author Bernhard Schussek <[email protected]>
  */
 class LimeLauncher
 {
   protected
-    $suppressedMethods  = array(),
+    $parserFactory      = null,
     $output             = null,
     $errors             = '',
     $file               = null,
@@ -32,10 +32,10 @@
    * @param LimeOutputInterface $output
    * @param array $suppressedMethods
    */
-  public function __construct(LimeOutputInterface $output, array 
$suppressedMethods = array())
+  public function __construct(LimeOutputInterface $output, 
LimeParserFactoryInterface $parserFactory)
   {
-    $this->suppressedMethods = $suppressedMethods;
     $this->output = $output;
+    $this->parserFactory = $parserFactory;
   }
 
   /**
@@ -46,12 +46,12 @@
    */
   public function launch(LimeFile $file, array $arguments = array())
   {
-    $arguments['output'] = 'raw';
+    $executable = $file->getExecutable();
 
     $this->file = $file;
     $this->done = false;
-    $this->parser = null;
-    $this->process = new LimeShellProcess($file->getPath(), $arguments);
+    $this->parser =  
$this->parserFactory->create($executable->getParserName(), $this->output);
+    $this->process = new LimeProcess($file->getPath(), $executable, 
$arguments);
     $this->process->execute();
   }
 
@@ -72,19 +72,6 @@
   {
     $data = $this->process->getOutput();
 
-    if (is_null($this->parser))
-    {
-      if (substr($data, 0, 5) == "\0raw\0")
-      {
-        $this->parser = new LimeParserRaw($this->output, 
$this->suppressedMethods);
-        $data = substr($data, 5);
-      }
-      else
-      {
-        $this->parser = new LimeParserTap($this->output);
-      }
-    }
-
     $this->parser->parse($data);
 
     $this->errors .= $this->process->getErrors();

Modified: tools/lime/branches/2.0/lib/LimeLoader.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeLoader.php  2010-02-18 11:12:08 UTC (rev 
28110)
+++ tools/lime/branches/2.0/lib/LimeLoader.php  2010-02-18 16:46:32 UTC (rev 
28111)
@@ -17,7 +17,7 @@
  * will be loaded. The file paths can then be accessed using the different
  * getFile*() methods.
  *
- * @author Bernhard Schussek <[email protected]>
+ * @author Bernhard Schussek <[email protected]>
  */
 class LimeLoader
 {
@@ -38,19 +38,19 @@
 
     foreach ($configuration->getRegisteredFiles() as $file)
     {
-      $this->loadFile($this->getAbsolutePath($file[0]), $file[1]);
+      $this->loadFile($this->getAbsolutePath($file[0]), $file[1], $file[2]);
     }
     foreach ($configuration->getRegisteredDirs() as $dir)
     {
-      $this->loadDir($this->getAbsolutePath($dir[0]), $dir[1]);
+      $this->loadDir($this->getAbsolutePath($dir[0]), $dir[1], $dir[2]);
     }
     foreach ($configuration->getRegisteredGlobs() as $glob)
     {
-      $this->loadGlob($this->getAbsolutePath($glob[0]), $glob[1]);
+      $this->loadGlob($this->getAbsolutePath($glob[0]), $glob[1], $glob[2]);
     }
     foreach ($configuration->getRegisteredCallbacks() as $callback)
     {
-      $this->loadFile($callback[0], $callback[1]);
+      $this->loadFile($callback[0], $callback[1], $callback[2]);
     }
   }
 
@@ -81,7 +81,7 @@
    * @param string $path
    * @param array $labels
    */
-  protected function loadFile($path, $labels = array())
+  protected function loadFile($path, LimeExecutable $executable, $labels = 
array())
   {
     if (!is_file($path))
     {
@@ -93,7 +93,7 @@
 
     if (!isset($this->files[$path]))
     {
-      $this->files[$path] = new LimeFile($path);
+      $this->files[$path] = new LimeFile($path, $executable);
 
       if (!isset($this->filesByName[$name]))
       {
@@ -125,17 +125,17 @@
    * @param array $paths
    * @param array $labels
    */
-  protected function loadFiles(array $paths, $labels = array())
+  protected function loadFiles(array $paths, LimeExecutable $executable, 
$labels = array())
   {
     foreach ($paths as $path)
     {
       if (is_dir($path))
       {
-        $this->loadDir($path, $labels);
+        $this->loadDir($path, $executable, $labels);
       }
       else
       {
-        $this->loadFile($path, $labels);
+        $this->loadFile($path, $executable, $labels);
       }
     }
   }
@@ -148,7 +148,7 @@
    * @param string $path
    * @param array $labels
    */
-  protected function loadDir($path, $labels = array())
+  protected function loadDir($path, LimeExecutable $executable, $labels = 
array())
   {
     $iterator = new DirectoryIterator($path);
 
@@ -158,11 +158,11 @@
       {
         if ($file->isDir())
         {
-          $this->loadDir($file->getPathname(), $labels);
+          $this->loadDir($file->getPathname(), $executable, $labels);
         }
         else if (preg_match($this->configuration->getFilePattern(), 
$file->getFilename()))
         {
-          $this->loadFile($file->getPathname(), $labels);
+          $this->loadFile($file->getPathname(), $executable, $labels);
         }
       }
     }
@@ -174,11 +174,11 @@
    * @param string $glob
    * @param array $labels
    */
-  protected function loadGlob($glob, $labels = array())
+  protected function loadGlob($glob, LimeExecutable $executable, $labels = 
array())
   {
     if ($files = glob($glob))
     {
-      $this->loadFiles($files, $labels);
+      $this->loadFiles($files, $executable, $labels);
     }
   }
 
@@ -190,11 +190,11 @@
    * @param callable $callback
    * @param array $labels
    */
-  protected function loadCallback($callback, $labels = array())
+  protected function loadCallback($callback, LimeExecutable $executable, 
$labels = array())
   {
     if ($files = call_user_func($callback))
     {
-      $this->loadFiles($files, $labels);
+      $this->loadFiles($files, $executable, $labels);
     }
   }
 

Copied: tools/lime/branches/2.0/lib/LimeProcess.php (from rev 25915, 
tools/lime/branches/2.0/lib/shell/LimeShellProcess.php)
===================================================================
--- tools/lime/branches/2.0/lib/LimeProcess.php                         (rev 0)
+++ tools/lime/branches/2.0/lib/LimeProcess.php 2010-02-18 16:46:32 UTC (rev 
28111)
@@ -0,0 +1,35 @@
+<?php
+
+class LimeProcess extends LimeCommand
+{
+  protected
+    $handle         = null,
+    $errorHandle    = null;
+
+  public function execute()
+  {
+    $this->errorHandle = fopen($this->errorFile, 'w+'); // clear error file
+    $this->handle = popen($this->command, 'r');
+  }
+
+  public function getStatus()
+  {
+    throw new BadMethodCallException('Status is not supported by processes');
+  }
+
+  public function getOutput()
+  {
+    return feof($this->handle) ? '' : fread($this->handle, 1024);
+  }
+
+  public function getErrors()
+  {
+    // don't check feof here, for some reason some errors get dropped then
+    return fread($this->errorHandle, 1024);
+  }
+
+  public function isClosed()
+  {
+    return feof($this->handle) && feof($this->errorHandle);
+  }
+}
\ No newline at end of file


Property changes on: tools/lime/branches/2.0/lib/LimeProcess.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: tools/lime/branches/2.0/lib/LimeTest.php
===================================================================
--- tools/lime/branches/2.0/lib/LimeTest.php    2010-02-18 11:12:08 UTC (rev 
28110)
+++ tools/lime/branches/2.0/lib/LimeTest.php    2010-02-18 16:46:32 UTC (rev 
28111)
@@ -21,20 +21,12 @@
 {
   protected
     $output                 = null,
-    $options                = array(),
     $errorReporting         = true,
     $exception              = null,
     $exceptionExpectation   = null;
 
   public function __construct($plan = null, LimeConfiguration $configuration = 
null)
   {
-    list($cliOptions) = LimeShell::parseArguments($GLOBALS['argv']);
-
-    foreach ($cliOptions as $option => $value)
-    {
-      $this->options[str_replace('-', '_', $option)] = $value;
-    }
-
     if (is_null($configuration))
     {
       $configuration = LimeConfiguration::getInstance(getcwd());

Modified: tools/lime/branches/2.0/lib/output/LimeOutputFactory.php
===================================================================
--- tools/lime/branches/2.0/lib/output/LimeOutputFactory.php    2010-02-18 
11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/lib/output/LimeOutputFactory.php    2010-02-18 
16:46:32 UTC (rev 28111)
@@ -21,7 +21,7 @@
  *   * suite
  *   * tap
  *
- * @author Bernhard Schussek <[email protected]>
+ * @author Bernhard Schussek <[email protected]>
  */
 class LimeOutputFactory implements LimeOutputFactoryInterface
 {

Modified: tools/lime/branches/2.0/lib/output/LimeOutputFactoryInterface.php
===================================================================
--- tools/lime/branches/2.0/lib/output/LimeOutputFactoryInterface.php   
2010-02-18 11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/lib/output/LimeOutputFactoryInterface.php   
2010-02-18 16:46:32 UTC (rev 28111)
@@ -13,7 +13,7 @@
 /**
  * Factory class for creating output instances.
  *
- * @author Bernhard Schussek <[email protected]>
+ * @author Bernhard Schussek <[email protected]>
  */
 interface LimeOutputFactoryInterface
 {

Modified: tools/lime/branches/2.0/lib/output/LimeOutputRaw.php
===================================================================
--- tools/lime/branches/2.0/lib/output/LimeOutputRaw.php        2010-02-18 
11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/lib/output/LimeOutputRaw.php        2010-02-18 
16:46:32 UTC (rev 28111)
@@ -12,9 +12,6 @@
 
 class LimeOutputRaw implements LimeOutputInterface
 {
-  protected
-    $initialized = false;
-
   protected function printCall($method, array $arguments = array())
   {
     foreach ($arguments as &$argument)
@@ -25,12 +22,6 @@
       }
     }
 
-    if (!$this->initialized)
-    {
-      $this->initialized = true;
-      print "\0raw\0";
-    }
-
     print serialize(array($method, $arguments))."\n";
   }
 

Added: tools/lime/branches/2.0/lib/parser/LimeParserFactory.php
===================================================================
--- tools/lime/branches/2.0/lib/parser/LimeParserFactory.php                    
        (rev 0)
+++ tools/lime/branches/2.0/lib/parser/LimeParserFactory.php    2010-02-18 
16:46:32 UTC (rev 28111)
@@ -0,0 +1,40 @@
+<?php
+
+/*
+ * This file is part of the Lime framework.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ * (c) Bernhard Schussek <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+/**
+ * Factory class for creating LimeParserInterface instances.
+ *
+ * The available instance names are:
+ *
+ *   * raw
+ *   * tap
+ *
+ * @author Bernhard Schussek <[email protected]>
+ */
+class LimeParserFactory implements LimeParserFactoryInterface
+{
+  /**
+   * (non-PHPdoc)
+   * @see output/LimeParserFactoryInterface#create($name)
+   */
+  public function create($name, LimeOutputInterface $output)
+  {
+    switch ($name)
+    {
+      case 'raw':
+        return new LimeParserRaw($output);
+      case 'tap':
+      default:
+        return new LimeParserTap($output);
+    }
+  }
+}
\ No newline at end of file


Property changes on: tools/lime/branches/2.0/lib/parser/LimeParserFactory.php
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:keywords
   + Id

Added: tools/lime/branches/2.0/lib/parser/LimeParserFactoryInterface.php
===================================================================
--- tools/lime/branches/2.0/lib/parser/LimeParserFactoryInterface.php           
                (rev 0)
+++ tools/lime/branches/2.0/lib/parser/LimeParserFactoryInterface.php   
2010-02-18 16:46:32 UTC (rev 28111)
@@ -0,0 +1,30 @@
+<?php
+
+/*
+ * This file is part of the Lime framework.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ * (c) Bernhard Schussek <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+/**
+ * Factory class for creating output instances.
+ *
+ * @author Bernhard Schussek <[email protected]>
+ */
+interface LimeParserFactoryInterface
+{
+  /**
+   * Creates a new LimeParserInterface instance for the given name.
+   *
+   * Names can be defined by the concrete factory implementation.
+   *
+   * @param string $name
+   * @param LimeOutputInterface $output  The output where the parsed 
information
+   *                                     will be written to
+   */
+  public function create($name, LimeOutputInterface $output);
+}
\ No newline at end of file


Property changes on: 
tools/lime/branches/2.0/lib/parser/LimeParserFactoryInterface.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: tools/lime/branches/2.0/lib/parser/LimeParserRaw.php
===================================================================
--- tools/lime/branches/2.0/lib/parser/LimeParserRaw.php        2010-02-18 
11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/lib/parser/LimeParserRaw.php        2010-02-18 
16:46:32 UTC (rev 28111)
@@ -12,17 +12,12 @@
 
 class LimeParserRaw extends LimeParser
 {
+  protected static
+    $suppressedMethods = array('focus', 'close', 'flush');
+
   protected
-    $suppressedMethods = array(),
     $error = false;
 
-  public function __construct(LimeOutputInterface $output, array 
$suppressedMethods = array())
-  {
-    parent::__construct($output);
-
-    $this->suppressedMethods = $suppressedMethods;
-  }
-
   public function parse($data)
   {
     $this->buffer .= $data;
@@ -46,7 +41,7 @@
           break;
         }
 
-        if (!in_array($method, $this->suppressedMethods))
+        if (!in_array($method, self::$suppressedMethods))
         {
           foreach ($arguments as &$argument)
           {

Modified: tools/lime/branches/2.0/lime.config.php
===================================================================
--- tools/lime/branches/2.0/lime.config.php     2010-02-18 11:12:08 UTC (rev 
28110)
+++ tools/lime/branches/2.0/lime.config.php     2010-02-18 16:46:32 UTC (rev 
28111)
@@ -49,9 +49,13 @@
  *   $config->registerDir('path/to/dir', array('unit', 'slow'));
  */
 
-$config->registerGlob('test/unit/*Test.php');
-$config->registerGlob('test/unit/*/*Test.php');
+$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);
+
 /*
  * Sets the directory where the registered files are searched for.
  */
@@ -89,7 +93,7 @@
 $config->setProcesses(1);
 
 /*
- * Sets the output factory used for creating output instances.
+ * Sets the factory used for creating output instances.
  */
 $config->setOutputFactory(new LimeOutputFactory($config));
 
@@ -110,3 +114,8 @@
  * and "raw".
  */
 $config->setTestOutput('tap');
+
+/*
+ * Sets the factory used for creating parser instances.
+ */
+$config->setParserFactory(new LimeParserFactory());
\ No newline at end of file

Modified: tools/lime/branches/2.0/test/bin/benchmark.php
===================================================================
--- tools/lime/branches/2.0/test/bin/benchmark.php      2010-02-18 11:12:08 UTC 
(rev 28110)
+++ tools/lime/branches/2.0/test/bin/benchmark.php      2010-02-18 16:46:32 UTC 
(rev 28111)
@@ -48,7 +48,7 @@
 
   echo "Running ".($i+1)." of ".count($processCounts)." ($processCount 
processes)\n";
 
-  $command = new LimeShellCommand(TEST_SCRIPT, array('processes' => 
$processCount));
+  $command = new LimeCommand(TEST_SCRIPT, array('processes' => $processCount));
   $command->execute();
 
   $stats[$processCount][] = microtime(true) - $time;

Modified: tools/lime/branches/2.0/test/unit/LimeAnnotationSupportTest.php
===================================================================
--- tools/lime/branches/2.0/test/unit/LimeAnnotationSupportTest.php     
2010-02-18 11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/test/unit/LimeAnnotationSupportTest.php     
2010-02-18 16:46:32 UTC (rev 28111)
@@ -26,6 +26,9 @@
 
 $root = '# /test/unit/LimeAnnotationSupport';
 
+global $executable;
+$executable = LimeExecutable::php();
+
 function _backup($file)
 {
   $file = dirname(__FILE__).'/LimeAnnotationSupport/'.$file;
@@ -44,7 +47,9 @@
 
 function _execute($file)
 {
-  $command = new 
LimeShellCommand(dirname(__FILE__).'/LimeAnnotationSupport/'.$file);
+  global $executable;
+
+  $command = new 
LimeCommand(dirname(__FILE__).'/LimeAnnotationSupport/'.$file, $executable);
   $command->execute();
 
   return $command;

Copied: tools/lime/branches/2.0/test/unit/LimeCommandTest.php (from rev 25915, 
tools/lime/branches/2.0/test/unit/shell/LimeShellCommandTest.php)
===================================================================
--- tools/lime/branches/2.0/test/unit/LimeCommandTest.php                       
        (rev 0)
+++ tools/lime/branches/2.0/test/unit/LimeCommandTest.php       2010-02-18 
16:46:32 UTC (rev 28111)
@@ -0,0 +1,65 @@
+<?php
+
+/*
+ * This file is part of the Lime framework.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ * (c) Bernhard Schussek <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+include dirname(__FILE__).'/../bootstrap/unit.php';
+
+LimeAnnotationSupport::enable();
+
+$t = new LimeTest(5);
+
+
+// @Before
+
+  $executable = LimeExecutable::php();
+
+
+// @Test: A PHP file can be executed
+
+  // fixtures
+  $file = tempnam(sys_get_temp_dir(), 'lime');
+  file_put_contents($file, <<<EOF
+<?php
+echo "Test";
+file_put_contents("php://stderr", "Errors");
+exit(1);
+EOF
+  );
+  // test
+  $command = new LimeCommand($file, $executable);
+  $command->execute();
+  // assertions
+  $t->is($command->getOutput(), 'Test', 'The output is correct');
+  $t->is($command->getErrors(), 'Errors', 'The errors are correct');
+  $t->is($command->getStatus(), 1, 'The return value is correct');
+
+
+// @Test: A PHP file can be executed with arguments
+
+  // fixtures
+  $file = tempnam(sys_get_temp_dir(), 'lime');
+  file_put_contents($file, <<<EOF
+<?php
+unset(\$GLOBALS['argv'][0]);
+var_export(\$GLOBALS['argv']);
+exit(1);
+EOF
+  );
+  // test
+  $command = new LimeCommand($file, $executable, array('--test' => true, 
'--arg' => 'value'));
+  $command->execute();
+  // assertions
+  $output = "array (
+  1 => '--test',
+  2 => '--arg=value',
+)";
+  $t->is($command->getOutput(), $output, 'The output is correct');
+  $t->is($command->getStatus(), 1, 'The return value is correct');
\ No newline at end of file


Property changes on: tools/lime/branches/2.0/test/unit/LimeCommandTest.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: tools/lime/branches/2.0/test/unit/LimeLabelTest.php
===================================================================
--- tools/lime/branches/2.0/test/unit/LimeLabelTest.php 2010-02-18 11:12:08 UTC 
(rev 28110)
+++ tools/lime/branches/2.0/test/unit/LimeLabelTest.php 2010-02-18 16:46:32 UTC 
(rev 28111)
@@ -17,20 +17,25 @@
 $t = new LimeTest(3);
 
 
+// @BeforeAll
+
+  $executable = $t->stub('LimeExecutable');
+
+
 // @Before
 
   $label1 = new LimeLabel();
-  $label1->addFile(new LimeFile('test1.txt'));
-  $label1->addFile(new LimeFile('test2.txt'));
+  $label1->addFile(new LimeFile('test1.txt', $executable));
+  $label1->addFile(new LimeFile('test2.txt', $executable));
   $label2 = new LimeLabel();
-  $label2->addFile(new LimeFile('test1.txt'));
-  $label2->addFile(new LimeFile('test3.txt'));
+  $label2->addFile(new LimeFile('test1.txt', $executable));
+  $label2->addFile(new LimeFile('test3.txt', $executable));
 
 
 // @Test: intersect() returns the intersection of two labels
 
   $expected = new LimeLabel();
-  $expected->addFile(new LimeFile('test1.txt'));
+  $expected->addFile(new LimeFile('test1.txt', $executable));
   $actual = $label1->intersect($label2);
   $t->is($actual, $expected, 'The intersection is correct');
 
@@ -38,9 +43,9 @@
 // @Test: add() returns the sum of two labels
 
   $expected = new LimeLabel();
-  $expected->addFile(new LimeFile('test1.txt'));
-  $expected->addFile(new LimeFile('test2.txt'));
-  $expected->addFile(new LimeFile('test3.txt'));
+  $expected->addFile(new LimeFile('test1.txt', $executable));
+  $expected->addFile(new LimeFile('test2.txt', $executable));
+  $expected->addFile(new LimeFile('test3.txt', $executable));
   $actual = $label1->add($label2);
   $t->is($actual, $expected, 'The sum is correct');
 
@@ -48,6 +53,6 @@
 // @Test: subtract() returns the first label without the second
 
   $expected = new LimeLabel();
-  $expected->addFile(new LimeFile('test2.txt'));
+  $expected->addFile(new LimeFile('test2.txt', $executable));
   $actual = $label1->subtract($label2);
   $t->is($actual, $expected, 'The subtraction is correct');
\ No newline at end of file

Modified: tools/lime/branches/2.0/test/unit/LimeLauncherTest.php
===================================================================
--- tools/lime/branches/2.0/test/unit/LimeLauncherTest.php      2010-02-18 
11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/test/unit/LimeLauncherTest.php      2010-02-18 
16:46:32 UTC (rev 28111)
@@ -14,14 +14,16 @@
 
 LimeAnnotationSupport::enable();
 
-$t = new LimeTest(7);
+$t = new LimeTest(6);
 
 
 // @Before
 
-  $file = tempnam(sys_get_temp_dir(), 'lime');
   $output = $t->mock('LimeOutputInterface');
-  $launcher = new LimeLauncher($output);
+  $parserFactory = new LimeParserFactory();
+  $executable = LimeExecutable::php(null, 'raw');
+  $file = tempnam(sys_get_temp_dir(), 'lime');
+  $launcher = new LimeLauncher($output, $parserFactory);
 
 
 // @After
@@ -31,34 +33,14 @@
   $launcher = null;
 
 
-// @Test: The file is called with the argument --output=raw
-
-  // fixtures
-  $output->plan(2);
-  $output->replay();
-  file_put_contents($file, <<<EOF
-<?php
-if (in_array('--output=raw', \$GLOBALS['argv']))
-{
-  echo "1..2\n";
-}
-EOF
-  );
-  // test
-  $launcher->launch(new LimeFile($file));
-  while (!$launcher->done()) $launcher->proceed();
-  // assertions
-  $output->verify();
-
-
 // @Test: If the output cannot be unserialized, an error is reported
 
   // fixtures
-  file_put_contents($file, '<?php echo "\0raw\0Some Error occurred\n";');
+  file_put_contents($file, '<?php echo "Some Error occurred\n";');
   $output->warning('Could not parse test output: "Some Error occurred"', 
$file, 1);
   $output->replay();
   // test
-  $launcher->launch(new LimeFile($file));
+  $launcher->launch(new LimeFile($file, $executable));
   while (!$launcher->done()) $launcher->proceed();
   // assertions
   $output->verify();
@@ -72,7 +54,7 @@
   $output->warning('Error 2', $file, 0);
   $output->replay();
   // test
-  $launcher->launch(new LimeFile($file));
+  $launcher->launch(new LimeFile($file, $executable));
   while (!$launcher->done()) $launcher->proceed();
   // assertions
   $output->verify();
@@ -87,7 +69,7 @@
   $output->error(new LimeError("syntax error, unexpected T_LNUMBER, expecting 
T_VARIABLE or '$'", $file, 1, 'Parse error'));
   $output->replay();
   // test
-  $launcher->launch(new LimeFile($file));
+  $launcher->launch(new LimeFile($file, $executable));
   while (!$launcher->done()) $launcher->proceed();
   // assertions
   $output->verify();
@@ -101,7 +83,7 @@
   $output->error(new LimeError("require(): Failed opening required 
'foobar.php' (include_path='".get_include_path()."')", $file, 1, 'Fatal 
error'));
   $output->replay();
   // test
-  $launcher->launch(new LimeFile($file));
+  $launcher->launch(new LimeFile($file, $executable));
   while (!$launcher->done()) $launcher->proceed();
   // assertions
   $output->verify();

Copied: tools/lime/branches/2.0/test/unit/LimeProcessTest.php (from rev 25915, 
tools/lime/branches/2.0/test/unit/shell/LimeShellProcessTest.php)
===================================================================
--- tools/lime/branches/2.0/test/unit/LimeProcessTest.php                       
        (rev 0)
+++ tools/lime/branches/2.0/test/unit/LimeProcessTest.php       2010-02-18 
16:46:32 UTC (rev 28111)
@@ -0,0 +1,44 @@
+<?php
+
+/*
+ * This file is part of the Lime framework.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ * (c) Bernhard Schussek <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+include dirname(__FILE__).'/../bootstrap/unit.php';
+
+LimeAnnotationSupport::enable();
+
+$t = new LimeTest(2);
+
+
+// @Test: A PHP file can be executed
+
+  // fixtures
+  $executable = LimeExecutable::php();
+  $output = '';
+  $errors = '';
+  $file = tempnam(sys_get_temp_dir(), 'lime');
+  file_put_contents($file, <<<EOF
+<?php
+echo "Test";
+file_put_contents("php://stderr", "Errors");
+exit(1);
+EOF
+  );
+  // test
+  $command = new LimeProcess($file, $executable);
+  $command->execute();
+  while (!$command->isClosed())
+  {
+    $output .= $command->getOutput();
+    $errors .= $command->getErrors();
+  }
+  // assertions
+  $t->is($output, 'Test', 'The output is correct');
+  $t->is($errors, 'Errors', 'The errors are correct');


Property changes on: tools/lime/branches/2.0/test/unit/LimeProcessTest.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: tools/lime/branches/2.0/test/unit/output/LimeOutputRawTest.php
===================================================================
--- tools/lime/branches/2.0/test/unit/output/LimeOutputRawTest.php      
2010-02-18 11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/test/unit/output/LimeOutputRawTest.php      
2010-02-18 16:46:32 UTC (rev 28111)
@@ -14,7 +14,7 @@
 
 LimeAnnotationSupport::enable();
 
-$t = new LimeTest(13);
+$t = new LimeTest(12);
 
 
 // @Before
@@ -40,19 +40,6 @@
   $t->is($result, serialize(array('focus', array('/test/file')))."\n", 'The 
method call is serialized');
 
 
-// @Test: A header is printed on the first call
-
-  // fixtures
-  $output = new LimeOutputRaw();
-  // test
-  ob_start();
-  $output->focus('/test/file');
-  $output->focus('/test/file');
-  $result = ob_get_clean();
-  // assertions
-  $t->is($result, "\0raw\0".serialize(array('focus', 
array('/test/file')))."\n".serialize(array('focus', array('/test/file')))."\n", 
'The method call is serialized');
-
-
 // @Test: close() prints the method call as serialized array
 
   // test

Modified: tools/lime/branches/2.0/test/unit/output/LimeOutputSuiteTest.php
===================================================================
--- tools/lime/branches/2.0/test/unit/output/LimeOutputSuiteTest.php    
2010-02-18 11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/test/unit/output/LimeOutputSuiteTest.php    
2010-02-18 16:46:32 UTC (rev 28111)
@@ -54,7 +54,7 @@
   $printer->printText(str_pad(' script', 57, '.'));
   $printer->printLine("ok", LimePrinter::OK);
   $printer->replay();
-  $file = new LimeFile('path');
+  $file = new LimeFile('path', $t->stub('LimeExecutable'));
   $file->addLabels(array('label1', 'label2'));
   $loader = $t->stub('LimeLoader');
   $loader->method('getFileByPath')->returns($file);

Modified: tools/lime/branches/2.0/test/unit/parser/LimeParserRawTest.php
===================================================================
--- tools/lime/branches/2.0/test/unit/parser/LimeParserRawTest.php      
2010-02-18 11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/test/unit/parser/LimeParserRawTest.php      
2010-02-18 16:46:32 UTC (rev 28111)
@@ -14,11 +14,12 @@
 
 LimeAnnotationSupport::enable();
 
-$t = new LimeTest(11);
+$t = new LimeTest(10);
 
 
 // @Before
 
+  $executable = LimeExecutable::php();
   $file = tempnam(sys_get_temp_dir(), 'lime');
   $output = $t->mock('LimeOutputInterface');
   $parser = new LimeParserRaw($output);
@@ -64,18 +65,6 @@
   $output->verify();
 
 
-// @Test: Method calls can be suppressed by passing the first constructor 
parameter
-
-  // fixtures
-  $output->invoke('pass')->never();
-  $output->replay();
-  $parser = new LimeParserRaw($output, array('pass'));
-  // test
-  $parser->parse(serialize(array("pass", array("A passed test", "/test/file", 
11)))."\n");
-  // assertions
-  $output->verify();
-
-
 // @Test: Two arrays are converted to two method calls
 
   // fixtures
@@ -121,7 +110,7 @@
   $output->error(new LimeError("syntax error, unexpected T_LNUMBER, expecting 
T_VARIABLE or '$'", $file, 1, 'Parse error'));
   $output->replay();
   file_put_contents($file, '<?php $1invalidname;');
-  $command = new LimeShellCommand($file);
+  $command = new LimeCommand($file, $executable);
   $command->execute();
   // test
   $parser->parse($command->getOutput());
@@ -136,7 +125,7 @@
   $output->error(new LimeError("require(): Failed opening required 
'foobar.php' (include_path='".get_include_path()."')", $file, 1, 'Fatal 
error'));
   $output->replay();
   file_put_contents($file, '<?php require "foobar.php";');
-  $command = new LimeShellCommand($file);
+  $command = new LimeCommand($file, $executable);
   $command->execute();
   // test
   $parser->parse($command->getOutput());

Modified: tools/lime/branches/2.0/test/unit/parser/LimeParserTapTest.php
===================================================================
--- tools/lime/branches/2.0/test/unit/parser/LimeParserTapTest.php      
2010-02-18 11:12:08 UTC (rev 28110)
+++ tools/lime/branches/2.0/test/unit/parser/LimeParserTapTest.php      
2010-02-18 16:46:32 UTC (rev 28111)
@@ -19,6 +19,7 @@
 
 // @Before
 
+  $executable = LimeExecutable::php();
   $file = tempnam(sys_get_temp_dir(), 'lime');
   $output = $t->mock('LimeOutputInterface');
   $parser = new LimeParserTap($output);
@@ -223,7 +224,7 @@
   $output->error(new LimeError("syntax error, unexpected T_LNUMBER, expecting 
T_VARIABLE or '$'", $file, 1, 'Parse error'));
   $output->replay();
   file_put_contents($file, '<?php $1invalidname;');
-  $command = new LimeShellCommand($file);
+  $command = new LimeCommand($file, $executable);
   $command->execute();
   // test
   $parser->parse($command->getOutput());
@@ -238,7 +239,7 @@
   $output->error(new LimeError("require(): Failed opening required 
'foobar.php' (include_path='".get_include_path()."')", $file, 1, 'Fatal 
error'));
   $output->replay();
   file_put_contents($file, '<?php require "foobar.php";');
-  $command = new LimeShellCommand($file);
+  $command = new LimeCommand($file, $executable);
   $command->execute();
   // test
   $parser->parse($command->getOutput());

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to