1 year ago

Struggling to find error in test

Posted 1 year ago by RossUK

Hi I am getting an error 500 on a test I am running and am struggling to find what I have dome wrong. Below is my test and controller method and route :)

 /** @test */
    public function authenticated_users_can_update_existing_customer()

        $customer = factory('App\Customer')->create();

        $data = [
        'company' => 'Acme Ltd',
        'first_name' => 'Ross',

        ->patchJson(route('customer.update', $customer->id),$data)

        $customer = $customer->fresh();

         $this->assertEquals('Acme Ltd', $customer->company);

And my Controller Method and route

public function update(Customer $customer,Request $request)


        return request()->wantsJson()
            ? response()->json($customer, 202)
            : null;
// Resource Routes
    Route::resource('customer', 'CustomerController')->middleware('auth');

Thanks for any help in advance :)

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