thanks for your reply.
I will include the code below as reference. what i really want to understand is - should my test be using Faker/Factory when i am using the DatabaseMigrations trait? And is this error (Error: Class 'Faker\Factory' not found) relevant. I am on version laravel v5.5.
snippet of my test code:
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use App\Models\User;
class CreateQuestionTest extends DuskTestCase
{
public function testCreateUser()
{
//dd(env('APP_ENV'));
$user = factory(User::class)->create([
'name' => 'test user',
'password' => 'password',
'email' => '[email protected]'
]);
....
}
snipped of env.dusk.local file (rest of properties repeated from .env file:
APP_ENV=local
APP_KEY=
APP_URL=http://localhost
DB_CONNECTION=mysql_test
DB_DATABASE=testdb
APP_DEBUG=TRUE
and snippet of the database.php config:
'mysql_test' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'database' => env('DB_DATABASE', database_path('mytestdb.mysql')),
'prefix' => '',
I created the empty mytestdb.mysql in the database dir.
This is exactly how I have seen it implemented from other posts here so i dont think i am missing anything.
im trying to understand the use of this Faker/Factory class. Should my test really be using this class to create the user objects? if so, it looks like i am missing this class. did anyone else have to import this library for dusk tests??