StopwatchHelperTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Bundle\FrameworkBundle\Templating\Helper\StopwatchHelper;
  13. class StopwatchHelperTest extends TestCase
  14. {
  15. public function testDevEnvironment()
  16. {
  17. $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
  18. $stopwatch->expects($this->once())
  19. ->method('start')
  20. ->with('foo');
  21. $helper = new StopwatchHelper($stopwatch);
  22. $helper->start('foo');
  23. }
  24. public function testProdEnvironment()
  25. {
  26. $helper = new StopwatchHelper(null);
  27. $helper->start('foo');
  28. // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
  29. // can be executed without throwing any exceptions
  30. $this->addToAssertionCount(1);
  31. }
  32. }