/** * Tests the insertion process * of a new article. **/ public function testRepositoryCreateArticleArticleInserted() { $title = 'new title for a new article'; $article = $this->repo->createArticle(Scenario::prepareUser(), 'new title for a new article'); $this->assertNotNull($article); $this->assertInstanceOf('App\\Models\\Article', $article); $this->assertNotNull($article->title); $this->assertEquals($article->title, 'new title for a new article'); $this->seeInDatabase('articles', ['id' => $article->id, 'title' => $article->title]); }
/** * Tests the logout. **/ public function testLogoutLoggedOut() { Scenario::logoutUser(); $user = Scenario::prepareUser('test@mail.t', 'pass123'); $this->visit('auth/login')->type($user->email, 'email')->type('pass123', 'password')->check('remember')->press('Login')->seePageIs('/'); $loggedUser = Scenario::getLoggedUser(); $this->assertNotNull($loggedUser); $this->visit('auth/logout')->seePageIs('/'); $loggedUser = Auth::user(); $this->assertNull($loggedUser); }
/** * Tests if the updateUser method * on the repo is working. **/ public function testRepoUpdateUserUserUpdated() { $user = Scenario::prepareUser(); $this->repo->update($user, 'new test name', 'new pass test'); $this->seeInDatabase('users', ['id' => $user->id, 'email' => $user->email, 'name' => 'new test name']); }