REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.44 KB
Close
/opt/alt/php53/usr/share/pear/test/TwigBridge/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php
Text
Base64
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Tests\Extension; use Symfony\Bridge\Twig\Extension\StopwatchExtension; class StopwatchExtensionTest extends \PHPUnit_Framework_TestCase { /** * @expectedException \Twig_Error_Syntax */ public function testFailIfStoppingWrongEvent() { $this->testTiming('{% stopwatch "foo" %}{% endstopwatch "bar" %}', array()); } /** * @dataProvider getTimingTemplates */ public function testTiming($template, $events) { $twig = new \Twig_Environment(new \Twig_Loader_String(), array('debug' => true, 'cache' => false, 'autoescape' => true, 'optimizations' => 0)); $twig->addExtension(new StopwatchExtension($this->getStopwatch($events))); try { $nodes = $twig->render($template); } catch (\Twig_Error_Runtime $e) { throw $e->getPrevious(); } } public function getTimingTemplates() { return array( array('{% stopwatch "foo" %}something{% endstopwatch %}', 'foo'), array('{% stopwatch "foo" %}symfony2 is fun{% endstopwatch %}{% stopwatch "bar" %}something{% endstopwatch %}', array('foo', 'bar')), array('{% set foo = "foo" %}{% stopwatch foo %}something{% endstopwatch %}', 'foo'), array('{% set foo = "foo" %}{% stopwatch foo %}something {% set foo = "bar" %}{% endstopwatch %}', 'foo'), array('{% stopwatch "foo.bar" %}something{% endstopwatch %}', 'foo.bar'), array('{% stopwatch "foo" %}something{% endstopwatch %}{% stopwatch "foo" %}something else{% endstopwatch %}', array('foo', 'foo')), ); } protected function getStopwatch($events = array()) { $events = is_array($events) ? $events : array($events); $stopwatch = $this->getMock('Symfony\Component\Stopwatch\Stopwatch'); $i = -1; foreach ($events as $eventName) { $stopwatch->expects($this->at(++$i)) ->method('start') ->with($this->equalTo($eventName), 'template') ; $stopwatch->expects($this->at(++$i)) ->method('stop') ->with($this->equalTo($eventName)) ; } return $stopwatch; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 15
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Fixtures
DIR
-
drwxr-xr-x
2024-03-03 22:55:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
child_label.html.twig
86 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CodeExtensionTest.php
1.99 KB
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
custom_widgets.html.twig
420 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ExpressionExtensionTest.php
897 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FormExtensionDivLayoutTest.php
6.28 KB
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FormExtensionTableLayoutTest.php
3.58 KB
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HttpKernelExtensionTest.php
2.56 KB
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
page_dynamic_extends.html.twig
51 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
parent_label.html.twig
75 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RoutingExtensionTest.php
1.94 KB
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
StopwatchExtensionTest.php
2.44 KB
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
theme.html.twig
239 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
theme_extends.html.twig
282 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
theme_use.html.twig
278 B
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TranslationExtensionTest.php
7.41 KB
lrw-r--r--
2019-12-18 11:20:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).