Models Expectations

toBeDeleted()

Assert the given model to be deleted.

expect($model)->toBeDeleted();

toBelongTo()

Assert the given model belongs to another one.

expect($post)->toBelongTo($user);

toBeSameModelAs()

Assert that the given model has the same ID and belong to the same table of another model.

expect($post)->toBeSameModelAs($anotherPost);

toBeSoftDeleted()

Assert the given model to be soft deleted.

expect($model)->toBeSoftDeleted();

toExist()

Assert the given model exists in the database.

expect($model)->toExist();

toOwn()

Assert the given model owns child model.

expect($user)->toOwn($post); //<-- HasMany relationship

expect($user)->toOwn($address); //<-- HasOne relationship
Edit this page on GitHub Updated at Wed, Feb 8, 2023