php - Laravel Unit Testing AuthController -


i'm new unit testing , want try laravel 5.0.

i created authtest , implemented method checking if user known (stored in database) , credentials correct.

i don't know how test in best practice way. here i've done far:

public function testifcorrectcredentialsareaccepted() {     $credentials = [ '_token' => csrf_token(), 'username' => 'test', 'password' => 'test' ];      $user = user::create([ 'username' => $credentials['username'], 'firstname' => 'test', 'surname' => 'test' ]);      $this->call('post', '/auth/login', $credentials);     $this->asserttrue(\auth::check());      db::table('users')->where('username', $user->username)->delete(); } 

the known users stored inside database, credential validation done on adldap ldap-connector (laravel service provider extending laravel auth).

am going right way, or failing @ beginning?

thank you!


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -