Last active
December 21, 2017 09:23
-
-
Save awgv/7a8110886cae4e37ffa586ab1f06c8c7 to your computer and use it in GitHub Desktop.
[Laravel] Use `Hash::setRounds(4)` in CreatesApplication trait to speed up your tests
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
<?php | |
/* | |
People are seeing test speeds improve by 15-55%. | |
Results will vary depending on how much user seeding and hasing your tests are doing. | |
Now included in laravel/laravel by default: https://github.com/laravel/laravel/pull/4517 | |
*/ | |
namespace Tests; | |
use Illuminate\Support\Facades\Hash; | |
use Illuminate\Contracts\Console\Kernel; | |
trait CreatesApplication | |
{ | |
/** | |
* Creates the application. | |
* | |
* @return \Illuminate\Foundation\Application | |
*/ | |
public function createApplication() | |
{ | |
$app = require __DIR__.'/../bootstrap/app.php'; | |
$app->make(Kernel::class)->bootstrap(); | |
Hash::setRounds(5); | |
return $app; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment