EncryptionTest.php 898 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Illuminate\Tests\Integration\Encryption;
  3. use Illuminate\Encryption\Encrypter;
  4. use Illuminate\Encryption\EncryptionServiceProvider;
  5. use Orchestra\Testbench\TestCase;
  6. use RuntimeException;
  7. class EncryptionTest extends TestCase
  8. {
  9. protected function getEnvironmentSetUp($app)
  10. {
  11. $app['config']->set('app.key', 'base64:IUHRqAQ99pZ0A1MPjbuv1D6ff3jxv0GIvS2qIW4JNU4=');
  12. }
  13. protected function getPackageProviders($app)
  14. {
  15. return [EncryptionServiceProvider::class];
  16. }
  17. public function testEncryptionProviderBind()
  18. {
  19. self::assertInstanceOf(Encrypter::class, $this->app->make('encrypter'));
  20. }
  21. public function testEncryptionWillNotBeInstantiableWhenMissingAppKey()
  22. {
  23. $this->expectException(RuntimeException::class);
  24. $this->app['config']->set('app.key', null);
  25. $this->app->make('encrypter');
  26. }
  27. }