SlugifyProviderTest.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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\Bridge\Laravel;
  11. use Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider;
  12. use Illuminate\Foundation\Application;
  13. /**
  14. * SlugifyServiceProviderTest
  15. *
  16. * @category test
  17. * @package cocur/slugify
  18. * @subpackage bridge
  19. * @author Florian Eckerstorfer <florian@eckerstorfer.co>
  20. * @author Colin Viebrock
  21. * @copyright 2012-2014 Florian Eckerstorfer
  22. * @license http://www.opensource.org/licenses/MIT The MIT License
  23. * @group unit
  24. */
  25. class SlugifyServiceProviderTest extends \PHPUnit_Framework_TestCase
  26. {
  27. /** @var Application */
  28. private $app;
  29. /** @var SlugifyServiceProvider */
  30. private $provider;
  31. public function setUp()
  32. {
  33. $this->app = new Application();
  34. $this->provider = new SlugifyServiceProvider($this->app);
  35. }
  36. /**
  37. * @test
  38. * @covers Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider::register()
  39. */
  40. public function registerRegistersTheServiceProvider()
  41. {
  42. $this->provider->register();
  43. // the service provider is deferred, so this forces it to load
  44. $this->app->make('slugify');
  45. $this->assertArrayHasKey('slugify', $this->app);
  46. $this->assertInstanceOf('Cocur\Slugify\Slugify', $this->app['slugify']);
  47. }
  48. /**
  49. * @test
  50. * @covers Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider::provides()
  51. */
  52. public function containsReturnsTheNameOfThProvider()
  53. {
  54. $this->assertContains('slugify', $this->provider->provides());
  55. }
  56. }