/** * GET | Redirect the user if the 'users' table is empty or not * then redirect it to either login or registration. * * @return mixed */ public function trySampleForms() { if (User::count()) { return redirect()->to(route('showLoginForm'))->withInfo(lang()->get('responses/login.pre_flash_message')); } return redirect()->to(route('showRegistrationForm'))->withInfo(lang()->get('responses/register.pre_flash_message')); }
public function testLogin() { if (!User::count()) { $this->testRegistration(); } $this->triggerWelcomeProcess(); # LOGIN $this->assertEquals('200', $this->session->getStatusCode()); // === 200 $this->assertContains($this->url . '/auth/login', $this->session->getCurrentUrl()); // === $this->url.'auth/register' $login_page = $this->session->getPage(); $login_btn = $login_page->find('named', ['id', 'login-btn']); $login_page->fillField('email', $this->email); $login_page->fillField('password', $this->password); $login_btn->press(); // $login_page->pressButton('login-btn'); sleep(5); $this->assertContains($this->url . '/newsfeed', $this->session->getCurrentUrl()); // === $this->url.'newsfeed' }