title: how can call user that created in setup function in other function
body: <p>this is my full code that I write it to test function from controller </p>
  
  <pre><code>       &lt;?php
  
  use Illuminate\Foundation\Testing\WithoutMiddleware;
  use Illuminate\Foundation\Testing\DatabaseMigrations;
  use Illuminate\Foundation\Testing\DatabaseTransactions;
  use Illuminate\Foundation\Testing\Concerns\MakesHttpRequests;    
  
  class RouteForecastTest extends TestCase
  {   
  
      protected $password = 'rightpassword';
  
       public function setUp()
       {
          parent::setUp();
          $this-&gt;createApplication();
  
          $this-&gt;user = factory(App\User::class)-&gt;create([
                  'email' =&gt; 'testuser@email.com',
                  'password' =&gt; bcrypt($this-&gt;password),
                  'type' =&gt; 'admin'
                  ]);
      }
  
      /** @test */
      public function createTest()
      {   
          $this-&gt;actingAs($user);
          $this-&gt;visit('/client/ocp/profile/247')
               -&gt;click('New ')
               -&gt;seePageIs('/client/ocp/profile/247/create')
               -&gt;see('name');
      }
      public function tearDown(){
          parent::tearDown();
          $this-&gt;user-&gt;delete();
      }
  }
  </code></pre>
  
  <p>i try this code with setup and teardown methods and run test using phpunit i got this error  </p>
  
  <pre><code>ErrorException: Undefined variable: user
  </code></pre>
  
  <p>how can I fix this error?</p>