简体   繁体   中英

Lumen - Testing PUT doesn't seem to work

I created a test like so:

$user = factory(Users::class)->create([
            'userID'=>5
        ]);
        $this->actingAs($user)
            ->put('/user/5', [
                'name' => "Bob Smith",
            ])
            ->get('/user/5')
            ->seeJson(['name'=>'Bob Smith']);

But when I run it, the test fails because the PUT didn't update the name of the user. How can I get it to update the user please?

Fixed it in the end. Changed the put('/user/5', ['name' => "Bob Smith"]) line to json('put', '/user/5', ['name' => "Bob Smith"])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM