mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
Merge branch '1.x' into 2.x
* 1.x: added missing item in CHANGELOG Added pssibility to reset the profiler.
This commit is contained in:
@@ -78,6 +78,7 @@
|
||||
|
||||
* 1.35.0 (2017-XX-XX)
|
||||
|
||||
* added Twig_Profiler_Profile::reset()
|
||||
* fixed use TokenParser to return an empty Node
|
||||
* added RuntimeExtensionInterface
|
||||
* added circular reference detection when loading templates
|
||||
|
||||
@@ -149,6 +149,12 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
);
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->starts = $this->ends = $this->profiles = array();
|
||||
$this->enter();
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->profiles);
|
||||
|
||||
@@ -97,4 +97,14 @@ class Twig_Tests_Profiler_ProfileTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals($profile1->getType(), $profile3->getType());
|
||||
$this->assertEquals($profile1->getName(), $profile3->getName());
|
||||
}
|
||||
|
||||
public function testReset()
|
||||
{
|
||||
$profile = new Twig_Profiler_Profile();
|
||||
usleep(1);
|
||||
$profile->leave();
|
||||
$profile->reset();
|
||||
|
||||
$this->assertEquals(0, $profile->getDuration());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user