Level 73
Here is the reason:
And short answer is change the import:
//from
use PHPUnit\Framework\TestCase;
// to
use Tests\TestCase;
Hi everyone,
I'm new to Laravel and I'm following this tutorial on Laracasts. I'm trying to run a unit test to see if a Reply belongs to a User, but it fails.
This is my error message:
1) Tests\Unit\ReplyTest::it_has_an_owner
InvalidArgumentException: Unable to locate factory for [App\Reply].
Here's my unit test class:
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ReplyTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function it_has_an_owner()
{
$reply = factory('App\Reply')->create();
$this->assertInstanceOf('App\User', $reply->owner);
}
}
I've got no idea what to do, so I hope you can help me. If you need more information, please ask me.
Thanks for reading! Jeroen
Here is the reason:
And short answer is change the import:
//from
use PHPUnit\Framework\TestCase;
// to
use Tests\TestCase;
Please or to participate in this conversation.