Author: fabien
Date: 2010-01-27 11:45:05 +0100 (Wed, 27 Jan 2010)
New Revision: 27229
Added:
branches/2.0/tests/lib/vendor/lime/output/LimeOutputProxy.php
branches/2.0/tests/lib/vendor/lime/output/LimeOutputResult.php
Removed:
branches/2.0/tests/lib/vendor/lime/output/LimeOutput.php
branches/2.0/tests/lib/vendor/lime/output/LimeOutputInspectable.php
Modified:
branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php
branches/2.0/src/Symfony/Components/DependencyInjection/Container.php
branches/2.0/src/Symfony/Components/DependencyInjection/Definition.php
branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php
branches/2.0/src/Symfony/Components/DependencyInjection/Parameter.php
branches/2.0/src/Symfony/Components/DependencyInjection/Reference.php
branches/2.0/tests/lib/vendor/lime/LimeTestSuite.php
branches/2.0/tests/lib/vendor/lime/lexer/LimeLexer.php
branches/2.0/tests/lib/vendor/lime/lexer/LimeLexerTransformAnnotations.php
branches/2.0/tests/lib/vendor/lime/lime.php
branches/2.0/tests/lib/vendor/lime/output/LimeOutputConsoleSummary.php
branches/2.0/tests/lib/vendor/lime/output/LimeOutputTap.php
branches/2.0/tests/lib/vendor/lime/output/LimeOutputXml.php
branches/2.0/tests/lib/vendor/lime/tester/LimeTesterArray.php
branches/2.0/tests/unit/Symfony/Components/DependencyInjection/ContainerTest.php
Log:
Merge branch 'master' of git://github.com/symfony/symfony
Modified: branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php
===================================================================
--- branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -20,10 +20,9 @@
*/
class Builder extends Container
{
- protected
- $definitions = array(),
- $aliases = array(),
- $loading = array();
+ protected $definitions = array();
+ protected $aliases = array();
+ protected $loading = array();
/**
* Sets a service.
Modified: branches/2.0/src/Symfony/Components/DependencyInjection/Container.php
===================================================================
--- branches/2.0/src/Symfony/Components/DependencyInjection/Container.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/src/Symfony/Components/DependencyInjection/Container.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -52,11 +52,10 @@
*/
class Container implements ContainerInterface, \ArrayAccess, \Iterator
{
- protected
- $serviceIds = array(),
- $parameters = array(),
- $services = array(),
- $count = 0;
+ protected $serviceIds = array();
+ protected $parameters = array();
+ protected $services = array();
+ protected $count = 0;
const EXCEPTION_ON_INVALID_REFERENCE = 1;
const NULL_ON_INVALID_REFERENCE = 2;
@@ -110,7 +109,7 @@
/**
* Gets a service container parameter.
*
- * @param string $name The parameter name
+ * @param string $name The parameter name
*
* @return mixed The parameter value
*
@@ -118,12 +117,14 @@
*/
public function getParameter($name)
{
- if (!$this->hasParameter($name))
+ $name = strtolower($name);
+
+ if (!array_key_exists($name, $this->parameters))
{
throw new \InvalidArgumentException(sprintf('The parameter "%s" must be
defined.', $name));
}
- return $this->parameters[strtolower($name)];
+ return $this->parameters[$name];
}
/**
@@ -169,7 +170,7 @@
*/
public function hasService($id)
{
- return isset($this->services[$id]) || method_exists($this,
'get'.self::camelize($id).'Service');
+ return isset($this->services[$id]) || method_exists($this,
'get'.strtr($id, array('_' => '', '.' => '_')).'Service');
}
/**
@@ -194,7 +195,7 @@
throw new \InvalidArgumentException(sprintf('A service id should be a
string (%s given).', str_replace("\n", '', var_export($id, true))));
}
- if (method_exists($this, $method = 'get'.self::camelize($id).'Service'))
+ if (method_exists($this, $method = 'get'.strtr($id, array('_' => '', '.'
=> '_')).'Service'))
{
return $this->$method();
}
@@ -374,9 +375,27 @@
return $this->count > 0;
}
+ /**
+ * Catches unknown methods.
+ *
+ * @param string $method The called method name
+ * @param array $arguments The method arguments
+ *
+ * @return mixed
+ */
+ public function __call($method, $arguments)
+ {
+ if (!preg_match('/^get(.+)Service$/', $method, $match))
+ {
+ throw new \RuntimeException(sprintf('Call to undefined method %s::%s.',
get_class($this), $method));
+ }
+
+ return $this->getService(self::underscore($match[1]));
+ }
+
static public function camelize($id)
{
- return preg_replace(array('/(^|_|-)+(.)/e', '/\.(.)/e'),
array("strtoupper('\\2')", "'_'.strtoupper('\\1')"), $id);
+ return preg_replace(array('/(^|_)+(.)/e', '/\.(.)/e'),
array("strtoupper('\\2')", "'_'.strtoupper('\\1')"), $id);
}
static public function underscore($id)
Modified: branches/2.0/src/Symfony/Components/DependencyInjection/Definition.php
===================================================================
--- branches/2.0/src/Symfony/Components/DependencyInjection/Definition.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/src/Symfony/Components/DependencyInjection/Definition.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -20,14 +20,13 @@
*/
class Definition
{
- protected
- $class = null,
- $file = null,
- $constructor = null,
- $shared = true,
- $arguments = array(),
- $calls = array(),
- $configurator = null;
+ protected $class;
+ protected $file;
+ protected $constructor;
+ protected $shared;
+ protected $arguments;
+ protected $calls;
+ protected $configurator;
/**
* Constructor.
@@ -37,14 +36,16 @@
*/
public function __construct($class, array $arguments = array())
{
- $this->class = $class;
+ $this->class = $class;
$this->arguments = $arguments;
+ $this->calls = array();
+ $this->shared = true;
}
/**
* Sets the constructor method.
*
- * @param string $method The method name
+ * @param string $method The method name
*
* @return Definition The current instance
*/
@@ -68,7 +69,7 @@
/**
* Sets the service class.
*
- * @param string $class The service class
+ * @param string $class The service class
*
* @return Definition The current instance
*/
@@ -92,7 +93,7 @@
/**
* Sets the constructor arguments to pass to the service constructor.
*
- * @param array $arguments An array of arguments
+ * @param array $arguments An array of arguments
*
* @return Definition The current instance
*/
@@ -106,7 +107,7 @@
/**
* Adds a constructor argument to pass to the service constructor.
*
- * @param mixed $argument An argument
+ * @param mixed $argument An argument
*
* @return Definition The current instance
*/
@@ -130,7 +131,7 @@
/**
* Sets the methods to call after service initialization.
*
- * @param array $calls An array of method calls
+ * @param array $calls An array of method calls
*
* @return Definition The current instance
*/
@@ -148,8 +149,8 @@
/**
* Adds a method to call after service initialization.
*
- * @param string $method The method name to call
- * @param array $arguments An array of arguments to pass to
the method call
+ * @param string $method The method name to call
+ * @param array $arguments An array of arguments to pass to the method call
*
* @return Definition The current instance
*/
@@ -173,7 +174,7 @@
/**
* Sets a file to require before creating the service.
*
- * @param string $file A full pathname to include
+ * @param string $file A full pathname to include
*
* @return Definition The current instance
*/
@@ -197,7 +198,7 @@
/**
* Sets if the service must be shared or not.
*
- * @param Boolean $shared Whether the service must be shared or
not
+ * @param Boolean $shared Whether the service must be shared or not
*
* @return Definition The current instance
*/
@@ -221,7 +222,7 @@
/**
* Sets a configurator to call after the service is fully initialized.
*
- * @param mixed $callable A PHP callable
+ * @param mixed $callable A PHP callable
*
* @return Definition The current instance
*/
Modified:
branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php
===================================================================
---
branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php
2010-01-27 09:49:18 UTC (rev 27228)
+++
branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -29,7 +29,8 @@
*/
class GraphvizDumper extends Dumper
{
- protected $nodes, $edges;
+ protected $nodes;
+ protected $edges;
/**
* Dumps the service container as a graphviz graph.
Modified:
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php
===================================================================
---
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php
2010-01-27 09:49:18 UTC (rev 27228)
+++
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -138,9 +138,9 @@
foreach (array('shared', 'constructor') as $key)
{
- $method = 'set'.ucfirst($key);
if (isset($service[$key]))
{
+ $method = 'set'.ucfirst($key);
$definition->$method((string) $service->getAttributeAsPhp($key));
}
}
Modified: branches/2.0/src/Symfony/Components/DependencyInjection/Parameter.php
===================================================================
--- branches/2.0/src/Symfony/Components/DependencyInjection/Parameter.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/src/Symfony/Components/DependencyInjection/Parameter.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -20,8 +20,7 @@
*/
class Parameter
{
- protected
- $id = null;
+ protected $id;
/**
* Constructor.
Modified: branches/2.0/src/Symfony/Components/DependencyInjection/Reference.php
===================================================================
--- branches/2.0/src/Symfony/Components/DependencyInjection/Reference.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/src/Symfony/Components/DependencyInjection/Reference.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -20,7 +20,8 @@
*/
class Reference
{
- protected $id, $invalidBehavior;
+ protected $id;
+ protected $invalidBehavior;
/**
* Constructor.
Modified: branches/2.0/tests/lib/vendor/lime/LimeTestSuite.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/LimeTestSuite.php 2010-01-27
09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/LimeTestSuite.php 2010-01-27
10:45:05 UTC (rev 27229)
@@ -54,7 +54,7 @@
throw new LogicException(sprintf('The output "%s" does not support
multi-processing', $type));
}
- $this->output = new LimeOutputInspectable($output);
+ $this->output = new LimeOutputProxy($output);
}
public function run()
@@ -109,12 +109,6 @@
$this->output->flush();
- $planned = $this->output->getPlanned();
- $passed = $this->output->getPassed();
- $failed = $this->output->getFailed();
- $errors = $this->output->getErrors();
- $warnings = $this->output->getWarnings();
-
- return 0 == ($failed + $errors + $warnings) && $planned == $passed;
+ return !$this->output->getResult()->isFailed();
}
}
\ No newline at end of file
Modified: branches/2.0/tests/lib/vendor/lime/lexer/LimeLexer.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/lexer/LimeLexer.php 2010-01-27
09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/lexer/LimeLexer.php 2010-01-27
10:45:05 UTC (rev 27229)
@@ -30,7 +30,7 @@
* @package Lime
* @author Bernhard Schussek <[email protected]>
* @author Fabien Potencier <[email protected]>
- * @version SVN: $Id: LimeLexer.php 23701 2009-11-08 21:23:40Z bschussek $
+ * @version SVN: $Id: LimeLexer.php 25934 2009-12-27 20:44:07Z bschussek $
*/
abstract class LimeLexer
{
@@ -40,6 +40,7 @@
$inClassDeclaration,
$currentFunction,
$inFunctionDeclaration,
+ $inAssignment,
$endOfCurrentExpr,
$currentLine;
@@ -62,6 +63,7 @@
$this->inClassDeclaration = false;
$this->currentFunction = array();
$this->inFunctionDeclaration = false;
+ $this->inAssignment = false;
$this->endOfCurrentExpr = true;
$this->currentLine = 1;
@@ -90,8 +92,18 @@
case '}':
$this->endOfCurrentExpr = true;
break;
+ case '=':
+ $this->endOfCurrentExpr = false;
+ $this->inAssignment = true;
+ break;
}
+
+ if ($this->endOfCurrentExpr)
+ {
+ $this->inAssignment = false;
+ }
+
$this->beforeProcess($token, null);
$this->process($token, null);
$this->afterProcess($token, null);
@@ -235,6 +247,11 @@
break;
}
+ if ($this->endOfCurrentExpr)
+ {
+ $this->inAssignment = false;
+ }
+
$this->beforeProcess($text, $id);
$this->process($text, $id);
$this->afterProcess($text, $id);
@@ -346,6 +363,16 @@
}
/**
+ * Returns how many functions are currently nested inside each other.
+ *
+ * @return integer
+ */
+ protected function getFunctionNestingLevel()
+ {
+ return count($this->currentFunction);
+ }
+
+ /**
* Returns whether the current token marks the end of the last expression.
*
* @return boolean
@@ -356,6 +383,16 @@
}
/**
+ * Returns whether the current token is inside an assignment operation.
+ *
+ * @return boolean
+ */
+ protected function inAssignment()
+ {
+ return $this->inAssignment;
+ }
+
+ /**
* Tells the lexer to stop lexing.
*/
protected function stop()
Modified:
branches/2.0/tests/lib/vendor/lime/lexer/LimeLexerTransformAnnotations.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/lexer/LimeLexerTransformAnnotations.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/lexer/LimeLexerTransformAnnotations.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -54,7 +54,7 @@
*
* @package Lime
* @author Bernhard Schussek <[email protected]>
- * @version SVN: $Id: LimeLexerTransformAnnotations.php 23701 2009-11-08
21:23:40Z bschussek $
+ * @version SVN: $Id: LimeLexerTransformAnnotations.php 25934 2009-12-27
20:44:07Z bschussek $
* @see LimeLexerAnnotationAware
*/
class LimeLexerTransformAnnotations extends LimeLexerAnnotationAware
@@ -181,6 +181,27 @@
}
}
+ // Closures and anonymous functions should not be stripped from the output
+ if ($this->inFunction())
+ {
+ if ($this->inFunctionDeclaration())
+ {
+ $this->functionBuffer .= $text;
+ $text = '';
+ }
+ // if the name of the function is NULL, it is a closure/anonymous
function
+ else if (!$this->getCurrentFunction() || $this->inClass())
+ {
+ $text = $this->functionBuffer.$text;
+ $this->functionBuffer = '';
+ }
+ else
+ {
+ $text = str_repeat("\n", count(explode("\n",
$this->functionBuffer.$text)) - 1);
+ $this->functionBuffer = '';
+ }
+ }
+
if ($id == T_OPEN_TAG && !$this->initialized)
{
if (count($this->variables))
@@ -189,12 +210,8 @@
}
$this->initialized = true;
}
- else if ($this->inClass() && $this->classNotLoaded)
+ else if ($this->inClass() && !$this->classNotLoaded)
{
- // just print
- }
- else if ($this->inClass() || $this->inFunction())
- {
$text = str_repeat("\n", count(explode("\n", $text)) - 1);
}
else if ($this->inAnnotationDeclaration())
Modified: branches/2.0/tests/lib/vendor/lime/lime.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/lime.php 2010-01-27 09:49:18 UTC (rev
27228)
+++ branches/2.0/tests/lib/vendor/lime/lime.php 2010-01-27 10:45:05 UTC (rev
27229)
@@ -162,20 +162,151 @@
}
}
-class lime_output extends LimeOutput
+class lime_output
{
- public function green_bar($message)
+ const
+ ERROR = 'ERROR',
+ INFO = 'INFO',
+ PARAMETER = 'PARAMETER',
+ COMMENT = 'COMMENT',
+ GREEN_BAR = 'GREEN_BAR',
+ RED_BAR = 'RED_BAR',
+ INFO_BAR = 'INFO_BAR';
+
+ protected static
+ $styles = array(self::ERROR, self::INFO, self::PARAMETER, self::COMMENT,
self::GREEN_BAR, self::RED_BAR, self::INFO_BAR);
+
+ protected
+ $colorizer = null;
+
+ /**
+ * Constructor.
+ *
+ * @param boolean $forceColors If set to TRUE, colorization will be
enforced
+ * whether or not the current console supports
it
+ */
+ public function __construct($forceColors = false)
{
- return $this->greenBar($message);
+ if (LimeColorizer::isSupported() || $forceColors)
+ {
+ $colorizer = new LimeColorizer();
+ $colorizer->setStyle(self::ERROR, array('bg' => 'red', 'fg' => 'white',
'bold' => true));
+ $colorizer->setStyle(self::INFO, array('fg' => 'green', 'bold' => true));
+ $colorizer->setStyle(self::PARAMETER, array('fg' => 'cyan'));
+ $colorizer->setStyle(self::COMMENT, array('fg' => 'yellow'));
+ $colorizer->setStyle(self::GREEN_BAR, array('fg' => 'white', 'bg' =>
'green', 'bold' => true));
+ $colorizer->setStyle(self::RED_BAR, array('fg' => 'white', 'bg' =>
'red', 'bold' => true));
+ $colorizer->setStyle(self::INFO_BAR, array('fg' => 'cyan', 'bold' =>
true));
+
+ $this->colorizer = $colorizer;
+ }
}
- public function red_bar($message)
+ /**
+ * Colorizes the given text with the given style.
+ *
+ * @param string $text Some text
+ * @param string $style One of the predefined style constants
+ * @return string The formatted text
+ */
+ protected function colorize($text, $style)
{
- return $this->redBar($message);
+ if (!in_array($style, self::$styles))
+ {
+ throw new InvalidArgumentException(sprintf('The style "%s" does not
exist', $style));
+ }
+
+ return is_null($this->colorizer) ? $text :
$this->colorizer->colorize($text, $style);
}
+
+ /**
+ * ?
+ */
+ public function diag()
+ {
+ $messages = func_get_args();
+ foreach ($messages as $message)
+ {
+ echo $this->colorize('# '.join("\n# ", (array) $message),
self::COMMENT)."\n";
+ }
+ }
+
+ /**
+ * Prints a comment.
+ *
+ * @param string $message
+ */
+ public function comment($message)
+ {
+ echo $this->colorize(sprintf('# %s', $message), self::COMMENT)."\n";
+ }
+
+ /**
+ * Prints an informational message.
+ *
+ * @param string $message
+ */
+ public function info($message)
+ {
+ echo $this->colorize(sprintf('> %s', $message), self::INFO_BAR)."\n";
+ }
+
+ /**
+ * Prints an error.
+ *
+ * @param string $message
+ */
+ public function error($message)
+ {
+ echo $this->colorize(sprintf(' %s ', $message), self::RED_BAR)."\n";
+ }
+
+ /**
+ * Prints and automatically colorizes a line.
+ *
+ * You can wrap the whole line into a specific predefined style by passing
+ * the style constant in the second parameter.
+ *
+ * @param string $message The message to colorize
+ * @param string $style The desired style constant
+ * @param boolean $colorize Whether to automatically colorize parts of the
+ * line
+ */
+ public function echoln($message, $style = null, $colorize = true)
+ {
+ if ($colorize)
+ {
+ $message = preg_replace('/(?:^|\.)((?:not ok|dubious) *\d*)\b/e',
'$this->colorize(\'$1\', self::ERROR)', $message);
+ $message = preg_replace('/(?:^|\.)(ok *\d*)\b/e',
'$this->colorize(\'$1\', self::INFO)', $message);
+ $message = preg_replace('/"(.+?)"/e', '$this->colorize(\'$1\',
self::PARAMETER)', $message);
+ $message = preg_replace('/(\->|\:\:)?([a-zA-Z0-9_]+?)\(\)/e',
'$this->colorize(\'$1$2()\', self::PARAMETER)', $message);
+ }
+
+ echo ($style ? $this->colorize($message, $style) : $message)."\n";
+ }
+
+ /**
+ * Prints a message in a green box.
+ *
+ * @param string $message
+ */
+ public function greenBar($message)
+ {
+ echo $this->colorize($message.str_repeat(' ', 71 - min(71,
strlen($message))), self::GREEN_BAR)."\n";
+ }
+
+ /**
+ * Prints a message a in a red box.
+ *
+ * @param string $message
+ */
+ public function redBar($message)
+ {
+ echo $this->colorize($message.str_repeat(' ', 71 - min(71,
strlen($message))), self::RED_BAR)."\n";
+ }
}
-class lime_output_color extends LimeOutput
+class lime_output_color extends lime_output
{
}
Deleted: branches/2.0/tests/lib/vendor/lime/output/LimeOutput.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/output/LimeOutput.php 2010-01-27
09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/output/LimeOutput.php 2010-01-27
10:45:05 UTC (rev 27229)
@@ -1,169 +0,0 @@
-<?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.
- */
-
-/**
- * Prints text on the console in different formats.
- *
- * You can use the various methods in this class to print nicely formatted
- * text message in the console. If the console does not support text
formatting,
- * text formatting is suppressed, unless you pass the argument
$forceColors=TRUE
- * in the constructor.
- *
- * @package symfony
- * @subpackage lime
- * @author Fabien Potencier <[email protected]>
- * @author Bernhard Schussek <[email protected]>
- * @version SVN: $Id$
- */
-class LimeOutput
-{
- const
- ERROR = 'ERROR',
- INFO = 'INFO',
- PARAMETER = 'PARAMETER',
- COMMENT = 'COMMENT',
- GREEN_BAR = 'GREEN_BAR',
- RED_BAR = 'RED_BAR',
- INFO_BAR = 'INFO_BAR';
-
- protected static
- $styles = array(self::ERROR, self::INFO, self::PARAMETER, self::COMMENT,
self::GREEN_BAR, self::RED_BAR, self::INFO_BAR);
-
- protected
- $colorizer = null;
-
- /**
- * Constructor.
- *
- * @param boolean $forceColors If set to TRUE, colorization will be
enforced
- * whether or not the current console supports
it
- */
- public function __construct($forceColors = false)
- {
- if (LimeColorizer::isSupported() || $forceColors)
- {
- $colorizer = new LimeColorizer();
- $colorizer->setStyle(self::ERROR, array('bg' => 'red', 'fg' => 'white',
'bold' => true));
- $colorizer->setStyle(self::INFO, array('fg' => 'green', 'bold' => true));
- $colorizer->setStyle(self::PARAMETER, array('fg' => 'cyan'));
- $colorizer->setStyle(self::COMMENT, array('fg' => 'yellow'));
- $colorizer->setStyle(self::GREEN_BAR, array('fg' => 'white', 'bg' =>
'green', 'bold' => true));
- $colorizer->setStyle(self::RED_BAR, array('fg' => 'white', 'bg' =>
'red', 'bold' => true));
- $colorizer->setStyle(self::INFO_BAR, array('fg' => 'cyan', 'bold' =>
true));
-
- $this->colorizer = $colorizer;
- }
- }
-
- /**
- * Colorizes the given text with the given style.
- *
- * @param string $text Some text
- * @param string $style One of the predefined style constants
- * @return string The formatted text
- */
- protected function colorize($text, $style)
- {
- if (!in_array($style, self::$styles))
- {
- throw new InvalidArgumentException(sprintf('The style "%s" does not
exist', $style));
- }
-
- return is_null($this->colorizer) ? $text :
$this->colorizer->colorize($text, $style);
- }
-
- /**
- * ?
- */
- public function diag()
- {
- $messages = func_get_args();
- foreach ($messages as $message)
- {
- echo $this->colorize('# '.join("\n# ", (array) $message),
self::COMMENT)."\n";
- }
- }
-
- /**
- * Prints a comment.
- *
- * @param string $message
- */
- public function comment($message)
- {
- echo $this->colorize(sprintf('# %s', $message), self::COMMENT)."\n";
- }
-
- /**
- * Prints an informational message.
- *
- * @param string $message
- */
- public function info($message)
- {
- echo $this->colorize(sprintf('> %s', $message), self::INFO_BAR)."\n";
- }
-
- /**
- * Prints an error.
- *
- * @param string $message
- */
- public function error($message)
- {
- echo $this->colorize(sprintf(' %s ', $message), self::RED_BAR)."\n";
- }
-
- /**
- * Prints and automatically colorizes a line.
- *
- * You can wrap the whole line into a specific predefined style by passing
- * the style constant in the second parameter.
- *
- * @param string $message The message to colorize
- * @param string $style The desired style constant
- * @param boolean $colorize Whether to automatically colorize parts of the
- * line
- */
- public function echoln($message, $style = null, $colorize = true)
- {
- if ($colorize)
- {
- $message = preg_replace('/(?:^|\.)((?:not ok|dubious) *\d*)\b/e',
'$this->colorize(\'$1\', self::ERROR)', $message);
- $message = preg_replace('/(?:^|\.)(ok *\d*)\b/e',
'$this->colorize(\'$1\', self::INFO)', $message);
- $message = preg_replace('/"(.+?)"/e', '$this->colorize(\'$1\',
self::PARAMETER)', $message);
- $message = preg_replace('/(\->|\:\:)?([a-zA-Z0-9_]+?)\(\)/e',
'$this->colorize(\'$1$2()\', self::PARAMETER)', $message);
- }
-
- echo ($style ? $this->colorize($message, $style) : $message)."\n";
- }
-
- /**
- * Prints a message in a green box.
- *
- * @param string $message
- */
- public function greenBar($message)
- {
- echo $this->colorize($message.str_repeat(' ', 71 - min(71,
strlen($message))), self::GREEN_BAR)."\n";
- }
-
- /**
- * Prints a message a in a red box.
- *
- * @param string $message
- */
- public function redBar($message)
- {
- echo $this->colorize($message.str_repeat(' ', 71 - min(71,
strlen($message))), self::RED_BAR)."\n";
- }
-}
\ No newline at end of file
Modified: branches/2.0/tests/lib/vendor/lime/output/LimeOutputConsoleSummary.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/output/LimeOutputConsoleSummary.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/output/LimeOutputConsoleSummary.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -18,7 +18,7 @@
*
* @package Lime
* @author Bernhard Schussek <[email protected]>
- * @version SVN: $Id: LimeOutputConsoleSummary.php 23701 2009-11-08
21:23:40Z bschussek $
+ * @version SVN: $Id: LimeOutputConsoleSummary.php 25932 2009-12-27
19:55:32Z bschussek $
*/
class LimeOutputConsoleSummary implements LimeOutputInterface
{
@@ -27,18 +27,12 @@
$options = array(),
$startTime = 0,
$file = null,
+ $results = array(),
$actualFiles = 0,
$failedFiles = 0,
$actualTests = 0,
- $failedTests = 0,
- $expected = array(),
- $actual = array(),
- $passed = array(),
- $failed = array(),
- $errors = array(),
- $warnings = array(),
- $todos = array(),
- $line = array();
+ $expectedTests = 0,
+ $failedTests = 0;
/**
* Constructor.
@@ -64,28 +58,24 @@
public function focus($file)
{
- $this->file = $file;
-
- if (!array_key_exists($file, $this->line))
+ if (!array_key_exists($file, $this->results))
{
- $this->line[$file] = count($this->line);
- $this->expected[$file] = 0;
- $this->actual[$file] = 0;
- $this->passed[$file] = 0;
- $this->failed[$file] = array();
- $this->errors[$file] = array();
- $this->warnings[$file] = array();
- $this->todos[$file] = array();
+ $this->results[$file] = new LimeOutputResult();
}
+
+ $this->file = $file;
}
public function close()
{
if (!is_null($this->file))
{
+ $result = $this->results[$this->file];
+
$this->actualFiles++;
- $this->actualTests += $this->getActual();
- $this->failedTests += $this->getFailed();
+ $this->actualTests += $result->getNbActual();
+ $this->expectedTests += $result->getNbExpected();
+ $this->failedTests += $result->getNbFailures();
$path = $this->truncate($this->file);
@@ -96,14 +86,12 @@
$this->printer->printText(str_pad($path, 73, '.'));
- $incomplete = ($this->getExpected() > 0 && $this->getActual() !=
$this->getExpected());
-
- if ($this->getErrors() || $this->getFailed() || $incomplete)
+ if ($result->hasErrors() || $result->hasFailures() ||
$result->isIncomplete())
{
$this->failedFiles++;
$this->printer->printLine("not ok", LimePrinter::NOT_OK);
}
- else if ($this->getWarnings())
+ else if ($result->hasWarnings())
{
$this->printer->printLine("warning", LimePrinter::WARNING);
}
@@ -112,29 +100,29 @@
$this->printer->printLine("ok", LimePrinter::OK);
}
- if ($this->getExpected() > 0 && $this->getActual() !=
$this->getExpected())
+ if ($result->isIncomplete())
{
$this->printer->printLine(' Plan Mismatch:', LimePrinter::COMMENT);
- if ($this->getActual() > $this->getExpected())
+ if ($result->getNbActual() > $result->getNbExpected())
{
- $this->printer->printLine(sprintf(' Looks like you only planned
%s tests but ran %s.', $this->getExpected(), $this->getActual()));
+ $this->printer->printLine(sprintf(' Looks like you only planned
%s tests but ran %s.', $result->getNbExpected(), $result->getNbActual()));
}
else
{
- $this->printer->printLine(sprintf(' Looks like you planned %s
tests but only ran %s.', $this->getExpected(), $this->getActual()));
+ $this->printer->printLine(sprintf(' Looks like you planned %s
tests but only ran %s.', $result->getNbExpected(), $result->getNbActual()));
}
}
- if ($this->getFailed())
+ if ($result->hasFailures())
{
$this->printer->printLine(' Failed Tests:', LimePrinter::COMMENT);
$i = 0;
- foreach ($this->failed[$this->file] as $number => $failed)
+ foreach ($result->getFailures() as $number => $failed)
{
if (!$this->options['verbose'] && $i > 2)
{
- $this->printer->printLine(sprintf(' ... and %s more',
$this->getFailed()-$i));
+ $this->printer->printLine(sprintf(' ... and %s more',
$result->getNbFailures()-$i));
break;
}
@@ -144,15 +132,15 @@
}
}
- if ($this->getWarnings())
+ if ($result->hasWarnings())
{
$this->printer->printLine(' Warnings:', LimePrinter::COMMENT);
- foreach ($this->warnings[$this->file] as $i => $warning)
+ foreach ($result->getWarnings() as $i => $warning)
{
if (!$this->options['verbose'] && $i > 2)
{
- $this->printer->printLine(sprintf(' ... and %s more',
$this->getWarnings()-$i));
+ $this->printer->printLine(sprintf(' ... and %s more',
$result->getNbWarnings()-$i));
break;
}
@@ -169,15 +157,15 @@
}
}
- if ($this->getErrors())
+ if ($result->hasErrors())
{
$this->printer->printLine(' Errors:', LimePrinter::COMMENT);
- foreach ($this->errors[$this->file] as $i => $error)
+ foreach ($result->getErrors() as $i => $error)
{
if (!$this->options['verbose'] && $i > 2)
{
- $this->printer->printLine(sprintf(' ... and %s more',
$this->getErrors()-$i));
+ $this->printer->printLine(sprintf(' ... and %s more',
$result->getNbErrors()-$i));
break;
}
@@ -194,15 +182,15 @@
}
}
- if ($this->getTodos())
+ if ($result->hasTodos())
{
$this->printer->printLine(' TODOs:', LimePrinter::COMMENT);
- foreach ($this->todos[$this->file] as $i => $todo)
+ foreach ($result->getTodos() as $i => $todo)
{
if (!$this->options['verbose'] && $i > 2)
{
- $this->printer->printLine(sprintf(' ... and %s more',
$this->getTodos()-$i));
+ $this->printer->printLine(sprintf(' ... and %s more',
$result->getNbTodos()-$i));
break;
}
@@ -212,77 +200,39 @@
}
}
- protected function getExpected()
- {
- return $this->expected[$this->file];
- }
-
- protected function getActual()
- {
- return $this->actual[$this->file];
- }
-
- protected function getPassed()
- {
- return $this->passed[$this->file];
- }
-
- protected function getFailed()
- {
- return count($this->failed[$this->file]);
- }
-
- protected function getErrors()
- {
- return count($this->errors[$this->file]);
- }
-
- protected function getWarnings()
- {
- return count($this->warnings[$this->file]);
- }
-
- protected function getTodos()
- {
- return count($this->todos[$this->file]);
- }
-
public function plan($amount)
{
- $this->expected[$this->file] = $amount;
+ $this->results[$this->file]->addPlan($amount);
}
public function pass($message, $file, $line)
{
- $this->passed[$this->file]++;
- $this->actual[$this->file]++;
+ $this->results[$this->file]->addPassed();
}
public function fail($message, $file, $line, $error = null)
{
- $this->actual[$this->file]++;
- $this->failed[$this->file][$this->actual[$this->file]] = array($message,
$file, $line, $error);
+ $this->results[$this->file]->addFailure(array($message, $file, $line,
$error));
}
public function skip($message, $file, $line)
{
- $this->actual[$this->file]++;
+ $this->results[$this->file]->addSkipped();
}
public function todo($message, $file, $line)
{
- $this->actual[$this->file]++;
- $this->todos[$this->file][] = $message;
+ $this->results[$this->file]->addTodo($message);
}
public function warning($message, $file, $line)
{
- $this->warnings[$this->file][] = array($message, $file, $line);
+ $this->results[$this->file]->addWarning(array($message, $file, $line));
}
public function error(LimeError $error)
{
- $this->errors[$this->file][] = $error;
+ $this->results[$this->file]->addError($error);
}
public function comment($message) {}
@@ -293,7 +243,7 @@
{
$stats = sprintf(' Failed %d/%d test scripts, %.2f%% okay. %d/%d
subtests failed, %.2f%% okay.',
$this->failedFiles, $this->actualFiles, 100 -
100*$this->failedFiles/max(1,$this->actualFiles),
- $this->failedTests, $this->actualTests, 100 -
100*$this->failedTests/max(1,$this->actualTests));
+ $this->failedTests, $this->expectedTests, 100 -
100*$this->failedTests/max(1,$this->expectedTests));
$this->printer->printBox($stats, LimePrinter::NOT_OK);
}
Deleted: branches/2.0/tests/lib/vendor/lime/output/LimeOutputInspectable.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/output/LimeOutputInspectable.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/output/LimeOutputInspectable.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -1,140 +0,0 @@
-<?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.
- */
-
-class LimeOutputInspectable implements LimeOutputInterface
-{
- private
- $output = null,
- $planned = 0,
- $passed = 0,
- $failed = 0,
- $skipped = 0,
- $todos = 0,
- $errors = 0,
- $warnings = 0,
- $failedFiles = array();
-
- public function __construct(LimeOutputInterface $output = null)
- {
- $this->output = is_null($output) ? new LimeOutputNone() : $output;
- }
-
- public function supportsThreading()
- {
- return $this->output->supportsThreading();
- }
-
- public function getPlanned()
- {
- return $this->planned;
- }
-
- public function getPassed()
- {
- return $this->passed;
- }
-
- public function getFailed()
- {
- return $this->failed;
- }
-
- public function getSkipped()
- {
- return $this->skipped;
- }
-
- public function getTodos()
- {
- return $this->todos;
- }
-
- public function getErrors()
- {
- return $this->errors;
- }
-
- public function getWarnings()
- {
- return $this->warnings;
- }
-
- public function getFailedFiles()
- {
- return $this->failedFiles;
- }
-
- public function focus($file)
- {
- $this->output->focus($file);
- }
-
- public function close()
- {
- $this->output->close();
- }
-
- public function plan($amount)
- {
- $this->planned += $amount;
- $this->output->plan($amount);
- }
-
- public function pass($message, $file, $line)
- {
- $this->passed++;
- $this->output->pass($message, $file, $line);
- }
-
- public function fail($message, $file, $line, $error = null)
- {
- $this->failed++;
- $this->failedFiles[] = $file;
- $this->output->fail($message, $file, $line, $error);
- }
-
- public function skip($message, $file, $line)
- {
- $this->skipped++;
- $this->output->skip($message, $file, $line);
- }
-
- public function todo($message, $file, $line)
- {
- $this->todos++;
- $this->output->todo($message, $file, $line);
- }
-
- public function warning($message, $file, $line)
- {
- $this->warnings++;
- $this->failedFiles[] = $file;
- $this->output->warning($message, $file, $line);
- }
-
- public function error(LimeError $error)
- {
- $this->errors++;
- $this->failedFiles[] = $error->getFile();
- $this->output->error($error);
- }
-
- public function comment($message)
- {
- $this->output->comment($message);
- }
-
- public function flush()
- {
- $this->output->flush();
- }
-}
\ No newline at end of file
Copied: branches/2.0/tests/lib/vendor/lime/output/LimeOutputProxy.php (from rev
27033, branches/2.0/tests/lib/vendor/lime/output/LimeOutputInspectable.php)
===================================================================
--- branches/2.0/tests/lib/vendor/lime/output/LimeOutputProxy.php
(rev 0)
+++ branches/2.0/tests/lib/vendor/lime/output/LimeOutputProxy.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -0,0 +1,110 @@
+<?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.
+ */
+
+class LimeOutputProxy implements LimeOutputInterface
+{
+ private
+ $output = null,
+ $result = null;
+
+ public function __construct(LimeOutputInterface $output = null)
+ {
+ $this->output = is_null($output) ? new LimeOutputNone() : $output;
+ $this->result = new LimeOutputResult();
+ }
+
+ public function supportsThreading()
+ {
+ return $this->output->supportsThreading();
+ }
+
+ public function getResult()
+ {
+ return $this->result;
+ }
+
+ /**
+ * For BC with lime_harness.
+ *
+ * @deprecated
+ * @return array
+ */
+ public function getFailedFiles()
+ {
+ return $this->failedFiles;
+ }
+
+ public function focus($file)
+ {
+ $this->output->focus($file);
+ }
+
+ public function close()
+ {
+ $this->output->close();
+ }
+
+ public function plan($amount)
+ {
+ $this->result->addPlan($amount);
+ $this->output->plan($amount);
+ }
+
+ public function pass($message, $file, $line)
+ {
+ $this->result->addPassed();
+ $this->output->pass($message, $file, $line);
+ }
+
+ public function fail($message, $file, $line, $error = null)
+ {
+ $this->result->addFailure(array($message, $file, $line, $error));
+ $this->failedFiles[] = $file;
+ $this->output->fail($message, $file, $line, $error);
+ }
+
+ public function skip($message, $file, $line)
+ {
+ $this->result->addSkipped();
+ $this->output->skip($message, $file, $line);
+ }
+
+ public function todo($message, $file, $line)
+ {
+ $this->result->addTodo($message);
+ $this->output->todo($message, $file, $line);
+ }
+
+ public function warning($message, $file, $line)
+ {
+ $this->result->addWarning(array($message, $file, $line));
+ $this->failedFiles[] = $file;
+ $this->output->warning($message, $file, $line);
+ }
+
+ public function error(LimeError $error)
+ {
+ $this->result->addError($error);
+ $this->failedFiles[] = $error->getFile();
+ $this->output->error($error);
+ }
+
+ public function comment($message)
+ {
+ $this->output->comment($message);
+ }
+
+ public function flush()
+ {
+ $this->output->flush();
+ }
+}
\ No newline at end of file
Property changes on:
branches/2.0/tests/lib/vendor/lime/output/LimeOutputProxy.php
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/2.0/tests/lib/vendor/lime/output/LimeOutputResult.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/output/LimeOutputResult.php
(rev 0)
+++ branches/2.0/tests/lib/vendor/lime/output/LimeOutputResult.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -0,0 +1,277 @@
+<?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.
+ */
+
+/**
+ * Collects and interprets the input of a LimeOutput... instance.
+ *
+ * @package Lime
+ * @author Bernhard Schussek <[email protected]>
+ * @version SVN: $Id: LimeOutputResult.php 25932 2009-12-27 19:55:32Z
bschussek $
+ */
+class LimeOutputResult
+{
+ private
+ $nbExpected = null,
+ $nbActual = 0,
+ $nbPassed = 0,
+ $failures = array(),
+ $errors = array(),
+ $warnings = array(),
+ $todos = array();
+
+ /**
+ * Adds the given amount of tests to the test plan.
+ *
+ * @param integer $plan
+ */
+ public function addPlan($plan)
+ {
+ $this->nbExpected += $plan;
+ }
+
+ /**
+ * Adds a passed test.
+ */
+ public function addPassed()
+ {
+ $this->nbActual++;
+ $this->nbPassed++;
+ }
+
+ /**
+ * Adds a failed test.
+ *
+ * @param array $failure The test failure. An array with the failure
message,
+ * the script, the line in the script and optionally
+ * the specific error.
+ */
+ public function addFailure(array $failure)
+ {
+ $this->nbActual++;
+ $this->failures[] = $failure;
+ }
+
+ /**
+ * Adds a skipped test.
+ */
+ public function addSkipped()
+ {
+ $this->nbActual++;
+ $this->nbPassed++;
+ }
+
+ /**
+ * Adds a todo.
+ *
+ * @param string $text The todo message.
+ */
+ public function addTodo($text)
+ {
+ $this->nbActual++;
+ $this->todos[] = $text;
+ }
+
+ /**
+ * Adds a test error.
+ *
+ * @param LimeError $error The error.
+ */
+ public function addError(LimeError $error)
+ {
+ $this->errors[] = $error;
+ }
+
+ /**
+ * Adds a test warning.
+ *
+ * @param array $warning An array with the warning message, the path of the
+ * test script and the line of the test script where
+ * the warning occurred.
+ */
+ public function addWarning(array $warning)
+ {
+ $this->warnings[] = $warning;
+ }
+
+ /**
+ * Returns the actual number of tests.
+ *
+ * @return integer
+ */
+ public function getNbActual()
+ {
+ return $this->nbActual;
+ }
+
+ /**
+ * Returns the expected number of tests.
+ *
+ * @return integer
+ */
+ public function getNbExpected()
+ {
+ return is_null($this->nbExpected) ? $this->nbActual : $this->nbExpected;
+ }
+
+ /**
+ * Returns the number of passed tests.
+ *
+ * @return integer
+ */
+ public function getNbPassed()
+ {
+ return $this->nbPassed;
+ }
+
+ /**
+ * Returns the number of failed tests.
+ *
+ * @return integer
+ */
+ public function getNbFailures()
+ {
+ return count($this->failures);
+ }
+
+ /**
+ * Returns the test failures.
+ *
+ * @return array
+ */
+ public function getFailures()
+ {
+ return $this->failures;
+ }
+
+ /**
+ * Returns whether the test has any failures.
+ *
+ * @return boolean
+ */
+ public function hasFailures()
+ {
+ return $this->getNbFailures() > 0;
+ }
+
+ /**
+ * Returns the number of test errors.
+ *
+ * @return integer
+ */
+ public function getNbErrors()
+ {
+ return count($this->errors);
+ }
+
+ /**
+ * Returns the test errors.
+ *
+ * @return array
+ */
+ public function getErrors()
+ {
+ return $this->errors;
+ }
+
+ /**
+ * Returns whether the test has any errors.
+ *
+ * @return boolean
+ */
+ public function hasErrors()
+ {
+ return $this->getNbErrors() > 0;
+ }
+
+ /**
+ * Returns the number of test warnings.
+ *
+ * @return integer
+ */
+ public function getNbWarnings()
+ {
+ return count($this->warnings);
+ }
+
+ /**
+ * Returns the test warnings.
+ *
+ * @return array
+ */
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+
+ /**
+ * Returns whether the test has any warnings.
+ *
+ * @return boolean
+ */
+ public function hasWarnings()
+ {
+ return $this->getNbWarnings() > 0;
+ }
+
+ /**
+ * Returns the number of todos.
+ *
+ * @return integer
+ */
+ public function getNbTodos()
+ {
+ return count($this->todos);
+ }
+
+ /**
+ * Returns the todos.
+ *
+ * @return integer
+ */
+ public function getTodos()
+ {
+ return $this->todos;
+ }
+
+ /**
+ * Returns whether the test has any todos.
+ *
+ * @return boolean
+ */
+ public function hasTodos()
+ {
+ return $this->getNbTodos() > 0;
+ }
+
+ /**
+ * Returns whether not all expected tests have been executed.
+ *
+ * @return boolean
+ */
+ public function isIncomplete()
+ {
+ return $this->nbExpected > 0 && $this->nbActual != $this->nbExpected;
+ }
+
+ /**
+ * Returns whether the test has failed.
+ *
+ * A test is considered failed, if any test case failed, any error occurred
+ * or the test is incomplete, i.e. not all expected tests have been executed.
+ *
+ * @return boolean
+ */
+ public function isFailed()
+ {
+ return $this->hasErrors() || $this->hasFailures() || $this->isIncomplete();
+ }
+}
\ No newline at end of file
Property changes on:
branches/2.0/tests/lib/vendor/lime/output/LimeOutputResult.php
___________________________________________________________________
Added: svn:executable
+ *
Modified: branches/2.0/tests/lib/vendor/lime/output/LimeOutputTap.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/output/LimeOutputTap.php 2010-01-27
09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/output/LimeOutputTap.php 2010-01-27
10:45:05 UTC (rev 27229)
@@ -14,6 +14,7 @@
{
protected
$options = array(),
+ $result = null,
$expected = null,
$passed = 0,
$actual = 0,
@@ -25,6 +26,7 @@
public function __construct(LimePrinter $printer, array $options = array())
{
$this->printer = $printer;
+ $this->result = new LimeOutputResult();
$this->options = array_merge(array(
'verbose' => false,
'base_dir' => null,
@@ -57,36 +59,35 @@
public function plan($amount)
{
- $this->expected += $amount;
+ $this->result->addPlan($amount);
}
public function pass($message, $file, $line)
{
- $this->actual++;
- $this->passed++;
+ $this->result->addPassed();
if (empty($message))
{
- $this->printer->printLine('ok '.$this->actual, LimePrinter::OK);
+ $this->printer->printLine('ok '.$this->result->getNbActual(),
LimePrinter::OK);
}
else
{
- $this->printer->printText('ok '.$this->actual, LimePrinter::OK);
+ $this->printer->printText('ok '.$this->result->getNbActual(),
LimePrinter::OK);
$this->printer->printLine(' - '.$message);
}
}
public function fail($message, $file, $line, $error = null)
{
- $this->actual++;
+ $this->result->addFailure(array($message, $file, $line, $error));
if (empty($message))
{
- $this->printer->printLine('not ok '.$this->actual, LimePrinter::NOT_OK);
+ $this->printer->printLine('not ok '.$this->result->getNbActual(),
LimePrinter::NOT_OK);
}
else
{
- $this->printer->printText('not ok '.$this->actual, LimePrinter::NOT_OK);
+ $this->printer->printText('not ok '.$this->result->getNbActual(),
LimePrinter::NOT_OK);
$this->printer->printLine(' - '.$message);
}
@@ -103,17 +104,16 @@
public function skip($message, $file, $line)
{
- $this->actual++;
- $this->passed++;
+ $this->result->addSkipped();
if (empty($message))
{
- $this->printer->printText('ok '.$this->actual, LimePrinter::SKIP);
+ $this->printer->printText('ok '.$this->result->getNbActual(),
LimePrinter::SKIP);
$this->printer->printText(' ');
}
else
{
- $this->printer->printText('ok '.$this->actual, LimePrinter::SKIP);
+ $this->printer->printText('ok '.$this->result->getNbActual(),
LimePrinter::SKIP);
$this->printer->printText(' - '.$message.' ');
}
@@ -122,17 +122,16 @@
public function todo($message, $file, $line)
{
- $this->actual++;
- $this->passed++;
+ $this->result->addTodo($message);
if (empty($message))
{
- $this->printer->printText('not ok '.$this->actual, LimePrinter::TODO);
+ $this->printer->printText('not ok '.$this->result->getNbActual(),
LimePrinter::TODO);
$this->printer->printText(' ');
}
else
{
- $this->printer->printText('not ok '.$this->actual, LimePrinter::TODO);
+ $this->printer->printText('not ok '.$this->result->getNbActual(),
LimePrinter::TODO);
$this->printer->printText(' - '.$message.' ');
}
@@ -141,7 +140,7 @@
public function warning($message, $file, $line)
{
- $this->warnings++;
+ $this->result->addWarning(array($message, $file, $line));
$message .= sprintf("\n(in %s on line %s)", $this->stripBaseDir($file),
$line);
@@ -150,7 +149,7 @@
public function error(LimeError $error)
{
- $this->errors++;
+ $this->result->addError($error);
$message = sprintf("%s: %s\n(in %s on line %s)", $error->getType(),
$error->getMessage(), $this->stripBaseDir($error->getFile()),
$error->getLine());
@@ -261,15 +260,11 @@
public function flush()
{
- if (is_null($this->expected))
- {
- $this->plan($this->actual);
- }
+ $result = $this->result;
+ $this->printer->printLine('1..'.$result->getNbExpected());
- $this->printer->printLine('1..'.$this->expected);
+ $messages = self::getMessages($result->getNbActual(),
$result->getNbExpected(), $result->getNbPassed(), $result->getNbErrors(),
$result->getNbWarnings());
- $messages = self::getMessages($this->actual, $this->expected,
$this->passed, $this->errors, $this->warnings);
-
foreach ($messages as $message)
{
list ($message, $style) = $message;
Modified: branches/2.0/tests/lib/vendor/lime/output/LimeOutputXml.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/output/LimeOutputXml.php 2010-01-27
09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/output/LimeOutputXml.php 2010-01-27
10:45:05 UTC (rev 27229)
@@ -13,7 +13,7 @@
class LimeOutputXml implements LimeOutputInterface
{
protected
- $ouptut = null;
+ $output = null;
public function __construct()
{
Modified: branches/2.0/tests/lib/vendor/lime/tester/LimeTesterArray.php
===================================================================
--- branches/2.0/tests/lib/vendor/lime/tester/LimeTesterArray.php
2010-01-27 09:49:18 UTC (rev 27228)
+++ branches/2.0/tests/lib/vendor/lime/tester/LimeTesterArray.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -215,12 +215,12 @@
foreach ($this->value as $k => $v)
{
- if ((is_null($key) || $key != $k) && !$truncated)
+ if ((is_null($key) || $key !== $k) && !$truncated)
{
$result .= " ...\n";
$truncated = true;
}
- else if ($k == $key)
+ else if ($k === $key)
{
$value = is_null($value) ? $v : $value;
$result .= sprintf(" %s => %s,\n", var_export($k, true),
$this->indent($value));
Modified:
branches/2.0/tests/unit/Symfony/Components/DependencyInjection/ContainerTest.php
===================================================================
---
branches/2.0/tests/unit/Symfony/Components/DependencyInjection/ContainerTest.php
2010-01-27 09:49:18 UTC (rev 27228)
+++
branches/2.0/tests/unit/Symfony/Components/DependencyInjection/ContainerTest.php
2010-01-27 10:45:05 UTC (rev 27229)
@@ -14,7 +14,7 @@
$fixturesPath =
__DIR__.'/../../../../fixtures/Symfony/Components/DependencyInjection/';
-$t = new LimeTest(41);
+$t = new LimeTest(43);
// __construct()
$t->diag('__construct()');
@@ -206,3 +206,19 @@
'foo.baz' => spl_object_hash($sc->__foo_baz),
'foo' => spl_object_hash($foo)),
'Container implements the Iterator interface');
+
+// __call()
+$t->diag('__call()');
+$sc = new Container();
+$sc->setService('foo_bar.foo', $foo = new stdClass());
+$t->is($sc->getFooBar_FooService(), $foo, '__call() finds services is the
method is getXXXService()');
+
+try
+{
+ $sc->getFooBar_Foo();
+ $t->pass('__call() throws a \RuntimeException exception if the method is not
a service method');
+}
+catch (\RuntimeException $e)
+{
+ $t->pass('__call() throws a \RuntimeException exception if the method is not
a service method');
+}
--
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.