guests_may_not_create_threads

Posted 2 months ago by hjortur17

Hi, I'm having trouble getting me tests to run. It always respond with this:

Failed asserting that exception of type "Illuminate\Database\QueryException" matches expected exception "Illuminate\Auth\AuthenticationException". Message was: "SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: threads.user_id

And this is my code:

/** @test */
    function guests_may_not_create_threads()
    {
        $this->expectException('Illuminate\Auth\AuthenticationException');

        $thread = factory('App\Thread')->make();

        $this->post('/frettir', $thread->toArray());
    }

And the Controller has

public function __contstuct()
       {
              $this->middleware('auth')->only('store');
       }

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.