dimanche 26 juin 2016

Laravel PHPunit test: 'testUser' does not match expected type "object"

I have the following test :

class AdminPanelTest extends TestCase
{
public function photoUpload()
{
    $user = new App\User;
    $user->username = "testUser";
    $user->email = "testUser@hotmail.com";
    $user->password = bcrypt("testUser");
    $user->photo_url = "abc.jpg";
    $user->save();

    $test = App\User::where('username','=','testUser');
    $this->assertEquals($test,'testUser');
    $this->assertCount(1,$test);
}

}

The result says that 'testUser' does not match expected type "object"..

The user is added to the database.

Am i missing something ?

Aucun commentaire:

Enregistrer un commentaire