Closed
Description
- Laravel Version: 5.8.*
- PHP Version: 7.2.5
- Database Driver & Version: sqlite
Description:
public function testCreateRecord()
{
// case 1:
$factory = factory('App\User')->create([
'name' => 'test',
'email' => '[email protected]',
'password' => Hash::make('1'),
]);
// case 2:
$factory = factory('App\Http\Models\Stock')->create([
'name' => 'mango',
'price' => 300,
]);
$this->assertEquals('mango', $stock->name);
$this->assertEquals(300, $stock->name);
}
I don't know case 1 working fine but why case 2 throws an error.
(InvalidArgumentException : Unable to locate factory with name [default] [App\Http\Models\Stock].)
As I defined an App\Http\Models\Stock
model and it's working properly, But not working in factory
method.
Steps To Reproduce:
- Create new laravel project.
- Create Model base on the given namespace
- Then Try to use factory method
Metadata
Metadata
Assignees
Labels
No labels