DEF STUDIO srl

Models Expectations

toBe() (available from v2, still with v1? Upgrade!)

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

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

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
Suggest a change
Last updated 10 September 2024