mercredi 26 avril 2017

how can call user that created in setup function in other function

this is my code

     public function setUp()
     {
        parent::setUp();
        $this->createApplication();

        $this->user = factory(App\User::class)->create([
                'email' => 'testuser@email.com',
                'password' => bcrypt($this->password)
                ]);
    }

    /** @test */
    public function funcTest()
    {   
        $this->actingAs($user);
        $this->visit('/client/ocp/profile/247')
             ->click('New ')
             ->seePageIs('/client/ocp/profile/247/create')
    }
}

i try this code and run test using phpunit i got this error

ErrorException: Undefined variable: user

how can I fix this error?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire