title: Laravel unit testing of controllers
body: <p>I am trying to start a new Laravel app following TDD</p>
  
  <p>My first step is to check that the /login controller is called on the home url.</p>
  
  <p>Despite following several tutorials I can't get the test to work and I can't see what I'm doing wrong at all.</p>
  
  <p>My set up is:
  composer to install laravel
  composer to install phpunit</p>
  
  <p>here is my route:</p>
  
  <pre><code>&lt;?php
  Route::get('/login', 'AuthenticationController@login');
  </code></pre>
  
  <p>my controller:</p>
  
  <pre><code>&lt;?php
  
  class AuthenticationController extends BaseController {
  
      public function login () {
          return View::make('authentication.login');
      }
  
  }
  </code></pre>
  
  <p>And my test:</p>
  
  <pre><code>&lt;?php
  
  class AuthenticationTest extends TestCase {
  
      public function testSomeTest () {
  
          $response = $this-&gt;action('GET', 'AuthenticationController@login');
  
          $view = $response-&gt;original;
  
          $this-&gt;assertEquals('authentication.login', $view['name']);
      }
  }
  </code></pre>
  
  <p>The error I get is </p>
  
  <pre><code>  ErrorException: Undefined index: name
  </code></pre>
  
  <p>The code as a copy (pretty much exactly) from the Laravel site, yet it doesn't run.</p>
  
  <p>Can anyone see what I'm doing wrong?</p>
  
  <p>It claims $view has no index name, but that can't be right as its the example on the laravel website, plus the view is being rendered using its name (it is showing correctly on the front end too)</p>
  
  <p>EDIT::</p>
  
  <p>So it seems from a comment that the laravel unit testing section isn't clear and that the $view['name'] is checking for a variable called $name. If that is the case, how do you test the controller/route used, IE. what controller name/action name has been used for route('X')</p>