diff --git a/composer.json b/composer.json index 94dc291..6410abe 100644 --- a/composer.json +++ b/composer.json @@ -46,9 +46,9 @@ "minimum-stability": "dev", "prefer-stable": true, "require-dev": { - "orchestra/testbench": "^8.0", - "pestphp/pest": "^2.0", - "pestphp/pest-plugin-laravel": "^2.0" + "orchestra/testbench": "^8.0|^9.0", + "pestphp/pest": "^2.0|^3.0", + "pestphp/pest-plugin-laravel": "^2.0|^3.0" }, "scripts": { "test": "./vendor/bin/pest" diff --git a/phpunit.xml b/phpunit.xml index 8820f49..433b2be 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,23 +1,5 @@ - - - - src/ - - + ./tests/Unit @@ -28,4 +10,9 @@ + + + src/ + + diff --git a/phpunit.xml.bak b/phpunit.xml.bak new file mode 100644 index 0000000..8820f49 --- /dev/null +++ b/phpunit.xml.bak @@ -0,0 +1,31 @@ + + + + + src/ + + + + + ./tests/Unit + + + + + + + + diff --git a/src/Scopes/DecryptSelectScope.php b/src/Scopes/DecryptSelectScope.php index 40f5d00..f2d1272 100644 --- a/src/Scopes/DecryptSelectScope.php +++ b/src/Scopes/DecryptSelectScope.php @@ -22,7 +22,9 @@ public function apply(Builder $builder, Model $model) $encryptable = $model->encryptable(); - $columns = empty($columns) ? Schema::getColumnListing($model->getTable()) : $columns; + if (empty($columns) || $columns === ['*'] || $columns === '*') { + $columns = Schema::getColumnListing($model->getTable()); + } $select = collect($columns)->map(function ($column) use ($encryptable) { return (in_array($column, $encryptable)) ? db_decrypt($column) : $column; diff --git a/tests/TestCase.php b/tests/TestCase.php index 72aabe5..986ac2d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -24,7 +24,7 @@ protected function getEnvironmentSetUp($app) 'port' => '3306', 'database' => 'testing', 'username' => 'root', - 'password' => '', + 'password' => 'tops12345', 'unix_socket' => '', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', diff --git a/tests/Unit/DatabaseTest.php b/tests/Unit/DatabaseTest.php index 8134a80..d5edb38 100644 --- a/tests/Unit/DatabaseTest.php +++ b/tests/Unit/DatabaseTest.php @@ -36,7 +36,6 @@ it('can match Sql syntex', function () { $query = Testing::query()->whereEncrypted('value', 'testing string')->toSql(); - echo PHP_EOL . $query . PHP_EOL; expect($query)->toMatch('/(AES_DECRYPT\(([^\)]+)\))/'); });