Jul 16, 2015
0
Level 1
Only one test will pass at a time
I'm making a point to work on testing early on with a new project, but having a pretty rough time.
If I run either one of the tests below on their own, it will pass. However, when I attempt to run both tests, I am greeted with:
exception 'ErrorException' with message 'Undefined variable: errors’ in <compiled template path>
The views have some basic validation error rendering using this method: {{$errors->first('email')}}
<?php
class AuthTest extends TestCase {
function __construct()
{
parent::setUp();
}
protected $baseUrl = "http://portal.dev";
public function testUserRegistration()
{
$this->visit('/register')
->type('valid@email.com', 'email')
->press('Register')
->seePageIs('/login')
->see('The supplied email is already in the system. Login?');
}
public function testUserLogin()
{
$this->visit('/login')
->seePageIs('/login')
->type('valid@email.com', 'email')
->type('goodpass', 'password')
->press('Sign-In')
->seePageIs('/dashboard'));
}
}
It would appear something is going haywire with middleware and/or sessions, but I'm quite a bit green when it comes to phpunit, let alone testing Laravel.
Any guidance or clues are appreciated. Thanks!
Please or to participate in this conversation.