This repository has been archived by the owner on Apr 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
⬆️ draft support for laravel 6.* #53
Open
lwiml
wants to merge
10
commits into
austinheap:master
Choose a base branch
from
JoinMarketing:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5d7a998
⬆️ draft support for laravel 6.*
5d897a2
Update composer.json
b5b0414
Update config/database-encryption.php
8996a1a
Cleaned up Travis CI file
9759d81
Improved support for Laravel 6.x
5857428
Version 0.2.2 → 0.3.0
948e29a
Fixed tests not always supplying port number
e6484b1
Added GitHub Actions
4c78044
Merge pull request #1 from gumbo-millennium/master
5170cfd
🔧 Adds support for future Laravel releases
eknip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: "Run unit tests" | ||
|
||
on: | ||
- push | ||
|
||
jobs: | ||
test: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: ['7.1', '7.2', '7.3', '7.4'] | ||
laravel: ['5.5', '5.6', '5.7', '5.8', '6.x'] | ||
exclude: | ||
# Laravel 6.x is 7.2+ | ||
- php: '7.1' | ||
laravel: '6.x' | ||
services: | ||
database: | ||
image: mysql:5 | ||
ports: | ||
- 13306:3306 | ||
env: | ||
MYSQL_ROOT_PASSWORD: 'test' | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup PHP ${{ matrix.php }} | ||
uses: shivammathur/setup-php@master | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: json,mbstring,pdo,mysql,dom | ||
coverage: xdebug | ||
|
||
- name: Start build on Code Climate | ||
continue-on-error: true | ||
run: | | ||
curl -o ./cc-test-reporter -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 | ||
chmod +x ./cc-test-reporter | ||
./cc-test-reporter before-build | ||
|
||
- name: Get user-level Composer cache | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Setup Composer cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: composer-${{ runner.os }}-${{ matrix.laravel }}-${{ matrix.php }}-${{ hashFiles('**/composer.json') }} | ||
restore-keys: | | ||
composer-${{ runner.os }}-${{ matrix.laravel }}-${{ matrix.php }}- | ||
composer-${{ runner.os }}-${{ matrix.laravel }}- | ||
composer-${{ runner.os }}- | ||
|
||
|
||
- name: Install dependencies for Laravel 5.5 | ||
if: ( matrix.laravel == '5.5' ) | ||
run: | | ||
composer require "phpunit/phpunit:^6.0" --no-update | ||
composer require "laravel/framework:~5.5.0" --no-update | ||
composer require "orchestra/database:~3.5.0" --no-update | ||
composer require "orchestra/testbench:~3.5.0" --no-update | ||
|
||
- name: Install dependencies for Laravel 5.6 | ||
if: ( matrix.laravel == '5.6' ) | ||
run: | | ||
composer require "phpunit/phpunit:^7.0" --no-update | ||
composer require "laravel/framework:~5.6.0" --no-update | ||
composer require "orchestra/database:~3.6.0" --no-update | ||
composer require "orchestra/testbench:~3.6.0" --no-update | ||
|
||
- name: Install dependencies for Laravel 5.7 | ||
if: ( matrix.laravel == '5.7' ) | ||
run: | | ||
composer require "phpunit/phpunit:^7.0" --no-update | ||
composer require "laravel/framework:~5.7.0" --no-update | ||
composer require "orchestra/database:~3.7.0" --no-update | ||
composer require "orchestra/testbench:~3.7.0" --no-update | ||
|
||
- name: Install dependencies for Laravel 5.8 | ||
if: ( matrix.laravel == '5.8' ) | ||
run: | | ||
composer require "phpunit/phpunit:^7.0" --no-update | ||
composer require "laravel/framework:~5.8.0" --no-update | ||
composer require "orchestra/database:~3.8.0" --no-update | ||
composer require "orchestra/testbench:~3.8.0" --no-update | ||
|
||
- name: Install dependencies for Laravel 6 | ||
if: ( matrix.laravel == '6.x' ) | ||
run: | | ||
composer require "phpunit/phpunit:^8.3" --no-update | ||
composer require "laravel/framework:^6.0" --no-update | ||
composer require "orchestra/database:^4.0" --no-update | ||
composer require "orchestra/testbench:^4.0" --no-update | ||
|
||
- name: Install composer dependencies | ||
run: composer install --no-suggest --no-progress --no-interaction --prefer-source | ||
|
||
- name: Run unit tests | ||
run: vendor/bin/phpunit --coverage-text | ||
env: | ||
TESTING_DB_PASS: 'test' | ||
TESTING_DB_PORT: 13306 | ||
|
||
- name: Complete build on Code Climate | ||
continue-on-error: true | ||
run: ./cc-test-reporter after-build --coverage-input-type clover --prefix "${GITHUB_WORKSPACE}" --exit-code ${{ job.status == 'failure' }} | ||
if: always() | ||
|
||
- name: Upload coverage to Code Climate | ||
continue-on-error: true | ||
run: vendor/bin/test-reporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/config/database-encryption.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
|
||
return [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/Console/Commands/MigrateEncryptionCommand.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/EncryptionDefaults.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/EncryptionFacade.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/EncryptionHelper.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/EncryptionServiceProvider.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/Traits/HasEncryptedAttributes.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* src/helpers.php. | ||
* | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
@@ -96,3 +96,15 @@ function dbdecrypt(string $value): ?string | |
return database_decrypt($value); | ||
} | ||
} | ||
|
||
if (! function_exists('str_random')) { | ||
|
||
/** | ||
* @param int $value | ||
* @return string|null | ||
*/ | ||
function str_random(int $value = 16): ?string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? Just replace it with |
||
{ | ||
return \Illuminate\Support\Str::random($value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,15 @@ | |
* @package laravel-database-encryption | ||
* @link https://github.com/austinheap/laravel-database-encryption | ||
* @author Austin Heap <[email protected]> | ||
* @version v0.2.1 | ||
* @version v0.3.0 | ||
*/ | ||
|
||
namespace AustinHeap\Database\Encryption\Tests\Console; | ||
|
||
use AustinHeap\Database\Encryption\Console\Commands\MigrateEncryptionCommand; | ||
use AustinHeap\Database\Encryption\Tests\DatabaseTestCase; | ||
use DatabaseEncryption; | ||
use Illuminate\Support\Str; | ||
use RuntimeException; | ||
|
||
/** | ||
|
@@ -33,7 +34,7 @@ public function testMissingOldKeys() | |
{ | ||
protected function setupKeys() | ||
{ | ||
$this->new_key = str_random(32); | ||
$this->new_key = Str::random(32); | ||
$this->tables = ['test_models']; | ||
} | ||
}; | ||
|
@@ -64,7 +65,7 @@ public function testMissingTables() | |
protected function setupKeys() | ||
{ | ||
$this->old_keys = [app('config')->get('app.key')]; | ||
$this->new_key = str_random(32); | ||
$this->new_key = Str::random(32); | ||
} | ||
}; | ||
|
||
|
@@ -81,7 +82,7 @@ public function testExtended() | |
protected function setupKeys() | ||
{ | ||
$this->old_keys = [app('config')->get('app.key')]; | ||
$this->new_key = str_random(32); | ||
$this->new_key = Str::random(32); | ||
$this->tables = ['test_models']; | ||
} | ||
}; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since 7.1 is already deprecated and 7.2 is in security-only, maybe also look into PHP 7.4 support (add
allow-failure
CI tests for example)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, That's good idea. For now I was just looking into my own case where i needed Laravel 6 and php 7.3 support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that should be a separate PR. There will probably be some issues.