title: Laravel phpunit assertViewHas doesn't match the expected test data
body: <p>I am writing a test for my search method, but had currently a assertSee and want to change it for a assertViewHas for a better test result. But the data that I get from the search method does not want to match the data I expect.</p>
  
  <p>This is where I set <code>$user</code>:</p>
  
  <pre><code>protected $user;
  
  public function setUp()
  {
      parent::setUp();
  
      $this-&gt;seed();
  
      $this-&gt;user = factory(User::class)-&gt;create(['role_id' =&gt; 3]);
  }
  </code></pre>
  
  <p>This is where I'm making the assertion:</p>
  
  <pre><code>$response = $this-&gt;followingRedirects()-&gt;actingAs($this-&gt;user)-&gt;get('/manage/users/search?choices=username&amp;search='.$this-&gt;user-&gt;username.'');
  
  $response-&gt;assertViewIs('manage.users');
  $response-&gt;assertSuccessful();
  $response-&gt;assertViewHas('users', $this-&gt;user);
  </code></pre>
  
  <p>And this is the data it will return from the controller:</p>
  
  <pre><code>$result = User::where('username', 'LIKE', '%'. $request-&gt;get('search') .'%')
                  -&gt;orderBy('username', 'asc')-&gt;paginate(20);
  return view('manage.users')-&gt;with('users', $result);
  </code></pre>
  
  <p>What am I doing wrong to get the matching data?</p>