public function testNeedToBeAuthPages() { factory(\App\Models\Article::class)->create(); $article = \App\Models\Article::first(); $this->get('/admin/article/create')->assertResponseStatus(302); $this->get('/admin/article/' . $article->getKey() . '/edit')->assertResponseStatus(302); }
/** @test */ public function it_creates_an_article() { $user = factory(App\Models\User::class)->create(); $this->actingAs($user)->visit('articles/create')->type('Dummy Title', 'title')->type('Dummy Body', 'article')->click('Publish'); $this->seeInDatabase('articles', ['title' => 'Dummy Title', 'slug' => 'dummy-title', 'published' => true, 'author_id' => $user->id]); $article = Article::first(); $file = "{$article->path}/{$article->file}"; $this->assertTrue($this->app['files']->exists($file)); $this->app['files']->delete($file); }
public function testShow() { $article = Article::first(); $this->get('/article/' . $article->slug)->seeStatusCode(200)->see($article->getTitle()); }
public function article() { $this->view = View::make('home.article')->with(['article' => Article::first(), 'title' => 'haha', 'fuck_me' => 'f**k me!'])->withFuckMe('f**k you'); //var_dump($this->view); View::render($this->view); }
public function home() { View::make('welcome')->with('article', Article::first())->withTitle('Title')->withFine('我很棒')->withEricFzy('I`m Eric.fzy"'); }
public function testGetUser() { factory(Article::class)->create(); $article = Article::first(); $this->assertInstanceOf(\App\Models\User::class, $article->user); }