SlugifyProviderTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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(): void
  33. {
  34. $this->app = new Application();
  35. $this->provider = new SlugifyServiceProvider($this->app);
  36. }
  37. /**
  38. * @covers \Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider::register()
  39. */
  40. public function testRegisterRegistersTheServiceProvider()
  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. * @covers \Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider::provides()
  50. */
  51. public function testContainsReturnsTheNameOfThProvider()
  52. {
  53. $this->assertContains('slugify', $this->provider->provides());
  54. }
  55. }