Level 2
I sorted this using the following, not sure if this the best way
$this->faker('en_GB')->phoneNumber;
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 :)
<?php
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(),
]);
}
}
I sorted this using the following, not sure if this the best way
$this->faker('en_GB')->phoneNumber;
Please or to participate in this conversation.