title: laravel testable store method with validation in basemodel
body: <p>I am trying to test creating a follower, however, because I am calling Auth::user()->id I get the error "Trying to get property of non-object". At the moment I have been building an input array and when I run the create method the validation is triggered from a boot method in the BaseModel. Is there a way I should mock the $input array or should I do the validation in the create method in my repository?</p>
  
  <pre><code>&lt;?php
  
  class FollowersTest extends TestCase {
  
  public function setUp()
  {
    parent::setUp();
  
    $this-&gt;mock = $this-&gt;mock('Convoconnect\Storage\Follower\FollowerRepository');
  }
  
  public function mock($class)
  {
    $mock = Mockery::mock($class);
  
    $this-&gt;app-&gt;instance($class, $mock);
  
    return $mock;
  }
  
  public function tearDown()
  {
    Mockery::close();
  }
  
  /**
   * Test Store success
   */
  public function testStoreSuccess()
  {
    $input = [
      'user_id' =&gt; 1,
      'follower_id' =&gt; 4,
    ];
  
      $this-&gt;mock
          -&gt;shouldReceive('create')
          -&gt;once();
  
    $this-&gt;call('POST', 'followers', $input);
  
    $this-&gt;assertRedirectedToRoute('followers.index');
   }
  }
  
  
  
  &lt;?php
  
  use Convoconnect\Storage\Follower\FollowerRepository as Follower;
  
  class FollowersController extends BaseController {
  
  /**
  * Follower Repository
  *
  * @var Follower
  */
  protected $follower;
  
  public function __construct(Follower $follower) {
      $this-&gt;follower = $follower;
  }
  
  public function store() {
  
      $input = [
          'user_id' =&gt; Auth::user()-&gt;id,
          'follower_id' =&gt; Input::get('follower_id'),
      ];
  
      $follower = $this-&gt;follower-&gt;create($input);
  
      if($follower-&gt;save()) return Redirect::route('followers.index');
  
      return Redirect::back()
          -&gt;withInput()
          -&gt;withErrors($follower-&gt;errors);
   }
  }   
  </code></pre>