tests/Feature/Admin/ManagePostsControllerTest.php
/**
     * Test can update a post.
     */
Test can update a post.
Test can update a post .
public function testUpdate(): void
    {
        $this->beAdminUser();
        $post = factory(Post::class)->create();
        $params = $post->toArray();
        $params['title'] = $this->faker->sentence;
        $response = $this->patch(route('blogetc.admin.edit_post', $post), $params);
        $response->assertSessionHasNoErrors()->assertRedirect();
        $this->assertDatabaseHas('blog_etc_posts', ['title' => $params['title']]);
    }
public function testUpdate ( ) : void { $ this -> beAdminUser ( ) ; $ post = factory ( Post :: class ) -> create ( ) ; $ params = $ post -> toArray ( ) ; $ params [ 'title' ] = $ this -> faker -> sentence ; $ response = $ this -> patch ( route ( 'blogetc.admin.edit_post' , $ post ) , $ params ) ; $ response -> assertSessionHasNoErrors ( ) -> assertRedirect ( ) ; $ this -> assertDatabaseHas ( 'blog_etc_posts' , [ 'title' => $ params [ 'title' ] ] ) ; }
Test can update a post.
Test can update a post .
// Update title.