removed code that prevents the stopwatch to work properly

This commit is contained in:
Fabien Potencier 2013-08-11 22:43:28 +02:00
parent 2f67776a66
commit 459097413d
2 changed files with 1 additions and 14 deletions

View File

@ -26,14 +26,6 @@ class StopwatchExtensionTest extends TestCase
}
}
/**
* @expectedException \Twig_Error_Syntax
*/
public function testFailIfNameAlreadyExists()
{
$this->testTiming('{% stopwatch foo %}{% endstopwatch %}{% stopwatch foo %}{% endstopwatch %}', array());
}
/**
* @expectedException \Twig_Error_Syntax
*/
@ -64,6 +56,7 @@ class StopwatchExtensionTest extends TestCase
array('{% stopwatch foo %}symfony2 is fun{% endstopwatch %}{% stopwatch bar %}something{% endstopwatch %}', array('foo', 'bar')),
array('{% stopwatch foo %}something{% endstopwatch foo %}', 'foo'),
array('{% stopwatch "foo.bar" %}something{% endstopwatch %}', 'foo.bar'),
array('{% stopwatch foo %}something{% endstopwatch foo %}{% stopwatch foo %}something else{% endstopwatch foo %}', array('foo', 'foo')),
);
}

View File

@ -21,7 +21,6 @@ use Symfony\Bridge\Twig\Node\StopwatchNode;
class StopwatchTokenParser extends \Twig_TokenParser
{
protected $stopwatchIsAvailable;
protected $_events = array();
public function __construct($stopwatchIsAvailable)
{
@ -40,11 +39,6 @@ class StopwatchTokenParser extends \Twig_TokenParser
$name = $stream->expect(\Twig_Token::STRING_TYPE)->getValue();
}
if (in_array($name, $this->_events)) {
throw new \Twig_Error_Syntax(sprintf('The stopwatch event "%s" has already been defined.', $name));
}
$this->_events[] = $name;
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
// {% endstopwatch %} or {% endstopwatch bar %}