SlugifyProviderTest.php 1.8 KB

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