を期待タイプ "オブジェクト" と一致していません:Laravel PHPUnitのテスト: 'testuserとは、' 私は次のテストを持って
class AdminPanelTest extends TestCase
{
public function photoUpload()
{
$user = new App\User;
$user->username = "testUser";
$user->email = "[email protected]";
$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);
}
}
結果が'testUser' does not match expected type "object".
と言います。
ユーザーがデータベースに追加されました。
何か不足していますか?
確かに、テストメソッドに名前を付ける方法や、phpunitでアノテーションを使用する方法については、あなたが欠けています。 – lagbox
Ohhhありがとう。 – Gammer