Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit aa3f3c7

Browse files
committed
Add laravel 6 support
1 parent 5b347e6 commit aa3f3c7

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ composer.lock
33
docs
44
vendor
55
coverage
6-
.idea
6+
.idea
7+
.phpunit.result.cache

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
],
1818
"require": {
1919
"php": "^7.1",
20-
"illuminate/encryption": "5.6.*"
20+
"illuminate/encryption": "5.6.*|5.7.*|5.8.*|^6.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^7.0",
24-
"orchestra/testbench": "~3.6"
23+
"phpunit/phpunit": "^7.0|^8.0",
24+
"orchestra/testbench": "~3.6|~3.7|~3.8|^4.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

src/CredentialsServiceProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace BeyondCode\Credentials;
44

5+
use Illuminate\Support\Arr;
56
use Illuminate\Support\Str;
67
use Illuminate\Encryption\Encrypter;
78
use Illuminate\Support\ServiceProvider;
@@ -28,8 +29,8 @@ public function boot()
2829

2930
protected function fixConfig()
3031
{
31-
collect(array_dot(config()->all()))->filter(function ($item) {
32-
return is_string($item) && starts_with($item, Credentials::CONFIG_PREFIX);
32+
collect(Arr::dot(config()->all()))->filter(function ($item) {
33+
return is_string($item) && Str::startsWith($item, Credentials::CONFIG_PREFIX);
3334
})->map(function ($item, $key) {
3435
$item = str_replace_first(Credentials::CONFIG_PREFIX, '', $item);
3536

tests/CredentialTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace BeyondCode\Credentials\Tests;
44

5+
use Illuminate\Support\Str;
56
use Orchestra\Testbench\TestCase;
67
use Illuminate\Encryption\Encrypter;
78
use BeyondCode\Credentials\Credentials;
@@ -14,15 +15,15 @@ protected function getPackageProviders($app)
1415
return [CredentialsServiceProvider::class];
1516
}
1617

17-
public function tearDown()
18+
public function tearDown(): void
1819
{
1920
@unlink(__DIR__ . '/temp/credentials.php.enc');
2021
}
2122

2223
/** @test */
2324
public function it_can_load_encrypted_files()
2425
{
25-
$masterKey = str_random(16);
26+
$masterKey = Str::random(16);
2627

2728
// create fake credentials
2829
$encrypter = new Encrypter($masterKey);
@@ -44,7 +45,7 @@ public function it_can_load_encrypted_files()
4445
/** @test */
4546
public function it_can_store_data_encrypted()
4647
{
47-
$masterKey = str_random(16);
48+
$masterKey = Str::random(16);
4849

4950
$encrypter = new Encrypter($masterKey);
5051

@@ -64,7 +65,7 @@ public function it_can_store_data_encrypted()
6465
/** @test */
6566
public function it_returns_decrypted_data()
6667
{
67-
$masterKey = str_random(16);
68+
$masterKey = Str::random(16);
6869

6970
// create fake credentials
7071
$encrypter = new Encrypter($masterKey);
@@ -91,7 +92,7 @@ public function it_returns_decrypted_data()
9192
*/
9293
public function it_can_not_decrypt_with_the_wrong_key()
9394
{
94-
$masterKey = str_random(16);
95+
$masterKey = Str::random(16);
9596

9697
// create fake credentials
9798
$encrypter = new Encrypter($masterKey);
@@ -103,7 +104,7 @@ public function it_can_not_decrypt_with_the_wrong_key()
103104

104105
file_put_contents(__DIR__ . '/temp/credentials.php.enc', $encryptedData);
105106

106-
$credentials = new Credentials(new Encrypter(str_random(16)));
107+
$credentials = new Credentials(new Encrypter(Str::random(16)));
107108

108109
$credentials->load(__DIR__ . '/temp/credentials.php.enc');
109110
}

0 commit comments

Comments
 (0)