BreakpointExtensionTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /*
  3. * AJGL Breakpoint Twig Extension Component
  4. *
  5. * Copyright (C) Antonio J. García Lagar <aj@garcialagar.es>
  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 Ajgl\Twig\Extension\Tests;
  11. use Ajgl\Twig\Extension\BreakpointExtension;
  12. use PHPUnit\Framework\TestCase;
  13. use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
  14. use Twig\TwigFunction;
  15. /**
  16. * @author Antonio J. García Lagar <aj@garcialagar.es>
  17. */
  18. class BreakpointExtensionTest extends TestCase
  19. {
  20. use SetUpTearDownTrait;
  21. /**
  22. * @var BreakpointExtension
  23. */
  24. protected $extension;
  25. protected function doSetUp()
  26. {
  27. $this->extension = new BreakpointExtension();
  28. }
  29. public function testGetName()
  30. {
  31. $this->assertSame('breakpoint', $this->extension->getName());
  32. }
  33. public function testGetFunctions()
  34. {
  35. $functions = $this->extension->getFunctions();
  36. $this->assertCount(1, $functions);
  37. $function = reset($functions);
  38. $this->assertInstanceOf(TwigFunction::class, $function);
  39. $callable = $function->getCallable();
  40. $this->assertTrue(is_array($callable));
  41. $this->assertCount(2, $callable);
  42. $this->assertSame($this->extension, $callable[0]);
  43. $this->assertSame('setBreakpoint', $callable[1]);
  44. }
  45. }