SlugifySilexProviderTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * This file is part of cocur/slugify.
  4. *
  5. * (c) Florian Eckerstorfer <florian@eckerstorfer.co>
  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 Cocur\Slugify\Tests\Bridge\Silex;
  11. use Cocur\Slugify\Bridge\Silex\SlugifyServiceProvider;
  12. use Cocur\Slugify\Bridge\Twig\SlugifyExtension;
  13. use Silex\Application;
  14. use Silex\Provider\TwigServiceProvider;
  15. /**
  16. * SlugifyServiceProviderTest
  17. *
  18. * @category test
  19. * @package cocur/slugify
  20. * @subpackage bridge
  21. * @author Florian Eckerstorfer <florian@eckerstorfer.co>
  22. * @copyright 2012-2014 Florian Eckerstorfer
  23. * @license http://www.opensource.org/licenses/MIT The MIT License
  24. * @group unit
  25. */
  26. class SlugifySilexProviderTest extends \PHPUnit_Framework_TestCase
  27. {
  28. /**
  29. * @test
  30. * @covers Cocur\Slugify\Bridge\Silex\SlugifyServiceProvider
  31. */
  32. public function register()
  33. {
  34. // it seems like Application is not mockable.
  35. $app = new Application();
  36. $app->register(new SlugifyServiceProvider());
  37. $app->boot();
  38. $this->assertArrayHasKey('slugify', $app);
  39. $this->assertArrayHasKey('slugify.provider', $app);
  40. $this->assertArrayHasKey('slugify.options', $app);
  41. $this->assertInstanceOf('Cocur\Slugify\Slugify', $app['slugify']);
  42. }
  43. /**
  44. * @test
  45. */
  46. public function registerWithTwig()
  47. {
  48. $app = new Application();
  49. $app->register(new TwigServiceProvider());
  50. $app->register(new SlugifyServiceProvider());
  51. $this->assertTrue($app['twig']->hasExtension(SlugifyExtension::class));
  52. }
  53. }