diff --git a/app/Helpers/RandomHelper.php b/app/Helpers/RandomHelper.php deleted file mode 100644 index 65eef25b5..000000000 --- a/app/Helpers/RandomHelper.php +++ /dev/null @@ -1,25 +0,0 @@ - 0; $i--) { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - - return $randomString; - } -} diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index dbb39734f..8e8aeda02 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -7,7 +7,6 @@ use App\User; use Validator; use App\Account; use Carbon\Carbon; -use App\Helpers\RandomHelper; use App\Jobs\SendNewUserAlert; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\RegistersUsers; @@ -93,7 +92,7 @@ class RegisterController extends Controller // create a new account $account = new Account; - $account->api_key = RandomHelper::generateString(30); + $account->api_key = str_random(30); $account->created_at = Carbon::now(); $account->save(); diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 0d3115aec..7c104c2e9 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -9,7 +9,6 @@ use App\ImportJob; use Carbon\Carbon; use App\Invitation; use Illuminate\Http\Request; -use App\Helpers\RandomHelper; use App\Jobs\SendNewUserAlert; use App\Jobs\ExportAccountAsSQL; use App\Jobs\AddContactFromVCard; @@ -265,7 +264,7 @@ class SettingsController extends Controller + [ 'invited_by_user_id' => auth()->user()->id, 'account_id' => auth()->user()->account_id, - 'invitation_key' => RandomHelper::generateString(100), + 'invitation_key' => str_random(100), ] ); diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 36705add9..a12e8991a 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -11,8 +11,6 @@ | */ -use App\Helpers\RandomHelper; - $factory->define(App\User::class, function (Faker\Generator $faker) { return [ 'first_name' => $faker->firstName, @@ -28,7 +26,7 @@ $factory->define(App\User::class, function (Faker\Generator $faker) { $factory->define(App\Account::class, function (Faker\Generator $faker) { return [ - 'api_key' => RandomHelper::generateString(30), + 'api_key' => str_random(30), ]; }); diff --git a/tests/Helper/RandomHelperTest.php b/tests/Helper/RandomHelperTest.php deleted file mode 100644 index 8156b4d57..000000000 --- a/tests/Helper/RandomHelperTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertTrue(30 == strlen($randomString)); - } - - public function testThatGenerateStringIsNotEmpty() - { - $randomString = RandomHelper::generateString(30); - $this->assertNotNull($randomString); - } -} diff --git a/tests/Unit/ImportVCardsTest.php b/tests/Unit/ImportVCardsTest.php index 675b82f40..2f4512d41 100644 --- a/tests/Unit/ImportVCardsTest.php +++ b/tests/Unit/ImportVCardsTest.php @@ -8,7 +8,6 @@ use App\Contact; use App\Country; use Mockery as m; use Tests\TestCase; -use App\Helpers\RandomHelper; use Illuminate\Foundation\Testing\DatabaseTransactions; class ImportVCardsTest extends TestCase @@ -96,7 +95,7 @@ class ImportVCardsTest extends TestCase $user->password = bcrypt('secret'); $account = new Account(); - $account->api_key = RandomHelper::generateString(30); + $account->api_key = str_random(30); $account->save(); $user->account_id = $account->id;