Skip to content

Commit a7d30f5

Browse files
committed
Env, README & Tests
1 parent 958641d commit a7d30f5

File tree

6 files changed

+42
-28
lines changed

6 files changed

+42
-28
lines changed

.env.testing

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DB_CONNECTION=sqlite
2+
DB_DATABASE=database.sqlite

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.env
2-
.env.testing
32
artisan
43
/bootstrap
54
/storage/*.key

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,31 @@
44

55
Available in config/db_mask.php
66

7+
8+
Sample configuration file
9+
10+
return [
11+
/*
12+
* |--------------------------------------------------------------------------
13+
* | DB Mask rules
14+
* |--------------------------------------------------------------------------
15+
* |
16+
*/
17+
'chunk' => 1000,
18+
'tables' => [
19+
'users' => [
20+
'firstname' => 'firstName',
21+
'lastname' => 'lastName',
22+
'email' => function (Faker $faker) {
23+
return $faker->email;
24+
},
25+
'number' => function (Faker $faker, array $record) {
26+
return $record['id'] . $faker->numberBetween(0, 100000);
27+
}
28+
]
29+
]
30+
];
31+
732
### Usage
833

9-
Description:
10-
Laravel DB Faker Masking.
34+
artisan db:mask

src/Console/Kernel.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Illuminate
55
use Illuminate\Console\Scheduling\Schedule;
66
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7-
use DbFakerMask\Commands\DbHumanizeCommand;
7+
use DbFakerMask\Commands\DbFakerMaskCommand;
88

99
class Kernel extends ConsoleKernel
1010
{
@@ -15,7 +15,7 @@ class Kernel extends ConsoleKernel
1515
* @var array
1616
*/
1717
protected $commands = [
18-
DbHumanizeCommand::class
18+
DbFakerMaskCommand::class
1919
];
2020

2121
/**
@@ -26,14 +26,4 @@ class Kernel extends ConsoleKernel
2626
*/
2727
protected function schedule(Schedule $schedule)
2828
{}
29-
30-
// /**
31-
// * Register the Closure based commands for the application.
32-
// *
33-
// * @return void
34-
// */
35-
// protected function commands()
36-
// {
37-
// require base_path('routes/console.php');
38-
// }
3929
}

tests/DbFakerMaskTest.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,17 @@ protected function setUp()
1616
* @var \Illuminate\Foundation\Application $app
1717
*/
1818
$app = require __DIR__ . '/bootstrap/app.php';
19-
// $app->loadEnvironmentFrom('.env.testing');
19+
$app->loadEnvironmentFrom('.env.testing');
2020
$app->make(\Tests\Kernel::class)->bootstrap();
2121

2222
$faker = \Faker\Factory::create();
2323

2424
$options = [
25-
'chunk' => 820,
25+
'chunk' => 20,
2626
'tables' => [
2727
'users' => [
2828
'firstname' => 'firstName',
29-
'lastname' => 'lastName',
30-
'email' => function (\Faker\Generator $faker) {
31-
return $faker->unique()->username . date('YmdHis') . '@test.com';
32-
}
33-
],
34-
'shops' => [
35-
'name' => 'company',
36-
'url' => function (\Faker\Generator $faker) {
37-
return $faker->url;
38-
}
29+
'lastname' => 'lastName'
3930
]
4031
]
4132
];
@@ -48,7 +39,7 @@ public function testConstructor()
4839
$this->assertTrue($this->dbFakerMask instanceof DbFakerMask);
4940
}
5041

51-
// public function testHumanize()
42+
// public function testMasking()
5243
// {
5344
// $this->dbFakerMask->mask();
5445

tests/bootstrap/.env.testing

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
APP_ENV=development
2+
APP_DEBUG=true
3+
CONNECTION=mysql
4+
DB_DATABASE=merchant_prod_prod_human
5+
DB_HOST=127.0.0.1
6+
DB_PORT=3310
7+
DB_USERNAME=root
8+
DB_PASSWORD=s3cr3t

0 commit comments

Comments
 (0)