tests/Feature/Admin/ManagePostsControllerTest.php
/**
     * Test admin index page lists posts.
     */
Test admin index page lists posts.
Test admin index page lists posts .
public function testIndexIncludesRecentPost(): void
    {
        $post = factory(Post::class)->create();
        $this->beAdminUser();
        $response = $this->get(route('blogetc.admin.index'));
        $response->assertSee($post->title);
        $response->assertViewHas('posts');
        $posts = $response->viewData('posts');
    }
public function testIndexIncludesRecentPost ( ) : void { $ post = factory ( Post :: class ) -> create ( ) ; $ this -> beAdminUser ( ) ; $ response = $ this -> get ( route ( 'blogetc.admin.index' ) ) ; $ response -> assertSee ( $ post -> title ) ; $ response -> assertViewHas ( 'posts' ) ; $ posts = $ response -> viewData ( 'posts' ) ; }
Test admin index page lists posts.
Test admin index page lists posts .