Localised Faker in Test - Laravel 5.5

Posted 10 months ago by RossUK

Please can someone help me to use an en_GB instance of faker within tests. I have tried reading the docs but can only find examples of using Faker in Factories and not using WithFaker in a test like below. Here is an example of where I would like to implement it :)


namespace Tests\Unit;

use App\User;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;

class LoginTest extends TestCase

    use WithFaker;

     * A basic test example.
     * @return void

    /** @test */
    public function test_example()

        $user = User::create([
            'mob_no' => $faker-> mobileNumber(),



Please sign in or create an account to participate in this conversation.