@Danieloplata Probably just a missing ;, but in your User::class or Thread::class. Your test looks good.
Oct 23, 2018
3
Level 15
ParseError: syntax error, unexpected 'public' (T_PUBLIC), expecting ',' or ';'
Currently following this lesson (I'm using Laravel 5.7)
https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/4?autoplay=true
I'm getting the following error in my test:
1) Tests\Unit\ThreadTest::a_thread_is_owned_by_a_user
ParseError: syntax error, unexpected 'public' (T_PUBLIC), expecting ',' or ';'
Here is the code from my test:
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ThreadTest extends TestCase
{
use RefreshDatabase;
protected $thread;
public function setUp()
{
parent::setUp();
$this->thread = factory('App\Thread')->create();
}
/** @test */
public function a_thread_is_owned_by_a_user()
{
$this->assertInstanceOf('App\User', $this->thread->user);
}
/** @test */
public function a_thread_has_replies()
{
$this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $this->thread->replies);
}
/** @test */
public function a_thread_can_add_a_reply()
{
$this->thread->addReply([
'body' => 'Foobar',
'user_id' => 1
]);
$this->assertCount(1, $this->thread->replies);
}
}
I'm guessing based on the error that I've made a stupid mistake somewhere in here, but I can't seem to spot it
Level 14
1 like
Please or to participate in this conversation.