예제 #1
0
파일: SearchTest.php 프로젝트: talv86/easel
 public function test_can_search_posts()
 {
     //create two posts to show up and one to not show
     $postA = factory(Post::class)->make(['title' => 'here is a test title that contains the word Easel', 'slug' => 'test-slug', 'content_raw' => 'no content']);
     $postB = factory(Post::class)->make(['title' => 'easel', 'content_raw' => 'here is a test content that contains the word Easel']);
     $postC = factory(Post::class)->make(['title' => 'this shouldnt show up', 'slug' => 'this-shouldnt-show-up-slug', 'subtitle' => 'this-shouldnt-show-up', 'meta_description' => 'this-shouldnt-show-up', 'content_raw' => 'this-shouldnt-show-up']);
     $postA->save();
     $postB->save();
     $postC->save();
     $posts = Post::whereIn('id', [$postA->id, $postB->id])->get();
     //$posts    = Post::search('easel')->get();
     $response = $this->actingAs($this->user)->call('GET', '/admin/search?search=easel');
     $this->assertEquals(200, $response->status());
     $this->assertViewHas('posts', $posts);
 }