Skip to content

Instantly share code, notes, and snippets.

@Juhlinus
Created April 17, 2020 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Juhlinus/b9b0462e8dd923235c0aae8d8db3a952 to your computer and use it in GitHub Desktop.
Save Juhlinus/b9b0462e8dd923235c0aae8d8db3a952 to your computer and use it in GitHub Desktop.
Using config helper for testing

Did you know that you can "mock" configs in Laravel?

You might've already used this when altering config values during runtime, but it proves to be of great use during testing.

Maybe you want to test your login with a different hashing driver temporarily?

    /** @test */
    public function it_uses_the_argon_hashing_driver_instead()
    {
        config(['hashing.driver' => 'argon']);
        
        $this->post('/login');
    }

https://laravel.com/docs/master/helpers#method-config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment