ParseError: syntax error, unexpected 'public' (T_PUBLIC), expecting ',' or ';'

Posted 8 months ago by Danieloplata

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

Please sign in or create an account to participate in this conversation.