-
Notifications
You must be signed in to change notification settings - Fork 0
Database Test
hywkd3 edited this page Dec 4, 2019
·
1 revision
- DB에 존재 여부를 확인하는 테스트 가능
- 팩토리를 먼저 생성해야 한다.
- Php artisan make:factory PostFactory –model=Post
- database/factories 디렉토리에 생성
메소드 | 설명 |
---|---|
$this->assertDatabaseHas($table, array $data); | 데이터베이스에서 테이블에 주어진 데이터가 존재하는지 확인. |
$this->assertDatabaseMissing($table, array $data); | 데이터베이스에서 테이블에 주어진 데이터가 존재하지 않는 것을 확인. |
$this->assertDeleted($table, array $data); | 주어진 레코드가 삭제되었는지 확인. |
$this->assertSoftDeleted($table, array $data); | 주어진 레코드가 소프트 삭제 되었는지 확인. |