From 5d7a9982070d33e8dbbf8ea74c2848ad906a83be Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 6 Dec 2019 09:31:10 +0100 Subject: [PATCH 1/9] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20draft=20support=20for?= =?UTF-8?q?=20laravel=206.*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Wim --- .travis.yml | 9 +++++++++ README.md | 3 ++- composer.json | 5 +++-- config/database-encryption.php | 2 +- src/Console/Commands/MigrateEncryptionCommand.php | 2 +- src/EncryptionDefaults.php | 2 +- src/EncryptionFacade.php | 2 +- src/EncryptionHelper.php | 2 +- src/EncryptionServiceProvider.php | 2 +- src/Traits/HasEncryptedAttributes.php | 2 +- src/helpers.php | 14 +++++++++++++- tests/Console/MigrateEncryptionTest.php | 2 +- tests/DatabaseTestCase.php | 2 +- tests/Defaults/ControlCharactersTest.php | 2 +- tests/Defaults/EnabledTest.php | 2 +- tests/Defaults/HelpersTest.php | 2 +- tests/Defaults/PrefixTest.php | 2 +- tests/Defaults/VersioningTest.php | 2 +- tests/Facade/FacadeTest.php | 2 +- tests/Helper/DisabledTest.php | 2 +- tests/Helper/EnabledTest.php | 2 +- tests/Helper/HeaderPrefixTest.php | 2 +- tests/Helper/PrefixTest.php | 2 +- tests/Helper/SingletonTest.php | 2 +- tests/Helper/VersionPartsTest.php | 2 +- tests/Helper/VersioningTest.php | 2 +- tests/Helper/VersionlessTest.php | 2 +- tests/Models/DatabaseModel.php | 2 +- tests/Models/DummyModel.php | 2 +- tests/Models/FakeModel.php | 2 +- tests/Models/RealModel.php | 2 +- tests/TestCase.php | 2 +- tests/Traits/DatabaseTest.php | 2 +- tests/Traits/DirtyTest.php | 2 +- tests/Traits/DummyTest.php | 2 +- tests/Traits/ExceptionTest.php | 2 +- tests/Traits/FloatTest.php | 2 +- tests/Traits/IntTest.php | 2 +- 38 files changed, 61 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3011cf1..da5a810 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,8 @@ matrix: env: LARAVEL=57 - php: 7.2 env: LARAVEL=58 + - php: 7.2 + env: LARAVEL=6 - php: 7.3 env: LARAVEL=55 - php: 7.3 @@ -26,6 +28,8 @@ matrix: env: LARAVEL=57 - php: 7.3 env: LARAVEL=58 + - php: 7.3 + env: LARAVEL=6 services: - mysql @@ -68,6 +72,11 @@ script: - if [ "$LARAVEL" = "58" ] ; then composer require "laravel/framework:5.8.*" --no-update ; fi - if [ "$LARAVEL" = "58" ] ; then composer require "orchestra/database:3.8.*" --no-update ; fi - if [ "$LARAVEL" = "58" ] ; then composer require "orchestra/testbench:3.8.*" --no-update ; fi + # Packages: Laravel 6.x.x + - if [ "$LARAVEL" = "6" ] ; then composer require "phpunit/phpunit:^8.0" --no-update ; fi + - if [ "$LARAVEL" = "6" ] ; then composer require "laravel/framework:^6.0" --no-update ; fi + - if [ "$LARAVEL" = "6" ] ; then composer require "orchestra/database:^4.0" --no-update ; fi + - if [ "$LARAVEL" = "6" ] ; then composer require "orchestra/testbench:^4.0" --no-update ; fi # Packages: Update - composer update --prefer-source --no-interaction # Tests: Run diff --git a/README.md b/README.md index c454787..7b4befb 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ directory. The most logical place to start are the [docs for the `HasEncryptedAt ## Requirements -* Laravel: 5.5, 5.6, 5.7, or 5.8 +* Laravel: 5.5, 5.6, 5.7, 5.8, or 6.x * PHP: 7.1, 7.2, or 7.3 * PHP [OpenSSL extension](http://php.net/manual/en/book.openssl.php) @@ -75,6 +75,7 @@ Laravel|[v5.5](https://laravel.com/docs/5.5/releases)|[v0.1.0](https://github.co Laravel|[v5.6](https://laravel.com/docs/5.6/releases)|[v0.1.1](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.1.1) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.1.1))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.1.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.1.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.1.1)](https://travis-ci.org/austinheap/laravel-database-encryption) Laravel|[v5.7](https://laravel.com/docs/5.7/releases)|[v0.2.0](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.2.0) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.2.0))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.0)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.0)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.0)](https://travis-ci.org/austinheap/laravel-database-encryption) Laravel|[v5.8](https://laravel.com/docs/5.8/releases)|[v0.2.1](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.2.1) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.2.1))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.1)](https://travis-ci.org/austinheap/laravel-database-encryption) +Laravel|[v6.x](https://laravel.com/docs/6.x/releases)|[v0.2.2](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.2.2) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.2.2))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.2)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.2)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.2)](https://travis-ci.org/austinheap/laravel-database-encryption) ## Schemas diff --git a/composer.json b/composer.json index 3a6112b..dd86887 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "laravel56 encryption", "laravel57 encryption", "laravel58 encryption", + "laravel6 encryption", "eloquent encryption", "model encryption", "attribute encryption", @@ -54,12 +55,12 @@ }, "require": { "php": ">=7.1.0", - "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*" + "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*|6.*.*" }, "require-dev": { "codeclimate/php-test-reporter": "dev-master", "phpunit/phpunit": "~6.0|~7.0", - "orchestra/testbench": "^3.5" + "orchestra/testbench": "^3.5|^4.0" }, "autoload": { "psr-4": { diff --git a/config/database-encryption.php b/config/database-encryption.php index 35687bc..f3b158f 100644 --- a/config/database-encryption.php +++ b/config/database-encryption.php @@ -3,7 +3,7 @@ * src/config/database-encryption.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ return [ diff --git a/src/Console/Commands/MigrateEncryptionCommand.php b/src/Console/Commands/MigrateEncryptionCommand.php index 6f5a2b4..2a1946d 100644 --- a/src/Console/Commands/MigrateEncryptionCommand.php +++ b/src/Console/Commands/MigrateEncryptionCommand.php @@ -3,7 +3,7 @@ * src/Console/Commands/MigrateEncryptionCommand.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ declare(strict_types=1); diff --git a/src/EncryptionDefaults.php b/src/EncryptionDefaults.php index e829c95..c46a321 100644 --- a/src/EncryptionDefaults.php +++ b/src/EncryptionDefaults.php @@ -3,7 +3,7 @@ * src/EncryptionDefaults.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ declare(strict_types=1); diff --git a/src/EncryptionFacade.php b/src/EncryptionFacade.php index 9550492..f5bb1d5 100644 --- a/src/EncryptionFacade.php +++ b/src/EncryptionFacade.php @@ -3,7 +3,7 @@ * src/EncryptionFacade.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ declare(strict_types=1); diff --git a/src/EncryptionHelper.php b/src/EncryptionHelper.php index 179f1d2..8ae7b8f 100644 --- a/src/EncryptionHelper.php +++ b/src/EncryptionHelper.php @@ -3,7 +3,7 @@ * src/EncryptionHelper.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ declare(strict_types=1); diff --git a/src/EncryptionServiceProvider.php b/src/EncryptionServiceProvider.php index 8091b09..093b8a9 100644 --- a/src/EncryptionServiceProvider.php +++ b/src/EncryptionServiceProvider.php @@ -3,7 +3,7 @@ * src/EncryptionServiceProvider.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ declare(strict_types=1); diff --git a/src/Traits/HasEncryptedAttributes.php b/src/Traits/HasEncryptedAttributes.php index dd6cab3..e284646 100644 --- a/src/Traits/HasEncryptedAttributes.php +++ b/src/Traits/HasEncryptedAttributes.php @@ -3,7 +3,7 @@ * src/Traits/HasEncryptedAttributes.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ declare(strict_types=1); diff --git a/src/helpers.php b/src/helpers.php index c7d8376..3ef3c70 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -3,7 +3,7 @@ * src/helpers.php. * * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ 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 + { + return \Illuminate\Support\Str::random($value); + } +} diff --git a/tests/Console/MigrateEncryptionTest.php b/tests/Console/MigrateEncryptionTest.php index 11c68d0..7877926 100644 --- a/tests/Console/MigrateEncryptionTest.php +++ b/tests/Console/MigrateEncryptionTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Console; diff --git a/tests/DatabaseTestCase.php b/tests/DatabaseTestCase.php index 31db31e..37ae146 100644 --- a/tests/DatabaseTestCase.php +++ b/tests/DatabaseTestCase.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests; diff --git a/tests/Defaults/ControlCharactersTest.php b/tests/Defaults/ControlCharactersTest.php index 7a5bc7f..8179f86 100644 --- a/tests/Defaults/ControlCharactersTest.php +++ b/tests/Defaults/ControlCharactersTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/EnabledTest.php b/tests/Defaults/EnabledTest.php index e74f3df..410fbd1 100644 --- a/tests/Defaults/EnabledTest.php +++ b/tests/Defaults/EnabledTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/HelpersTest.php b/tests/Defaults/HelpersTest.php index 13c3021..1e31e67 100644 --- a/tests/Defaults/HelpersTest.php +++ b/tests/Defaults/HelpersTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/PrefixTest.php b/tests/Defaults/PrefixTest.php index afbb703..42b333b 100644 --- a/tests/Defaults/PrefixTest.php +++ b/tests/Defaults/PrefixTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/VersioningTest.php b/tests/Defaults/VersioningTest.php index 1ebe3b3..539e634 100644 --- a/tests/Defaults/VersioningTest.php +++ b/tests/Defaults/VersioningTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Facade/FacadeTest.php b/tests/Facade/FacadeTest.php index 52d6941..b86b361 100644 --- a/tests/Facade/FacadeTest.php +++ b/tests/Facade/FacadeTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests; diff --git a/tests/Helper/DisabledTest.php b/tests/Helper/DisabledTest.php index d29ee48..dfa14c1 100644 --- a/tests/Helper/DisabledTest.php +++ b/tests/Helper/DisabledTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/EnabledTest.php b/tests/Helper/EnabledTest.php index 8be3d10..3f65a4f 100644 --- a/tests/Helper/EnabledTest.php +++ b/tests/Helper/EnabledTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/HeaderPrefixTest.php b/tests/Helper/HeaderPrefixTest.php index a7c3cb0..b539154 100644 --- a/tests/Helper/HeaderPrefixTest.php +++ b/tests/Helper/HeaderPrefixTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/PrefixTest.php b/tests/Helper/PrefixTest.php index c9bb886..02629e5 100644 --- a/tests/Helper/PrefixTest.php +++ b/tests/Helper/PrefixTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/SingletonTest.php b/tests/Helper/SingletonTest.php index b8269c6..904f25e 100644 --- a/tests/Helper/SingletonTest.php +++ b/tests/Helper/SingletonTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/VersionPartsTest.php b/tests/Helper/VersionPartsTest.php index 168a3fb..5a65263 100644 --- a/tests/Helper/VersionPartsTest.php +++ b/tests/Helper/VersionPartsTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/VersioningTest.php b/tests/Helper/VersioningTest.php index e7710d7..b807dce 100644 --- a/tests/Helper/VersioningTest.php +++ b/tests/Helper/VersioningTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/VersionlessTest.php b/tests/Helper/VersionlessTest.php index 4b0669f..7bf7cef 100644 --- a/tests/Helper/VersionlessTest.php +++ b/tests/Helper/VersionlessTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Models/DatabaseModel.php b/tests/Models/DatabaseModel.php index f0b56a9..1dbb630 100644 --- a/tests/Models/DatabaseModel.php +++ b/tests/Models/DatabaseModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/Models/DummyModel.php b/tests/Models/DummyModel.php index 8aa632f..66b01a1 100644 --- a/tests/Models/DummyModel.php +++ b/tests/Models/DummyModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/Models/FakeModel.php b/tests/Models/FakeModel.php index 4c8a7b7..0813cc3 100644 --- a/tests/Models/FakeModel.php +++ b/tests/Models/FakeModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/Models/RealModel.php b/tests/Models/RealModel.php index e411869..721d1d6 100644 --- a/tests/Models/RealModel.php +++ b/tests/Models/RealModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/TestCase.php b/tests/TestCase.php index f2f179a..5607dad 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests; diff --git a/tests/Traits/DatabaseTest.php b/tests/Traits/DatabaseTest.php index 2d815c9..5885e8e 100644 --- a/tests/Traits/DatabaseTest.php +++ b/tests/Traits/DatabaseTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/DirtyTest.php b/tests/Traits/DirtyTest.php index a9289fc..8cfbfad 100644 --- a/tests/Traits/DirtyTest.php +++ b/tests/Traits/DirtyTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/DummyTest.php b/tests/Traits/DummyTest.php index 7268fdb..53cc188 100644 --- a/tests/Traits/DummyTest.php +++ b/tests/Traits/DummyTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/ExceptionTest.php b/tests/Traits/ExceptionTest.php index cf508c3..ae302f1 100644 --- a/tests/Traits/ExceptionTest.php +++ b/tests/Traits/ExceptionTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/FloatTest.php b/tests/Traits/FloatTest.php index 1ae2959..56760f7 100644 --- a/tests/Traits/FloatTest.php +++ b/tests/Traits/FloatTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/IntTest.php b/tests/Traits/IntTest.php index c2ddd24..d721080 100644 --- a/tests/Traits/IntTest.php +++ b/tests/Traits/IntTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.1 + * @version v0.2.2 */ namespace AustinHeap\Database\Encryption\Tests\Traits; From 5d897a2532da3a1194c9a94ad95605d03746d49d Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 13 Dec 2019 09:13:14 +0100 Subject: [PATCH 2/9] Update composer.json Co-Authored-By: Roelof --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index dd86887..835162b 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ }, "require": { "php": ">=7.1.0", - "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*|6.*.*" + "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0" }, "require-dev": { "codeclimate/php-test-reporter": "dev-master", From b5b04140c3f5dc9428ae6084ea61dc7b6f9c6108 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 13 Dec 2019 09:15:22 +0100 Subject: [PATCH 3/9] Update config/database-encryption.php Co-Authored-By: Roelof --- config/database-encryption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database-encryption.php b/config/database-encryption.php index f3b158f..11720f0 100644 --- a/config/database-encryption.php +++ b/config/database-encryption.php @@ -3,7 +3,7 @@ * src/config/database-encryption.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ return [ From 8996a1afe108856ed3750b9b72beb33342165026 Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Fri, 13 Dec 2019 14:38:22 +0100 Subject: [PATCH 4/9] Cleaned up Travis CI file - Don't double-install packages. Add new packages first and pull them all in at the same time. - Removed uopz. It's not being used. - Use `composer test`, which allows us to add additional tests there. --- .travis.yml | 17 ++++------------- composer.json | 3 +++ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index da5a810..79769af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,21 +35,12 @@ services: - mysql before_script: - # Extensions: ext-uopz - - if [ "$TRAVIS_PHP_VERSION" = "7.1" ] ; then pecl install uopz ; fi - - if [ "$TRAVIS_PHP_VERSION" = "7.2" ] ; then pecl install uopz ; fi -# - if [ "$TRAVIS_PHP_VERSION" = "7.3" ] ; then wget -O $TRAVIS_BUILD_DIR/uopz-5.0.2.tgz https://pecl.php.net/get/uopz-5.0.2.tgz ; fi -# - if [ "$TRAVIS_PHP_VERSION" = "7.3" ] ; then tar xvf $TRAVIS_BUILD_DIR/uopz-5.0.2.tgz ; fi -# - if [ "$TRAVIS_PHP_VERSION" = "7.3" ] ; then mv $TRAVIS_BUILD_DIR/uopz-5.0.2 $TRAVIS_BUILD_DIR/ext-uopz ; fi -# - if [ "$TRAVIS_PHP_VERSION" = "7.3" ] ; then wget -O $TRAVIS_BUILD_DIR/ext-uopz/php73.patch https://gist.githubusercontent.com/cmb69/3060a552fc825497d066262ab31f3998/raw/428c0aee7d77b6c37ea3757bbc8b86cfc390d7ca/0001-Update-for-PHP-7.3.patch ; fi -# - if [ "$TRAVIS_PHP_VERSION" = "7.3" ] ; then cd $TRAVIS_BUILD_DIR/ext-uopz && patch -p1 < php73.patch && phpize && ./configure && make && make install ; fi # Tests: Code Climate - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build - # Packages: Install + # Packages: Prepare composer - composer self-update - - composer install --prefer-source --no-interaction script: # Packages: Laravel 5.5.x @@ -77,10 +68,10 @@ script: - if [ "$LARAVEL" = "6" ] ; then composer require "laravel/framework:^6.0" --no-update ; fi - if [ "$LARAVEL" = "6" ] ; then composer require "orchestra/database:^4.0" --no-update ; fi - if [ "$LARAVEL" = "6" ] ; then composer require "orchestra/testbench:^4.0" --no-update ; fi - # Packages: Update - - composer update --prefer-source --no-interaction + # Packages: Install + - composer install --prefer-source --no-interaction # Tests: Run - - vendor/bin/phpunit --coverage-clover "$TRAVIS_BUILD_DIR/build/logs/clover.xml" + - composer test -- --coverage-clover "$TRAVIS_BUILD_DIR/build/logs/clover.xml" after_script: - ./cc-test-reporter after-build --coverage-input-type clover --prefix "$TRAVIS_BUILD_DIR" --exit-code $TRAVIS_TEST_RESULT diff --git a/composer.json b/composer.json index 835162b..5f587b8 100644 --- a/composer.json +++ b/composer.json @@ -83,5 +83,8 @@ }, "config": { "discard-changes": true + }, + "scripts": { + "test": "vendor/bin/phpunit" } } From 9759d81539d509a08eae0a7a8eaa0855d6ae8d0b Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Thu, 12 Dec 2019 20:34:17 +0100 Subject: [PATCH 5/9] Improved support for Laravel 6.x --- .travis.yml | 14 +++++++------- composer.json | 2 +- phpunit.xml | 2 ++ tests/Console/MigrateEncryptionTest.php | 7 ++++--- tests/DatabaseTestCase.php | 3 ++- tests/TestCase.php | 3 ++- tests/Traits/DummyTest.php | 9 +++++---- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79769af..988f99f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: - php: 7.2 env: LARAVEL=58 - php: 7.2 - env: LARAVEL=6 + env: LARAVEL=6x - php: 7.3 env: LARAVEL=55 - php: 7.3 @@ -29,7 +29,7 @@ matrix: - php: 7.3 env: LARAVEL=58 - php: 7.3 - env: LARAVEL=6 + env: LARAVEL=6x services: - mysql @@ -63,11 +63,11 @@ script: - if [ "$LARAVEL" = "58" ] ; then composer require "laravel/framework:5.8.*" --no-update ; fi - if [ "$LARAVEL" = "58" ] ; then composer require "orchestra/database:3.8.*" --no-update ; fi - if [ "$LARAVEL" = "58" ] ; then composer require "orchestra/testbench:3.8.*" --no-update ; fi - # Packages: Laravel 6.x.x - - if [ "$LARAVEL" = "6" ] ; then composer require "phpunit/phpunit:^8.0" --no-update ; fi - - if [ "$LARAVEL" = "6" ] ; then composer require "laravel/framework:^6.0" --no-update ; fi - - if [ "$LARAVEL" = "6" ] ; then composer require "orchestra/database:^4.0" --no-update ; fi - - if [ "$LARAVEL" = "6" ] ; then composer require "orchestra/testbench:^4.0" --no-update ; fi + # Packages: Laravel ^6.0 + - if [ "$LARAVEL" = "6x" ] ; then composer require "phpunit/phpunit:^8.3" --no-update ; fi + - if [ "$LARAVEL" = "6x" ] ; then composer require "laravel/framework:^6.0" --no-update ; fi + - if [ "$LARAVEL" = "6x" ] ; then composer require "orchestra/database:^4.0" --no-update ; fi + - if [ "$LARAVEL" = "6x" ] ; then composer require "orchestra/testbench:^4.0" --no-update ; fi # Packages: Install - composer install --prefer-source --no-interaction # Tests: Run diff --git a/composer.json b/composer.json index 5f587b8..1b3eab1 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,7 @@ }, "require-dev": { "codeclimate/php-test-reporter": "dev-master", - "phpunit/phpunit": "~6.0|~7.0", + "phpunit/phpunit": "^6.0|^7.0|^8.0", "orchestra/testbench": "^3.5|^4.0" }, "autoload": { diff --git a/phpunit.xml b/phpunit.xml index 63f8bc1..76bb0b8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,9 @@ convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" + convertDeprecationsToExceptions="false" processIsolation="false" + failOnWarning="false" stopOnFailure="false"> diff --git a/tests/Console/MigrateEncryptionTest.php b/tests/Console/MigrateEncryptionTest.php index 7877926..f71060c 100644 --- a/tests/Console/MigrateEncryptionTest.php +++ b/tests/Console/MigrateEncryptionTest.php @@ -13,6 +13,7 @@ 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']; } }; diff --git a/tests/DatabaseTestCase.php b/tests/DatabaseTestCase.php index 37ae146..33dc0bb 100644 --- a/tests/DatabaseTestCase.php +++ b/tests/DatabaseTestCase.php @@ -12,6 +12,7 @@ use AustinHeap\Database\Encryption\Tests\Models\DatabaseModel; use DB, RuntimeException; +use Illuminate\Support\Str; /** * DatabaseTestCase @@ -31,7 +32,7 @@ public function tearDown(): void protected function getEnvironmentSetUp($app): void { if (is_null(self::$database)) { - self::$database = 'laravel_database_encryption_testing_' . str_random(6); + self::$database = 'laravel_database_encryption_testing_' . Str::random(6); } $this->setUpDatabase(); diff --git a/tests/TestCase.php b/tests/TestCase.php index 5607dad..6e84df5 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -13,6 +13,7 @@ use AustinHeap\Database\Encryption\EncryptionFacade; use AustinHeap\Database\Encryption\EncryptionServiceProvider; use DB, RuntimeException, ReflectionClass; +use Illuminate\Support\Str; use Orchestra\Testbench\TestCase as BaseTestCase; /** @@ -25,7 +26,7 @@ class TestCase extends BaseTestCase protected function getEnvironmentSetUp($app) { - $app['config']->set('app.key', str_random(32)); + $app['config']->set('app.key', Str::random(32)); $app['config']->set('database-encryption.enabled', true); } diff --git a/tests/Traits/DummyTest.php b/tests/Traits/DummyTest.php index 53cc188..2108644 100644 --- a/tests/Traits/DummyTest.php +++ b/tests/Traits/DummyTest.php @@ -12,6 +12,7 @@ use AustinHeap\Database\Encryption\Tests\TestCase; use AustinHeap\Database\Encryption\Tests\Models\DummyModel; +use Illuminate\Support\Str; /** * DummyTest @@ -32,8 +33,8 @@ protected function doTest($attributes) public function testEncryptNormalString() { $this->doTest([ - 'dont_encrypt' => 'dont-encrypt-' . str_random(), - 'encrypt_me' => 'encrypt-me-' . str_random(), + 'dont_encrypt' => 'dont-encrypt-' . Str::random(), + 'encrypt_me' => 'encrypt-me-' . Str::random(), ]); } @@ -41,7 +42,7 @@ public function testEncryptStringWithPlus() { $this->doTest([ 'dont_encrypt' => '12345+' . rand(111111, 999999) . '@gmail.com', - 'encrypt_me' => 'abcde+' . str_random() . '@gmail.com', + 'encrypt_me' => 'abcde+' . Str::random() . '@gmail.com', ]); } @@ -49,7 +50,7 @@ public function testIsEncryptable() { $attributes = [ 'dont_encrypt' => '12345+' . rand(111111, 999999) . '@gmail.com', - 'encrypt_me' => 'abcde+' . str_random() . '@gmail.com', + 'encrypt_me' => 'abcde+' . Str::random() . '@gmail.com', ]; $model = new DummyModel($attributes); From 58574283860196cc2bb1323ea0e0dba25508f405 Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Fri, 13 Dec 2019 14:56:57 +0100 Subject: [PATCH 6/9] =?UTF-8?q?Version=200.2.2=20=E2=86=92=200.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/Console/Commands/MigrateEncryptionCommand.php | 2 +- src/EncryptionDefaults.php | 2 +- src/EncryptionFacade.php | 2 +- src/EncryptionHelper.php | 2 +- src/EncryptionServiceProvider.php | 2 +- src/Traits/HasEncryptedAttributes.php | 2 +- src/helpers.php | 2 +- tests/Console/MigrateEncryptionTest.php | 2 +- tests/DatabaseTestCase.php | 2 +- tests/Defaults/ControlCharactersTest.php | 2 +- tests/Defaults/EnabledTest.php | 2 +- tests/Defaults/HelpersTest.php | 2 +- tests/Defaults/PrefixTest.php | 2 +- tests/Defaults/VersioningTest.php | 2 +- tests/Facade/FacadeTest.php | 2 +- tests/Helper/DisabledTest.php | 2 +- tests/Helper/EnabledTest.php | 2 +- tests/Helper/HeaderPrefixTest.php | 2 +- tests/Helper/PrefixTest.php | 2 +- tests/Helper/SingletonTest.php | 2 +- tests/Helper/VersionPartsTest.php | 2 +- tests/Helper/VersioningTest.php | 2 +- tests/Helper/VersionlessTest.php | 2 +- tests/Models/DatabaseModel.php | 2 +- tests/Models/DummyModel.php | 2 +- tests/Models/FakeModel.php | 2 +- tests/Models/RealModel.php | 2 +- tests/TestCase.php | 2 +- tests/Traits/DatabaseTest.php | 2 +- tests/Traits/DirtyTest.php | 2 +- tests/Traits/DummyTest.php | 2 +- tests/Traits/ExceptionTest.php | 2 +- tests/Traits/FloatTest.php | 2 +- tests/Traits/IntTest.php | 2 +- 35 files changed, 35 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 7b4befb..3d003f7 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Laravel|[v5.5](https://laravel.com/docs/5.5/releases)|[v0.1.0](https://github.co Laravel|[v5.6](https://laravel.com/docs/5.6/releases)|[v0.1.1](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.1.1) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.1.1))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.1.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.1.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.1.1)](https://travis-ci.org/austinheap/laravel-database-encryption) Laravel|[v5.7](https://laravel.com/docs/5.7/releases)|[v0.2.0](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.2.0) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.2.0))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.0)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.0)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.0)](https://travis-ci.org/austinheap/laravel-database-encryption) Laravel|[v5.8](https://laravel.com/docs/5.8/releases)|[v0.2.1](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.2.1) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.2.1))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.1)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.1)](https://travis-ci.org/austinheap/laravel-database-encryption) -Laravel|[v6.x](https://laravel.com/docs/6.x/releases)|[v0.2.2](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.2.2) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.2.2))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.2)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.2)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.2.2)](https://travis-ci.org/austinheap/laravel-database-encryption) +Laravel|[v6.x](https://laravel.com/docs/6.x/releases)|[v0.3.0](https://github.com/austinheap/laravel-database-encryption/releases/tag/v0.3.0) ([Packagist](https://packagist.org/packages/austinheap/laravel-database-encryption#v0.3.0))|Stable|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.3.0)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.3.0)](https://travis-ci.org/austinheap/laravel-database-encryption)|[![Build Status](https://travis-ci.org/austinheap/laravel-database-encryption.svg?branch=v0.3.0)](https://travis-ci.org/austinheap/laravel-database-encryption) ## Schemas diff --git a/src/Console/Commands/MigrateEncryptionCommand.php b/src/Console/Commands/MigrateEncryptionCommand.php index 2a1946d..98bab8c 100644 --- a/src/Console/Commands/MigrateEncryptionCommand.php +++ b/src/Console/Commands/MigrateEncryptionCommand.php @@ -3,7 +3,7 @@ * src/Console/Commands/MigrateEncryptionCommand.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ declare(strict_types=1); diff --git a/src/EncryptionDefaults.php b/src/EncryptionDefaults.php index c46a321..d8f8d21 100644 --- a/src/EncryptionDefaults.php +++ b/src/EncryptionDefaults.php @@ -3,7 +3,7 @@ * src/EncryptionDefaults.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ declare(strict_types=1); diff --git a/src/EncryptionFacade.php b/src/EncryptionFacade.php index f5bb1d5..002e5ed 100644 --- a/src/EncryptionFacade.php +++ b/src/EncryptionFacade.php @@ -3,7 +3,7 @@ * src/EncryptionFacade.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ declare(strict_types=1); diff --git a/src/EncryptionHelper.php b/src/EncryptionHelper.php index 8ae7b8f..500e8e2 100644 --- a/src/EncryptionHelper.php +++ b/src/EncryptionHelper.php @@ -3,7 +3,7 @@ * src/EncryptionHelper.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ declare(strict_types=1); diff --git a/src/EncryptionServiceProvider.php b/src/EncryptionServiceProvider.php index 093b8a9..0ce8f1e 100644 --- a/src/EncryptionServiceProvider.php +++ b/src/EncryptionServiceProvider.php @@ -3,7 +3,7 @@ * src/EncryptionServiceProvider.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ declare(strict_types=1); diff --git a/src/Traits/HasEncryptedAttributes.php b/src/Traits/HasEncryptedAttributes.php index e284646..2d54c68 100644 --- a/src/Traits/HasEncryptedAttributes.php +++ b/src/Traits/HasEncryptedAttributes.php @@ -3,7 +3,7 @@ * src/Traits/HasEncryptedAttributes.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ declare(strict_types=1); diff --git a/src/helpers.php b/src/helpers.php index 3ef3c70..4d50158 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -3,7 +3,7 @@ * src/helpers.php. * * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ declare(strict_types=1); diff --git a/tests/Console/MigrateEncryptionTest.php b/tests/Console/MigrateEncryptionTest.php index f71060c..c8da52b 100644 --- a/tests/Console/MigrateEncryptionTest.php +++ b/tests/Console/MigrateEncryptionTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Console; diff --git a/tests/DatabaseTestCase.php b/tests/DatabaseTestCase.php index 33dc0bb..af250a2 100644 --- a/tests/DatabaseTestCase.php +++ b/tests/DatabaseTestCase.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests; diff --git a/tests/Defaults/ControlCharactersTest.php b/tests/Defaults/ControlCharactersTest.php index 8179f86..d954232 100644 --- a/tests/Defaults/ControlCharactersTest.php +++ b/tests/Defaults/ControlCharactersTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/EnabledTest.php b/tests/Defaults/EnabledTest.php index 410fbd1..cfb0161 100644 --- a/tests/Defaults/EnabledTest.php +++ b/tests/Defaults/EnabledTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/HelpersTest.php b/tests/Defaults/HelpersTest.php index 1e31e67..a915007 100644 --- a/tests/Defaults/HelpersTest.php +++ b/tests/Defaults/HelpersTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/PrefixTest.php b/tests/Defaults/PrefixTest.php index 42b333b..b618ff3 100644 --- a/tests/Defaults/PrefixTest.php +++ b/tests/Defaults/PrefixTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Defaults/VersioningTest.php b/tests/Defaults/VersioningTest.php index 539e634..7faf2c4 100644 --- a/tests/Defaults/VersioningTest.php +++ b/tests/Defaults/VersioningTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Defaults; diff --git a/tests/Facade/FacadeTest.php b/tests/Facade/FacadeTest.php index b86b361..3eefe98 100644 --- a/tests/Facade/FacadeTest.php +++ b/tests/Facade/FacadeTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests; diff --git a/tests/Helper/DisabledTest.php b/tests/Helper/DisabledTest.php index dfa14c1..45ea83e 100644 --- a/tests/Helper/DisabledTest.php +++ b/tests/Helper/DisabledTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/EnabledTest.php b/tests/Helper/EnabledTest.php index 3f65a4f..b324f51 100644 --- a/tests/Helper/EnabledTest.php +++ b/tests/Helper/EnabledTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/HeaderPrefixTest.php b/tests/Helper/HeaderPrefixTest.php index b539154..6f96c4e 100644 --- a/tests/Helper/HeaderPrefixTest.php +++ b/tests/Helper/HeaderPrefixTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/PrefixTest.php b/tests/Helper/PrefixTest.php index 02629e5..e87f15e 100644 --- a/tests/Helper/PrefixTest.php +++ b/tests/Helper/PrefixTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/SingletonTest.php b/tests/Helper/SingletonTest.php index 904f25e..d0c401d 100644 --- a/tests/Helper/SingletonTest.php +++ b/tests/Helper/SingletonTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/VersionPartsTest.php b/tests/Helper/VersionPartsTest.php index 5a65263..bd7e9fe 100644 --- a/tests/Helper/VersionPartsTest.php +++ b/tests/Helper/VersionPartsTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/VersioningTest.php b/tests/Helper/VersioningTest.php index b807dce..da33a60 100644 --- a/tests/Helper/VersioningTest.php +++ b/tests/Helper/VersioningTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Helper/VersionlessTest.php b/tests/Helper/VersionlessTest.php index 7bf7cef..73fae56 100644 --- a/tests/Helper/VersionlessTest.php +++ b/tests/Helper/VersionlessTest.php @@ -4,7 +4,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Helper; diff --git a/tests/Models/DatabaseModel.php b/tests/Models/DatabaseModel.php index 1dbb630..6fac2ef 100644 --- a/tests/Models/DatabaseModel.php +++ b/tests/Models/DatabaseModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/Models/DummyModel.php b/tests/Models/DummyModel.php index 66b01a1..62a00a9 100644 --- a/tests/Models/DummyModel.php +++ b/tests/Models/DummyModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/Models/FakeModel.php b/tests/Models/FakeModel.php index 0813cc3..b288bf0 100644 --- a/tests/Models/FakeModel.php +++ b/tests/Models/FakeModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/Models/RealModel.php b/tests/Models/RealModel.php index 721d1d6..12bd9ea 100644 --- a/tests/Models/RealModel.php +++ b/tests/Models/RealModel.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Models; diff --git a/tests/TestCase.php b/tests/TestCase.php index 6e84df5..58ad41c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests; diff --git a/tests/Traits/DatabaseTest.php b/tests/Traits/DatabaseTest.php index 5885e8e..0c6cf0f 100644 --- a/tests/Traits/DatabaseTest.php +++ b/tests/Traits/DatabaseTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/DirtyTest.php b/tests/Traits/DirtyTest.php index 8cfbfad..c56f3c4 100644 --- a/tests/Traits/DirtyTest.php +++ b/tests/Traits/DirtyTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/DummyTest.php b/tests/Traits/DummyTest.php index 2108644..3988a52 100644 --- a/tests/Traits/DummyTest.php +++ b/tests/Traits/DummyTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/ExceptionTest.php b/tests/Traits/ExceptionTest.php index ae302f1..04b5d5d 100644 --- a/tests/Traits/ExceptionTest.php +++ b/tests/Traits/ExceptionTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/FloatTest.php b/tests/Traits/FloatTest.php index 56760f7..becfdfb 100644 --- a/tests/Traits/FloatTest.php +++ b/tests/Traits/FloatTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Traits; diff --git a/tests/Traits/IntTest.php b/tests/Traits/IntTest.php index d721080..6d2d802 100644 --- a/tests/Traits/IntTest.php +++ b/tests/Traits/IntTest.php @@ -5,7 +5,7 @@ * @package laravel-database-encryption * @link https://github.com/austinheap/laravel-database-encryption * @author Austin Heap - * @version v0.2.2 + * @version v0.3.0 */ namespace AustinHeap\Database\Encryption\Tests\Traits; From 948e29a6557a8274a5c31c96809d0a9e39a5b545 Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Fri, 13 Dec 2019 14:09:52 +0100 Subject: [PATCH 7/9] Fixed tests not always supplying port number --- tests/DatabaseTestCase.php | 11 +++++++---- tests/Models/RealModel.php | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/DatabaseTestCase.php b/tests/DatabaseTestCase.php index af250a2..1aa047d 100644 --- a/tests/DatabaseTestCase.php +++ b/tests/DatabaseTestCase.php @@ -93,10 +93,13 @@ protected function runStatement(string $statement, ?string $database = null): vo $id = uniqid(); $file = __DIR__ . '/testing-'.$id.'.sql'; file_put_contents($file, is_null($database) ? $statement : 'USE ' . $database . '; ' . $statement); - $cmd = 'mysql -u' . env('TESTING_DB_USER', 'root') . - (empty(env('TESTING_DB_PASS', '')) ? '' : ' -p' . env('TESTING_DB_PASS', '')) . - ' -h ' . env('TESTING_DB_HOST', '127.0.0.1') . - ' < ' . $file . ' 2>&1 | grep -v "Warning: Using a password"'; + $cmd = vsprintf('mysql -u%s %s -h %s -P %s < %s 2>&1 | grep -v "Warning: Using a password"', [ + env('TESTING_DB_USER', 'root'), + empty(env('TESTING_DB_PASS', '')) ? '' : ' -p' . env('TESTING_DB_PASS', ''), + env('TESTING_DB_HOST', '127.0.0.1'), + env('TESTING_DB_PORT', 3306), + $file + ]); exec($cmd); unlink($file); } diff --git a/tests/Models/RealModel.php b/tests/Models/RealModel.php index 12bd9ea..d3702a0 100644 --- a/tests/Models/RealModel.php +++ b/tests/Models/RealModel.php @@ -39,7 +39,12 @@ public function getRawValues(array $columns = null): ?array ); try { - $dsn = sprintf('mysql:dbname=%s;host=%s;charset=utf8', DB::getDatabaseName(), env('TESTING_DB_HOST', '127.0.0.1')); + $dsn = sprintf( + 'mysql:dbname=%s;host=%s;port=%s;charset=utf8', + DB::getDatabaseName(), + env('TESTING_DB_HOST', '127.0.0.1'), + env('TESTING_DB_PORT', 3306) + ); $connection = new PDO($dsn, env('TESTING_DB_USER', 'root'), env('TESTING_DB_PASS', '')); $statement = $connection->prepare($query); From e6484b1a6bc950ec01198634053e8c699d5e0bc3 Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Fri, 13 Dec 2019 12:50:32 +0100 Subject: [PATCH 8/9] Added GitHub Actions --- .github/workflows/test.yml | 115 +++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..db99962 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 From 5170cfd390aaf3ab20d5e74c96b542c2a8e5e2d5 Mon Sep 17 00:00:00 2001 From: Edwin Knip Date: Thu, 14 Jul 2022 15:08:45 +0200 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=94=A7=20Adds=20support=20for=20futur?= =?UTF-8?q?e=20Laravel=20releases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 1b3eab1..c037779 100644 --- a/composer.json +++ b/composer.json @@ -55,12 +55,12 @@ }, "require": { "php": ">=7.1.0", - "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0" + "laravel/framework": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0" }, "require-dev": { "codeclimate/php-test-reporter": "dev-master", - "phpunit/phpunit": "^6.0|^7.0|^8.0", - "orchestra/testbench": "^3.5|^4.0" + "phpunit/phpunit": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "orchestra/testbench": "^3.5|^4.0|^5.0|^6.0" }, "autoload": { "psr-4": {