removed code that prevents the stopwatch to work properly
This commit is contained in:
parent
2f67776a66
commit
459097413d
@ -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
|
* @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 %}symfony2 is fun{% endstopwatch %}{% stopwatch bar %}something{% endstopwatch %}', array('foo', 'bar')),
|
||||||
array('{% stopwatch foo %}something{% endstopwatch foo %}', 'foo'),
|
array('{% stopwatch foo %}something{% endstopwatch foo %}', 'foo'),
|
||||||
array('{% stopwatch "foo.bar" %}something{% endstopwatch %}', 'foo.bar'),
|
array('{% stopwatch "foo.bar" %}something{% endstopwatch %}', 'foo.bar'),
|
||||||
|
array('{% stopwatch foo %}something{% endstopwatch foo %}{% stopwatch foo %}something else{% endstopwatch foo %}', array('foo', 'foo')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ use Symfony\Bridge\Twig\Node\StopwatchNode;
|
|||||||
class StopwatchTokenParser extends \Twig_TokenParser
|
class StopwatchTokenParser extends \Twig_TokenParser
|
||||||
{
|
{
|
||||||
protected $stopwatchIsAvailable;
|
protected $stopwatchIsAvailable;
|
||||||
protected $_events = array();
|
|
||||||
|
|
||||||
public function __construct($stopwatchIsAvailable)
|
public function __construct($stopwatchIsAvailable)
|
||||||
{
|
{
|
||||||
@ -40,11 +39,6 @@ class StopwatchTokenParser extends \Twig_TokenParser
|
|||||||
$name = $stream->expect(\Twig_Token::STRING_TYPE)->getValue();
|
$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);
|
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
|
||||||
|
|
||||||
// {% endstopwatch %} or {% endstopwatch bar %}
|
// {% endstopwatch %} or {% endstopwatch bar %}
|
||||||
|
Reference in New Issue
Block a user