Hello,
I am following Jeffs course series called: "Lets Build a Forum With Laravel" and I am running into an issue I cannot seem to fix even after looking at solutions online :/
The issue I am having is on Episode 3 at around 7:35. He is writing the code like so (and this is what I have too):
namespace Tests\Unit;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use PHPUnit\Framework\TestCase;
class ReplyTest extends TestCase
{
use DatabaseMigrations;
public function test_it_has_owner()
{
$reply = factory('App\Reply')->create();
$this->assertInstanceOf('App\User', $reply->owner);
}
}
And I run the unit test but get this error: InvalidArgumentException: Unable to locate factory with name [default] [App\Reply]..
I have the factory and I know it exists/works because I am able to use it in php artisan tinker:
Psy Shell v0.9.12 (PHP 7.4.0 — cli) by Justin Hileman
>>> $reply = factory('App\Reply')->create();
=> App\Reply {#3067
thread_id: 1,
user_id: 2,
body: "Cumque blanditiis corrupti ut consequatur doloribus corrupti. Esse cupiditate maxime officiis officia. Voluptatem aut velit dicta molestiae.",
updated_at: "2019-12-15 19:59:41",
created_at: "2019-12-15 19:59:41",
id: 1,
}
>>>
But for some reason in the test it does not work? I am wondering if someone is able to help/point me in the direction that's able to fix the issue I am having.
Thank you!